@param bool $count

@return \Doctrine\DBAL\Driver\Statement
424147
private function getStatementContentAll($count = false)
    {
        $q = $this->connection->createQueryBuilder()
            ->select($count ? 'count(c.id)' : 'c.id')
            ->from('ezcontentobject', 'c')
            ->where('c.status = :status')
            ->setParameter('status', ContentInfo::STATUS_PUBLISHED, PDO::PARAM_INT);

        return $q->execute();
    }
251752
public function read($count)
    {
        if ($this->isEof()) {
            return null;
        }
        $buffer         = substr($this->buffer, $this->position, $count);
        $this->position += $count;
        return $buffer;
    }
314628
protected function getListReportRoute($count = false)
    {
        $list = $this->route->getList();
        $this->prepareListReportRoute($list);
        $allowed = $this->getAllowedFiltersReportRoute();

        $this->filterList($list, $allowed, $this->query_filter);
        $this->sortList($list, $allowed, $this->query_filter, array('pattern' => 'asc'));

        if ($count) {
            return count($list);
        }

        $this->limitList($list, $this->data_limit);
        return $list;
    }
1259966
public function statsOnly(bool $bool = true): Compare
    {
        $this->stats = $this->useOption('--numstat', $bool);
        return $this;
    }
717594
protected function getListReportShipping($count = false)
    {
        $list = $this->shipping->getList();
        $allowed = $this->getAllowedFiltersReportShipping();

        $this->filterList($list, $allowed, $this->query_filter);
        $this->sortList($list, $allowed, $this->query_filter, array('id' => 'asc'));

        if ($count) {
            return count($list);
        }

        $this->limitList($list, $this->data_limit);
        return $list;
    }
705546
public function take($count)
    {
        if ($count == 0) {
            return new Linq([]);
        }
        $innerIterator = $this->iterator;
        if (!($innerIterator instanceof \Iterator)) {
            // IteratorIterator wraps $this->iterator because it is Traversable but not an Iterator.
            // (see https://bugs.php.net/bug.php?id=52280)
            $innerIterator = new \IteratorIterator($innerIterator);
        }

        return new Linq(new \LimitIterator($innerIterator, 0, $count));
    }
10569
public function down ( $count = 0 ) {
        $this->_currentPosition = array(
                                        $this->_currentPosition[0],
                                        $this->_currentPosition[1] + $count,
                                       );
        return $this;
    }
351741
public function getConstrainedKeysByCount($count, $operator = '>=')
	{
		$associativeLocal = $this->associativeLocal;

		return $this->getConstrainedKeys(function($related) use ($count, $associativeLocal, $operator)
		{
			$related->group($associativeLocal)->having('COUNT(*)', $operator, $count);
		});
	}
777972
protected function emptyFinal($count)
    {
        $returnValue = array();

        while ($count > 0) {
            $returnValue[] = array_pop($this->final);
            $count--;
        }

        return array_reverse($returnValue);
    }
720910
final public function limit($offsetOrCount, $count = null)
    {
        $this->getQuery()->limit($offsetOrCount, $count);
        $this->pagedQuery = true;

        return $this;
    }
1023402
public function generate($count)
    {
        if (!is_int($count) || $count < 1) {
            throw new \InvalidArgumentException(sprintf('%s requires a value greater than 1.', __METHOD__));
        }

        $ownerIds = $this->getValidOwnerIds();

        for ($i = 0; $i < $count; $i++) {
            /** @var Entity\Content $entity */
            $entity = $this->repository->create([
                'datecreated'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datepublish'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datedepublish' => null,
                'status'        => 'published',
            ]);
            $ownerKey = array_rand($ownerIds, 1);
            $entity->setOwnerid($ownerIds[$ownerKey]);

            $this->fillEntity($entity);
        }
        $summary = $this->createSummary;
        $this->createSummary = null;

        return $summary;
    }
102841
public function getItems($count = null, $start = 0)
    {
        $columns = [];

        foreach ($this->columns as $key => $value) {
            $columns[] = $this->applyTableAlias($value);
        }

        $builder = $this->connection->createQueryBuilder();
        $builder
            ->select(empty($columns) ? $this->applyTableAlias('*') : $columns)
            ->from($this->tableName, $this->tableAlias)
        ;

        $builder = $this->applyConditions($builder);
        $builder = $this->applyOrdering($builder);

        if (!is_null($count)) {
            $builder
                ->setMaxResults($count)
                ->setFirstResult($start)
            ;
        }

        $this->dispatcher->dispatch('onQueryDatabase', new QueryDatabaseEvent($this->entityClass, $builder));

        try {
            $rows = $builder
                ->execute()
                ->fetchAll(\PDO::FETCH_ASSOC)
            ;
        } catch (SyntaxErrorException $e) {
            throw new InvalidOperatorException($e->getMessage(), 0, $e);
        } catch (DBALException $e) {
            throw new EntityNotFoundException();
        }

        foreach ($this->patterns as $column => $pattern) {
            $column = $this->stripTableAlias($column);
            $rows   = array_filter(
                $rows,
                function ($row) use ($column, $pattern) {
                    return preg_match("~{$pattern}~", $row[$column]);
                }
            );
        }

        if (empty($rows)) {
            return [];
        }

        if (empty($this->columns)) {
            $rows = $this->castToEntity($rows);
        }

        if (count($this->columns) == 1 && $this->columns[0] != '*') {
            $result = [];

            foreach ($rows as $match) {
                $result[] = $match[$this->columns[0]];
            }

            return $result;
        }

        return array_values($rows);
    }
816289
final public function compile($sql = '', $counting = false)
    {
        $query = '';

        if (!empty($sql)) {
            $query .= $sql; //escape, replace prefixxes and all that!
        } else {
            //select [all|distinct]
            $select = (is_numeric($this->arrayLimit)) ? 'SELECT SQL_CALC_FOUND_ROWS ' : 'SELECT';
            $query .= ($this->arrayDistinct) ? $select . ' DISTINCT ' : ($this->arrayAll || count($this->arraySelect) < 1) ? $select . ' ALL ' : $select . ' ';

            //Count
            //expression {, expression}
            foreach ($this->arraySelect as $key => $field) {
                $this->arraySelect[$key] = $this->identifiers($field);
            }
            $query .= implode(', ', $this->arraySelect);
        }
        //from tablename [corr_name] {, tablename [corr_name]}
        if (!empty($this->arrayFrom)) {
            $query .= "\nFROM\t";
            $tables = $this->arrayFrom;
            if (!is_array($this->arrayFrom)) {
                $tables = array($this->arrayFrom);
            }
            $query .= '(' . implode(', ', $tables) . ')';
        }

        //joins;
        if (!empty($this->arrayJoin) && !$counting) {
            $query .= "\n";
            $query .= implode("\n", $this->arrayJoin);
        }
        //[where search_condition]
        //@TODO whereIn, Like, whereNotIn etc...

        if (!empty($this->arrayWhere)) {
            $query .= "\n";
            $query .= "WHERE\t";
        }

        $query .= implode("\n", $this->arrayWhere);
        // LIKE
        if (!empty($this->arrayLike)) {
            if (!empty($this->arrayWhere)) {
                $query .= "\nAND\t";
            }
            $query .= implode("\n\t", $this->arrayLike);
        }

        //[group by column {, column}]

        if (count($this->arrayGroupBy) > 0 && !$counting) {

            $query .= "\nGROUP BY\t";
            $query .= implode(', ', $this->arrayGroupBy);
        }

        //[having search_condition]
        if (!empty($this->arrayHaving)) {
            $query .= "\nHAVING\t";
            $query .= implode("\n", $this->arrayHaving);
        }

        //{union [all] Subselect}
        if (!empty($this->arrayUnion)) {
            //@TODO recompile subelects and add to unions?
        }

        //[order by result_column [asc|desc]
        if (!empty($this->arrayOrderBy)) {
            $query .= "\nORDER BY\t";
            $query .= implode(', ', $this->arrayOrderBy);

            if ($this->arrayOrder !== FALSE) {
                $query .= ($this->arrayOrder == 'desc') ? ' DESC' : ' ASC';
            }
        }

        // ----------------------------------------------------------------
        // Write the "LIMIT" portion of the query

        if (is_numeric($this->arrayLimit)) {
            $query .= "\n";
            $offset = $this->arrayOffset;
            $limit = $this->arrayLimit;

            if ($offset == 0) {
                $offset = '';
            } else {
                $offset .= ", ";
            }
            $query .= "LIMIT\t" . $offset . $limit;
        }
        $this->resetSelect();

        return $query;
    }
225329
private function getStatementSubtree($locationId, $count = false)
    {
        /**
         * @var \eZ\Publish\SPI\Persistence\Content\Location\Handler
         */
        $locationHandler = $this->getContainer()->get('ezpublish.spi.persistence.location_handler');
        $location = $locationHandler->load($locationId);
        $q = $this->connection->createQueryBuilder()
            ->select($count ? 'count(DISTINCT c.id)' : 'DISTINCT c.id')
            ->from('ezcontentobject', 'c')
            ->innerJoin('c', 'ezcontentobject_tree', 't', 't.contentobject_id = c.id')
            ->where('c.status = :status')
            ->andWhere('t.path_string LIKE :path')
            ->setParameter('status', ContentInfo::STATUS_PUBLISHED, PDO::PARAM_INT)
            ->setParameter('path', $location->pathString . '%', PDO::PARAM_STR);

        return $q->execute();
    }
164548
public function setOuterFilterColumnsCount($count)
	{
		if (!in_array($count, [1, 2, 3, 4, 6, 12], true)) {
			throw new \InvalidArgumentException(
				"Columns count must be one of following values: 1, 2, 3, 4, 6, 12. Value {$count} given."
			);
		}

		$this->outer_filter_columns_count = (int) $count;

		return $this;
	}
654918
public function has($relation, $operator = '>=', $count = 1)
    {
        $this->hasRelations[$relation] = [$operator, $count];

        return $this;
    }
798225
public function incrementAndInvoice($count = 1)
    {
        $this->incrementQuantity($count);

        $this->user->invoice(['subscription' => $this->stripe_id]);

        return $this;
    }