Counts module extensions.

@param array $aModuleExtensions Module extensions

@return int
196417
protected function _countExtensions($aModuleExtensions)
    {
        $iCount = 0;
        foreach ($aModuleExtensions as $mExtensions) {
            if (is_array($mExtensions)) {
                $iCount += count($mExtensions);
            } else {
                $iCount++;
            }
        }

        return $iCount;
    }
552941
public function countTotal()
    {
        $em = $this->getDoctrine()->getManager();

        $qb = $em->getRepository('AsmTranslationLoaderBundle:Translation')
            ->createQueryBuilder('tl')
            ->select('COUNT(tl)');

        return $qb->getQuery()->getSingleScalarResult();
    }
517157
public function checkDependenciesExtensions(array $module)
    {
        if (!empty($module['extensions'])) {

            $missing = array();

            foreach ($module['extensions'] as $extension) {
                if (!extension_loaded($extension)) {
                    $missing[] = $extension;
                }
            }

            if (!empty($missing)) {
                $error = $this->translation->text("Missing PHP extensions: @list", array('@list' => implode(',', $missing)));
                throw new UnexpectedValueException($error);
            }
        }

        return true;
    }
1023239
public function count()
    {
        // this catches the situation where OL returned errno 32 = no such object!
        if (!$this->_search) {
            return 0;
        }
        // ldap_count_entries is slow (see pear bug #18752) with large results,
        // so we cache the result internally.
        if ($this->_count_cache === null) {
            $this->_count_cache = @ldap_count_entries($this->_link, $this->_search);
        }

        return $this->_count_cache;
    }
639424
public function countTotalStatsVisits()
    {
        $em = $this->getEntityManager();
        $query = $em->createQuery(
            'SELECT SUM( s.visits ) FROM  EcommerceBundle:ProductStats AS s'
        );

        $total = $query->getSingleScalarResult();

        return $total;
    }
64331
public function collect($restrictToModules = array(), $mergeWithExisting = false)
    {
        $entitiesByModule = $this->getEntitiesByModule();

        // Resolve conflicts between duplicate keys across modules
        $entitiesByModule = $this->resolveDuplicateConflicts($entitiesByModule);

        // Optionally merge with existing master strings
        if ($mergeWithExisting) {
            $entitiesByModule = $this->mergeWithExisting($entitiesByModule);
        }

        // Restrict modules we update to just the specified ones (if any passed)
        if (!empty($restrictToModules)) {
            // Normalise module names
            $modules = array_filter(array_map(function ($name) {
                $module = ModuleLoader::inst()->getManifest()->getModule($name);
                return $module ? $module->getName() : null;
            }, $restrictToModules));
            // Remove modules
            foreach (array_diff(array_keys($entitiesByModule), $modules) as $module) {
                unset($entitiesByModule[$module]);
            }
        }
        return $entitiesByModule;
    }
63411
public function count($module)
    {

        if (User::hasRole('user')) {
            $this->block->pushCriteria(new \Litecms\Block\Repositories\Criteria\BlockUserCriteria());
        }

        if ($module == 'block') {
            return $this->block
                ->scopeQuery(function ($query) {
                    return $query;
                })
                ->count();
        }

        if ($module == 'category') {
            return $this->category
                ->scopeQuery(function ($query) {
                    return $query;
                })->count();
        }

        if ($module == 'public') {
            return $this->block
                ->pushCriteria(new \Litecms\Block\Repositories\Criteria\BlockPublicCriteria())
                ->scopeQuery(function ($query) {
                    return $query;
                })->count();
        }

    }
724766
public function extractModulePaths()
    {
        $aModules = $this->getModulesWithExtendedClass();
        $aModulePaths = [];

        if (is_array($aModules) && count($aModules) > 0) {
            foreach ($aModules as $aModuleClasses) {
                foreach ($aModuleClasses as $sModule) {
                    $sModuleId = substr($sModule, 0, strpos($sModule, "/"));
                    $aModulePaths[$sModuleId] = $sModuleId;
                }
            }
        }

        return $aModulePaths;
    }
1058633
protected function findEnabledModules(): array
    {
        $aModules = Components::available(false);
        $aOut     = [];

        foreach ($aModules as $oModule) {
            $aOut[] = $this->determineModuleState($oModule->slug, $oModule->path . 'migrations/');
        }

        return array_filter($aOut);
    }
516261
public function count(array $locales = null,  array $filters = null)
    {
        $builder = $this->createQueryBuilder();

        $this->addTransUnitFilters($builder, $filters);
        $this->addTranslationFilter($builder, $locales, $filters);

        $count = $builder->count()
            ->getQuery()
            ->execute();

        return $count;
    }
729215
public function getExtensions()
    {
        $rawExtensions = isset($this->_aModule['extend']) ? $this->_aModule['extend'] : [];

        return $this->getUnifiedShopClassExtensionsForBc($rawExtensions);
    }
773603
public function getModuleExtensions($sModuleId)
    {
        if (!isset($this->_aModuleExtensions)) {
            $aModuleExtension = \OxidEsales\Eshop\Core\Registry::getConfig()->getModulesWithExtendedClass();
            $oModule = $this->getModule();
            $aExtension = [];
            foreach ($aModuleExtension as $sOxClass => $aFiles) {
                foreach ($aFiles as $sFilePath) {
                    $sId = $oModule->getIdByPath($sFilePath);
                    $aExtension[$sId][$sOxClass][] = $sFilePath;
                }
            }

            $this->_aModuleExtensions = $aExtension;
        }

        return $this->_aModuleExtensions[$sModuleId] ? $this->_aModuleExtensions[$sModuleId] : [];
    }
1128926
protected function doMigration($oModule): bool
    {
        $oOutput = $this->oOutput;

        // --------------------------------------------------------------------------

        //  Map the directory and fetch only the files we need
        $sPath   = $oModule->name == 'APP' ? 'application/migrations/' : 'vendor/' . $oModule->name . '/migrations/';
        $aDirMap = $this->mapDir($sPath);

        //  Set the current version to -1 if null so migrations with a zero index are picked up
        $iCurrent = is_null($oModule->start) ? -1 : $oModule->start;

        //  Go through all the migrations, skip any which have already been executed
        foreach ($aDirMap as $aMigration) {
            if ($aMigration['index'] > $iCurrent) {
                if (!$this->executeMigration($oModule, $aMigration)) {
                    return false;
                }
            }

            //  Mark this migration as complete
            $sSql    = "UPDATE `" . NAILS_DB_PREFIX . "migration` SET `version` = " . $aMigration['index'] . " WHERE `module` = '" . $oModule->name . "'";
            $oResult = $this->oDb->query($sSql);
        }

        if (!$oResult) {

            // Error updating migration record
            $oOutput->writeln('');
            $oOutput->writeln('');
            $oOutput->writeln('<error>ERROR</error>: Failed to update migration record for <info>' . $oModule->name . '</info>.');

            return false;
        }

        return true;
    }
107662
function count()
    {
        try {
            $this->client->getProfile()->defineCommand('count', 'CountScriptCommand');
            return $this->client->count($this->_getPrefix().'*');
        } catch (\Exception $e) {
            throw new exReadError($e->getMessage(), $e->getCode(), $e);
        }
    }
349261
private function _getModuleIdsFromExtensions($aData)
    {
        $aModuleIds = [];
        $oModule = $this->getModule();
        foreach ($aData as $aModule) {
            foreach ($aModule as $sFilePath) {
                $sModuleId = $oModule->getIdByPath($sFilePath);
                $aModuleIds[] = $sModuleId;
            }
        }

        return $aModuleIds;
    }
715243
protected function validateModules(array $modules) : int
    {
        $result = 0;

        foreach ($modules as $module) {
            $this->info("Checking module $module", 2);

            $moduleResult = $this->runModuleChecks($module);

            $result += count($moduleResult['errors']);
            if (!$this->skipWarnings) {
                $this->printMessages('warn', $moduleResult['warnings']);
            }

            $this->printMessages('err', $moduleResult['errors']);
            $this->hr();
        }

        return $result;
    }
449415
private function sortExtensions()
    {
        // Ensure extensions are loaded in order
        $this->sortedExtensions = array();
        foreach ($this->extensions as $extension) {
            $this->addExtensionToSorted($extension);
        }
    }