Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject::count PHP Method

count() public method

Get the number of elements inside the array.
public count ( ) : integer
return integer Number of elements inside the current array.
    public function count()
    {
        return count($this->val());
    }

Usage Example

Example #1
0
 /**
  * Adds a log record.
  *
  * @param  integer $level   The logging level
  * @param  string  $message The log message
  * @param  array   $context The log context
  *
  * @throws LoggerException
  * @return Boolean Whether the record has been processed
  */
 protected function addRecord($level, $message, array $context = array())
 {
     if ($this->handlers->count() < 1) {
         throw new LoggerException('To log a record you must add at least one HandlerAbstract object to handle the messages.');
     }
     $record = new Record();
     $record->setLoggerName($this->name);
     $record->setMessage((string) $message);
     $record->setContext($context);
     $record->setLevel($level);
     $record->setDatetime($this->datetime("now"));
     // check if any handler will handle this message
     $canHandle = false;
     foreach ($this->handlers as $handler) {
         if ($handler->canHandle($record)) {
             $canHandle = true;
             break;
         }
     }
     if (!$canHandle) {
         return false;
     }
     /* @var $handler Webiny\HandlerAbstract */
     foreach ($this->handlers as $handler) {
         if ($handler->canHandle($record)) {
             $bubble = $handler->process(clone $record);
             if (!$bubble) {
                 break;
             }
         }
     }
     return true;
 }
All Usage Examples Of Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject::count