本文整理汇总了PHP中ArrayObject::count方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::count方法的具体用法?PHP ArrayObject::count怎么用?PHP ArrayObject::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPayments
/**
* Get parsed payments
*
* @return \ArrayObject Payments array
*/
public function getPayments()
{
if ($this->_payments->count() == 0) {
$this->_logger->info("No payments found, did you invoke Parser::parse() before this call?");
}
return $this->_payments;
}
示例2: count
public function count()
{
if (!isset($this->data)) {
$this->lazyInitialization();
}
return $this->data->count();
}
示例3: validate
/**
* Valida o código de barras.
* @param mixed $value
* @return boolean
*/
public function validate($input)
{
$input = new StringHelper($input);
$digitoCean = 0;
$indiceInicial = 0;
$digitoCalculo = 0;
$digitoCalculado = 0;
$tamCean = $input->length;
$ceanSemDigito = new StringHelper();
if (!in_array($tamCean, array(8, 12, 13, 14, 18))) {
return false;
}
$digitoCean = (int) $input->right(1, 1)->getValue();
$ceanSemDigito->setValue($input->left(0, $input->length - 1)->getValue());
$indiceInicial = $this->p->count() - $ceanSemDigito->length;
for ($i = 0; $i < $ceanSemDigito->length; $i++) {
$digitoCalculo += (int) $ceanSemDigito->substring($i, 1)->getValue() * $this->p->offsetGet($indiceInicial++);
}
if ($digitoCalculo % 10 == 0) {
$digitoCalculado = 0;
} else {
$divTemp = (int) ceil($digitoCalculo / 10.0) * 10;
$digitoCalculado = $divTemp - $digitoCalculo;
}
if ($digitoCalculado === $digitoCean) {
return true;
}
return false;
}
示例4: getAll
/**
* @return \ArrayObject|DistributorItem[]
*/
public function getAll()
{
if (!$this->items->count()) {
if ($this->rawItems->count()) {
foreach ($this->rawItems as $item) {
$this->items->append(new DistributorItem($item));
}
}
}
return $this->items;
}
示例5: isClosed
/**
* @return bool
*/
public function isClosed()
{
if ($this->points->count() < 3) {
return false;
}
$firstPoint = $this->points->offsetGet(0);
$lastPoint = $this->points->offsetGet($this->points->count() - 1);
if ($firstPoint->getX() == $lastPoint->getX() && $firstPoint->getY() == $lastPoint->getY()) {
return true;
}
return false;
}
示例6: createCVS
/**
* Crea un fichero csv con todas las facturas en sistema extraidas
* en el corte de la consulta.
*/
public function createCVS()
{
$message = null;
try {
\helper\FileSystemHelper::createCVS('allInvoicesFromDatabase', $this->listDTO);
$dir = __DIR__;
$message = "[34m Se ha creado el archivo [35m allInvoicesFromDatabase.csv [34m en {$dir}\n";
echo "{$this->listDTO->count()}\n";
} catch (\Exception $e) {
error_log($e->getMessage(), 0);
error_log($e->getTraceAsString(), 0);
$message = "[31m {$e->getMessage()}";
}
return $message;
}
示例7: run
/**
* Run TestCase.
*
* @param TestCase $testCase
*
* @return int Status code
*/
public function run(TestCase $testCase)
{
$this->precondition($testCase);
if ($this->tests->count() == 0) {
$this->logger->notice('Tests not found in TestCase', ['pid' => getmypid()]);
/** @var EventDispatcherInterface $dispatcher */
$dispatcher = $this->container->get('dispatcher');
$dispatcher->dispatch(EventStorage::EV_CASE_FILTERED);
return 1;
}
$statusCode = 0;
$testCaseEvent = new TestCaseEvent($this->reflectionClass->getName());
$testCaseEvent->setAnnotations(self::getAnnotations($this->reflectionClass->getDocComment()));
$this->controller->beforeCase($testCaseEvent);
foreach ($this->tests as $test) {
if ($test->getStatus() !== TestMeta::TEST_NEW && $test->getStatus() !== TestMeta::TEST_MARKED) {
continue;
}
if ($this->testMethod($test)) {
$statusCode = 1;
}
}
$this->controller->afterCase($testCaseEvent);
return $statusCode;
}
示例8: elementAtOf
/**
* シーケンス内の指定されたインデックス位置にある要素を返します。
*
* @param \ArrayObject $source 返される要素が含まれるシーケンス
* @param int $index 取得する要素の 0 から始まるインデックス
*
* @return mixed シーケンス内の指定された位置にある要素
*/
public function elementAtOf(\ArrayObject $source, int $index)
{
if ($index < 0 || $index >= $source->count()) {
throw new \OutOfRangeException();
}
return $source->offsetGet($index);
}
示例9: parseRawToList
private function parseRawToList($raw)
{
$raw = trim($raw);
if (!empty($raw)) {
$list = new \ArrayObject();
$token = explode(PHP_EOL, $raw);
$a = 1;
while ($a < count($token)) {
next($token);
$attr = new Attribute();
if (!(current($token) == "!re") && !(current($token) == "!trap")) {
$split = explode("=", current($token));
$attr->setName($split[1]);
if (count($split) == 3) {
$attr->setValue($split[2]);
} else {
$attr->setValue(NULL);
}
$list->append($attr);
}
$a++;
}
if ($list->count() != 0) {
$this->result->add($list);
}
}
}
示例10: buildLastPage
public function buildLastPage()
{
$page = null;
if ($this->listPage->count() > 0) {
$page = $this->listPage->offsetGet($this->listPage->count());
}
$this->lastPage = $page;
}
示例11: getResultsFound
public function getResultsFound()
{
if ($this->results->count() > 0) {
$result = $this->results->getIterator();
$responseJson = '[';
while ($result->valid()) {
$object = $this->buildObject($result->current());
$responseJson .= $object->toJSON() . ',';
$result->next();
}
$responseJson = substr($responseJson, 0, -1);
$responseJson .= ']';
return $responseJson;
} else {
return null;
}
}
示例12: getCurrentSitemapNode
public function getCurrentSitemapNode(Request $request)
{
$routeName = $request->get('_route');
$routeParameters = $request->get('_route_params');
//Agregar los parámetros http del requerimiento actual a la WebLocation.
$routeParameters = array_merge($routeParameters, $request->query->all());
$location = new RouteBasedLocation($routeName, $routeParameters);
$it = new RouteSitemapNodeFilterIterator($this->getSitemap()->getIterator(), $location);
$nodes = new \ArrayObject(iterator_to_array($it, false));
if ($nodes->count() > 1) {
throw new \Exception("Se encontró mas de un nodo en el sitemap que coincide con el requerimiento HTTP.");
}
if ($nodes->count() == 0) {
throw new \Exception("No se encontró ningun nodo en el sitemap que coincida con el requerimiento actual.");
} else {
return $nodes[0];
}
}
示例13: testOfType
/**
* @dataProvider providerOfType
*/
public function testOfType($source, $type, $expectedParam)
{
$expected = new \ArrayObject($expectedParam);
$mock = $this->getMockForTrait('Yukar\\Linq\\Enumerable\\TInspection');
$result = $mock->ofTypeOf(new \ArrayObject($source), $type);
$this->assertInstanceOf('\\ArrayObject', $result);
$this->assertCount($expected->count(), $result);
$this->assertEquals($expected, $result);
}
示例14: drawHTML
/**
* @param \ArrayObject|\ArrayObject[] $logs
* @param bool $amsterdamSuffix
*
* @return string
*/
protected function drawHTML($logs, $amsterdamSuffix = false)
{
$displayLog = '';
if ($logs && $logs->count()) {
foreach ($logs as $log) {
if ($log['action_id'] == Logger::ACTION_BLOB) {
$displayLog .= $this->blobBeautifier($log['value']);
} else {
$displayLog .= $this->concatFieldsHTML($log, $amsterdamSuffix);
}
}
}
return $displayLog;
}
示例15: getModulesDirectories
/**
* Retrieve modules directories
* @return ArrayObject
*/
public function getModulesDirectories()
{
if (self::$modulesDirectories->count() == 0) {
foreach (scandir(self::$applicationDirectory) as $directory) {
if ($directory == '..' || $directory == '.') {
continue;
}
if (is_dir(self::$applicationDirectory . DIRECTORY_SEPARATOR . $directory)) {
self::$modulesDirectories->append(realpath(self::$applicationDirectory . DIRECTORY_SEPARATOR . $directory));
}
}
}
return self::$modulesDirectories;
}