/** * 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; }
/** * @dataProvider arraySet1 */ public function testCount($array) { $a = new ArrayObject($array); $count = $a->count(); $this->assertSame(count($array), $count); }
/** * Returns the number of routes within the current collection. * * @return int */ public function count() { return $this->routes->count(); }
/** * (PHP 5 >= 5.1.0)<br/> * Count elements of an object * @link http://php.net/manual/en/countable.count.php * @return int The custom count as an integer. * </p> * <p> * The return value is cast to an integer. */ public function count() { return $this->data->count(); }