count all products for current category and sub categories

@param bool|string $contentVisibility: true (default) to count only visible products, false to count only hidden
products, or * to count all products.
@return int
193454
public function countAllContents($contentVisibility = true)
    {
        $children = FolderQuery::findAllChild($this->getId());
        array_push($children, $this);


        $query = ContentQuery::create()->filterByFolder(new ObjectCollection($children), Criteria::IN);

        if ($contentVisibility !== '*') {
            $query->filterByVisible($contentVisibility);
        }

        return $query->count();
    }
614605
public function count()
    {
        if ($this->count == null) {
            $this->count = $this->itemProvider->count($this->method, $this->criterias());
        }

        return $this->count;
    }
481214
public function count($mode = COUNT_NORMAL)
    {
        if($mode == COUNT_RECURSIVE)
        {
            $count = 0;
            $data  = $this->__options;
            foreach ($data as $key => $value)
            {
                if(is_array($value) || $value instanceof KObjectConfig)
                {
                    if ($value instanceof KObjectConfigInterface) {
                        $count += $value->count($mode);
                    } else {
                        $count += count($value);
                    }
                }
            }
        }
        else $count = count($this->__options);

        return $count;
    }
78994
public function countTotal($menuItemId = null)
    {
        $qb = $this->getQueryBuilder()
            ->select('COUNT(m)');

        if (!is_null($menuItemId)) {
            $qb->where('m.parentMenuItem = :menuItem_id')
                ->setParameter('menuItem_id', $menuItemId);
        }

        return $qb->getQuery()->getSingleScalarResult();
    }
1315656
public function count(): int
    {
        $amount = 0;
        // iterate with $key so the key consumer from peek() can have a look
        foreach ($this->elements as $key => $element) {
            $amount++;
        }

        return $amount;
    }
294248
public function count($filters)
    {
        $where = $this->getQueryFilter($filters);
        $query = $this->getEntityManager()->createQuery('SELECT COUNT(m) FROM FulgurioLightCMSBundle:Media m' . $where);
        if (!empty($filters))
        {
            foreach ($filters as $filterKey => $filterValue)
            {
                $query->setParameter($filterKey, $filterValue);
            }
        }
        return $query->getSingleScalarResult();
    }
36879
public function countMedias(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collMediasPartial && !$this->isNew();
        if (null === $this->collMedias || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collMedias) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getMedias());
            }

            $query = ChildMediaQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterBySource($this)
                ->count($con);
        }

        return count($this->collMedias);
    }
1327953
public function countRecords($contentTypeName = null, DataDimensions $dataDimensions = null)
    {
        if ($contentTypeName == null)
        {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        if ($dataDimensions == null)
        {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->hasContentType($contentTypeName))
        {

            $info = $this->getRepositoryInfo($dataDimensions);

            return $info['content'][$contentTypeName]['count'];
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);

    }
680641
protected function getVisibleItems()
    {
        if (count($this->data) <= $this->visibleCount) {
            return $this->data;
        }
        $visible = [];
        $iterator = (new ArrayObject($this->data))->getIterator();
        while (count($visible) < $this->visibleCount && $iterator->valid()) {
            $visible[] = $iterator->current();
            $iterator->next();
        }

        return $visible;
    }
200036
function hasObjectAttributeContent( $contentObjectAttribute )
    {
        $groups = $contentObjectAttribute->content();
        $grouplist = $groups->attribute( 'optiongroup_list' );
        return count( $grouplist ) > 0;
    }
1020980
public function countIssuesBySeverity(string $severity): int
    {
        $count = 0;
        foreach ($this->files as $file) {
            $count += count($file->getIssuesBySeverity($severity));
        }
        return $count;
    }
1188994
public function countUngenerated()
    {
        $query = $this->createQuery();
        $query->matching($query->logicalAnd($query->equals('resource', null), $query->equals('staticResource', null)));
        return $query->count();
    }
1342362
protected function getProductCountAttribute()
    {
        $iProductCount = $this->getAttribute('product_count');
        if ($iProductCount !== null) {
            return $iProductCount;
        }

        //Get product count from cache
        $arCacheTag = [static::class];
        $sCacheKey = 'product_count_'.$this->id;

        $iProductCount = CCache::get($arCacheTag, $sCacheKey);
        if ($iProductCount !== null) {
            return $iProductCount;
        }

        //Calculate product count from child categories
        $iProductCount = 0;
        $obChildCategoryCollect = $this->children;
        if ($obChildCategoryCollect->isNotEmpty()) {
            /** @var CategoryItem $obChildCategoryItem */
            foreach ($obChildCategoryCollect as $obChildCategoryItem) {
                if ($obChildCategoryItem->isEmpty()) {
                    continue;
                }

                $iProductCount += $obChildCategoryItem->product_count;
            }
        }

        $iProductCount += ProductCollection::make()->active()->category($this->id)->count();

        CCache::forever($arCacheTag, $sCacheKey, $iProductCount);
        $this->setAttribute('product_count', $iProductCount);

        return $iProductCount;
    }
396143
public function getReviewAndRatingItemsCount()
    {
        $user = $this->getUser();
        $count = 0;
        if ($user) {
            $count = $this
                ->getContainer()
                ->get(UserReviewAndRatingBridgeInterface::class)
                ->getReviewAndRatingListCount($user->getId());
        }

        return $count;
    }
61120
protected function isInvisible($contentType)
    {
        $info = $this->config->get('contenttypes/' . $contentType);
        if ($info) {
            if (array_key_exists('viewless', $info) && $info['viewless'] === true) {
                return true;
            }
            if (array_key_exists('searchable', $info) && $info['searchable'] === false) {
                return true;
            }
        }

        return false;
    }
150230
public function count($mode = COUNT_NORMAL)
    {
        if($mode == COUNT_RECURSIVE)
        {
            $count = 0;
            $data  = $this->__options;
            foreach ($data as $key => $value)
            {
                if(is_array($value) || $value instanceof ObjectConfig)
                {
                    if ($value instanceof ObjectConfigInterface) {
                        $count += $value->count($mode);
                    } else {
                        $count += count($value);
                    }
                }
            }
        }
        else $count = count($this->__options);

        return $count;
    }
1232044
public static function getWebsitesCountToDisplay()
    {
        $count = max(Config::getInstance()->General['site_selector_max_sites'],
            Config::getInstance()->General['autocomplete_min_sites']);
        return (int)$count;
    }