protected function getInstalledPluginNamespaces()
    {
        $cache_item = $this->cache->getItem('plugins.installed');

        $project_root = ProjectX::projectRoot();
        $installed_file = "$project_root/vendor/composer/installed.json";

        if (!$cache_item->isHit()
            && file_exists($installed_file)) {
            $installed = json_decode(
                file_get_contents($installed_file),
                true
            );
            $namespaces = [];

            foreach ($installed as $info) {
                if (empty($info['autoload']) ||
                    $info['type'] !== 'project-x') {
                    continue;
                }

                if (isset($info['autoload']['psr-4'])) {
                    $namespaces[$info['name']] = key($info['autoload']['psr-4']);
                }
            }

            if (!empty($namespaces)) {
                $cache_item
                    ->set($namespaces)
                    ->expiresAfter(3600);

                $this->cache->save($cache_item);
            }
        }

        return $cache_item->get() ?: [];
    }
protected function getInstalledPluginNamespaces()
    {
        $cache_item = $this->cache->getItem('plugins.installed');

        $project_root = ProjectX::projectRoot();
        $installed_file = "$project_root/vendor/composer/installed.json";

        if (!$cache_item->isHit()
            && file_exists($installed_file)) {
            $installed = json_decode(
                file_get_contents($installed_file),
                true
            );
            $namespaces = [];

            foreach ($installed as $info) {
                if (empty($info['autoload']) ||
                    $info['type'] !== 'project-x') {
                    continue;
                }

                if (isset($info['autoload']['psr-4'])) {
                    $namespaces[$info['name']] = key($info['autoload']['psr-4']);
                }
            }

            if (!empty($namespaces)) {
                $cache_item
                    ->set($namespaces)
                    ->expiresAfter(3600);

                $this->cache->save($cache_item);
            }
        }

        return $cache_item->get() ?: [];
    }
protected function getInstalledPluginNamespaces ( ) { $ cache_item = $ this -> cache -> getItem ( 'plugins.installed' ) ; $ project_root = ProjectX :: projectRoot ( ) ; $ installed_file = "$project_root/vendor/composer/installed.json" ; if ( ! $ cache_item -> isHit ( ) && file_exists ( $ installed_file ) ) { $ installed = json_decode ( file_get_contents ( $ installed_file ) , true ) ; $ namespaces = [ ] ; foreach ( $ installed as $ info ) { if ( empty ( $ info [ 'autoload' ] ) || $ info [ 'type' ] !== 'project-x' ) { continue ; } if ( isset ( $ info [ 'autoload' ] [ 'psr-4' ] ) ) { $ namespaces [ $ info [ 'name' ] ] = key ( $ info [ 'autoload' ] [ 'psr-4' ] ) ; } } if ( ! empty ( $ namespaces ) ) { $ cache_item -> set ( $ namespaces ) -> expiresAfter ( 3600 ) ; $ this -> cache -> save ( $ cache_item ) ; } } return $ cache_item -> get ( ) ? : [ ] ; }
Get composer installed plugin namespaces.

@return array
An array of installed plugin PSR-4 classnames, keyed by the project
name.
Get composer installed plugin namespaces .