Countable: return count of items

@return int
@throws Exception\RuntimeException
354611
public function count()
    {
        if ($this->count === null) {
            if ($this->dataSource instanceof \Countable) {
                $this->count = $this->dataSource->count();
            } elseif (is_array($this->dataSource)) {
                $this->count = count($this->dataSource);
            } else {
                throw new Exception\RuntimeException(sprintf(
                    'DataSource with type "%s" cannot be counted',
                    gettype($this->dataSource)
                ));
            }
        }
        return $this->count;
    }
328040
public function materialCount() {
        $args = $this->getCount()->json();
        if (array_key_exists('errcode', $args)) {
            throw new Exception($args['errmsg']);
        }
        return $args;
    }
878623
public function getOleObjectsCount()
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/oleobjects';
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        return count($json->OleObjects->OleObjectList);

    }
153677
public function count(): int
    {
        $collection = $this->documentManager->getCollection($this->documentClass);

        return $collection->count($this->query);
    }
543772
public function count()
    {
        $counts = array_map(function(QueueInterface $queue) {
            return $queue->count();
        }, $this->getQueues());

        return array_sum($counts);
    }
982825
public function count(): int
    {
        $size = 0;
        if (!$store = $this->getMessagesStore()) {
            return $size;
        }
        foreach ($store as $messages) {
            $size += \count($messages);
        }
        return $size;
    }
1344066
public function count()
    {
        $count = 0;

        foreach ($this->failures as $key => $failures) {
            foreach ($failures as $ruleName => $parameters) {
                ++$count;
            }
        }

        return $count;
    }
962118
public function count()
    {
        $count = 1;
        foreach ($this->children as $child) {
            $count += count($child);
        }

        return $count;
    }
806754
public function count()
    {
        $countItems = $this->countItems() - $this->getItemOffset();
        if ($countItems >= $this->getItemCount()) {
            $countItems = $this->getItemCount();
        }
        return $countItems;
    }
156386
public function count()
    {
        return $this->list->count() +
            count($this->firstItems) +
            count($this->lastItems);
    }
284475
function count()
    {
        try {
            $count = $this->collection->count(
                [
                    'realm' => $this->getRealm(),
                ]
            );
        } catch (\Exception $e) {
            throw new exReadError($e->getMessage(), $e->getCode(), $e);
        }

        return $count;
    }
827829
public function count(): int
    {
        $this->flags['count'] = true;
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->fetchColumn();
    }
938150
public function countOnline()
    {
        $sum = 0;
        foreach ($this->map as $node_name => $set) {

            $sum += $set->count();
        }
        return $sum;
    }
650307
public function count() {

        if (!$this->criteria) {

            $stmt = $this->collection->database->connection->query('SELECT COUNT(*) AS C FROM '.$this->collection->name);

        } else {

            $sql = ['SELECT COUNT(*) AS C FROM '.$this->collection->name];

            $sql[] = 'WHERE document_criteria("'.$this->criteria.'", document)';

            if ($this->limit) {
                $sql[] = 'LIMIT '.$this->limit;
            }

            $stmt = $this->collection->database->connection->query(\implode(' ', $sql));
        }

        $res  = $stmt->fetch(\PDO::FETCH_ASSOC);

        return intval(isset($res['C']) ? $res['C']:0);
    }
1244162
public function count()
    {
        if ($this->isReference() && $this->getProject() !== null) {
            try {
                return $this->getRef($this->getProject())->count();
            } catch (Exception $e) {
                throw $e;
            }
        }

        return count($this->selectorsList);
    }
879414
public static function countAll () : int
	{
        $dbObject  	= Database::getInstance();
		$sqlQuery 	= "SELECT COUNT(*) FROM ".static::$tableName;
		$resultSet 	= $dbObject->query($sqlQuery);
		$row 		= Database::fetchAssoc($resultSet);
		return (int) array_shift($row);
	}
1374676
final public function count()
    {
        if(!isset($this->_count))
        {
            $context = $this->getContext();
            $context->count = null;

            if ($this->invokeCommand('before.count', $context) !== false)
            {
                $context->count = $this->_actionCount($context);
                $this->invokeCommand('after.count', $context);
            }

            $this->_count = KObjectConfig::unbox($context->count);
        }

        return $this->_count;
    }