public function getAllPackages()
    {
        $collection = new PackageCollection();

        if ($this->started === false) {
            return $collection;
        }

        // Installed
        $installed = $this->app['extend.action']['show']->execute('installed');
        foreach ($installed as $composerPackage) {
            /** @var CompletePackageInterface $composerPackage */
            $composerPackage = $composerPackage['package'];
            $package = Package::createFromComposerPackage($composerPackage);
            $name = $package->getName();
            $extension = $this->app['extensions']->getResolved($name);

            // Handle non-Bolt packages
            if ($extension instanceof ResolvedExtension) {
                $title = $extension->getDisplayName();
                $descriptor = $extension->getDescriptor();
                $constraint = $descriptor ? $descriptor->getConstraint() : null;
                $readme = $this->linkReadMe($extension);
                $config = $this->linkConfig($extension);
                $valid = $extension->isValid();
                $enabled = $extension->isEnabled();
            } else {
                $title = $name;
                $constraint = null;
                $readme = null;
                $config = null;
                $valid = true;
                $enabled = true;
            }

            $package->setStatus('installed');
            $package->setTitle($title);
            $package->setReadmeLink($readme);
            $package->setConfigLink($config);
            $package->setRepositoryLink($composerPackage->getSourceUrl());
            $package->setConstraint($constraint);
            $package->setValid($valid);
            $package->setEnabled($enabled);

            $collection->add($package);
        }

        // Pending
        $requires = isset($this->json['require']) ? $this->json['require'] : [];
        foreach ($requires as $name => $version) {
            if ($collection->get($name)) {
                continue;
            }
            $package = new Package();
            $package->setStatus('pending');
            $package->setName($name);
            $package->setTitle($name);
            $package->setReadmeLink(null);
            $package->setConfigLink(null);
            $package->setVersion($version);
            $package->setType('unknown');
            $package->setDescription(Trans::__('general.phrase.not-installed-yet'));

            $collection->add($package);
        }

        return $collection;
    }
public function getAllPackages()
    {
        $collection = new PackageCollection();

        if ($this->started === false) {
            return $collection;
        }

        // Installed
        $installed = $this->app['extend.action']['show']->execute('installed');
        foreach ($installed as $composerPackage) {
            /** @var CompletePackageInterface $composerPackage */
            $composerPackage = $composerPackage['package'];
            $package = Package::createFromComposerPackage($composerPackage);
            $name = $package->getName();
            $extension = $this->app['extensions']->getResolved($name);

            // Handle non-Bolt packages
            if ($extension instanceof ResolvedExtension) {
                $title = $extension->getDisplayName();
                $descriptor = $extension->getDescriptor();
                $constraint = $descriptor ? $descriptor->getConstraint() : null;
                $readme = $this->linkReadMe($extension);
                $config = $this->linkConfig($extension);
                $valid = $extension->isValid();
                $enabled = $extension->isEnabled();
            } else {
                $title = $name;
                $constraint = null;
                $readme = null;
                $config = null;
                $valid = true;
                $enabled = true;
            }

            $package->setStatus('installed');
            $package->setTitle($title);
            $package->setReadmeLink($readme);
            $package->setConfigLink($config);
            $package->setRepositoryLink($composerPackage->getSourceUrl());
            $package->setConstraint($constraint);
            $package->setValid($valid);
            $package->setEnabled($enabled);

            $collection->add($package);
        }

        // Pending
        $requires = isset($this->json['require']) ? $this->json['require'] : [];
        foreach ($requires as $name => $version) {
            if ($collection->get($name)) {
                continue;
            }
            $package = new Package();
            $package->setStatus('pending');
            $package->setName($name);
            $package->setTitle($name);
            $package->setReadmeLink(null);
            $package->setConfigLink(null);
            $package->setVersion($version);
            $package->setType('unknown');
            $package->setDescription(Trans::__('general.phrase.not-installed-yet'));

            $collection->add($package);
        }

        return $collection;
    }
public function getAllPackages ( ) { $ collection = new PackageCollection ( ) ; if ( $ this -> started === false ) { return $ collection ; } // Installed $ installed = $ this -> app [ 'extend.action' ] [ 'show' ] -> execute ( 'installed' ) ; foreach ( $ installed as $ composerPackage ) { /** @var CompletePackageInterface $composerPackage */ $ composerPackage = $ composerPackage [ 'package' ] ; $ package = Package :: createFromComposerPackage ( $ composerPackage ) ; $ name = $ package -> getName ( ) ; $ extension = $ this -> app [ 'extensions' ] -> getResolved ( $ name ) ; // Handle non-Bolt packages if ( $ extension instanceof ResolvedExtension ) { $ title = $ extension -> getDisplayName ( ) ; $ descriptor = $ extension -> getDescriptor ( ) ; $ constraint = $ descriptor ? $ descriptor -> getConstraint ( ) : null ; $ readme = $ this -> linkReadMe ( $ extension ) ; $ config = $ this -> linkConfig ( $ extension ) ; $ valid = $ extension -> isValid ( ) ; $ enabled = $ extension -> isEnabled ( ) ; } else { $ title = $ name ; $ constraint = null ; $ readme = null ; $ config = null ; $ valid = true ; $ enabled = true ; } $ package -> setStatus ( 'installed' ) ; $ package -> setTitle ( $ title ) ; $ package -> setReadmeLink ( $ readme ) ; $ package -> setConfigLink ( $ config ) ; $ package -> setRepositoryLink ( $ composerPackage -> getSourceUrl ( ) ) ; $ package -> setConstraint ( $ constraint ) ; $ package -> setValid ( $ valid ) ; $ package -> setEnabled ( $ enabled ) ; $ collection -> add ( $ package ) ; } // Pending $ requires = isset ( $ this -> json [ 'require' ] ) ? $ this -> json [ 'require' ] : [ ] ; foreach ( $ requires as $ name => $ version ) { if ( $ collection -> get ( $ name ) ) { continue ; } $ package = new Package ( ) ; $ package -> setStatus ( 'pending' ) ; $ package -> setName ( $ name ) ; $ package -> setTitle ( $ name ) ; $ package -> setReadmeLink ( null ) ; $ package -> setConfigLink ( null ) ; $ package -> setVersion ( $ version ) ; $ package -> setType ( 'unknown' ) ; $ package -> setDescription ( Trans :: __ ( 'general.phrase.not-installed-yet' ) ) ; $ collection -> add ( $ package ) ; } return $ collection ; }
Get packages that a properly installed, pending installed and locally installed.

@return PackageCollection
Get packages that a properly installed pending installed and locally installed .