src/Event/Listener/Package.php
protected function addPackage(ComposerPackage $package)
    {
        $plugin = $this->rep->find($package->getName());

        // create new plugin if not exists
        if (!$plugin) {
            $plugin = new Plugin();
            $plugin->setName($package->getName());
        }

        list($vendor, $package) = explode('/', $plugin->getName());

        try {
            $data = $this->client->getPlugin($vendor, $package);
            $plugin->setTitle($data['title'])->setDescription($data['description']);
            if ($data['logo']) {
                $this->downloader->entity($data['logo'], $plugin, true);
            }
        } catch (\Exception $e) {
            // is not a critical error
        }

        $this->em->persist($plugin);
        $this->em->flush();
    }
protected function addPackage(ComposerPackage $package)
    {
        $plugin = $this->rep->find($package->getName());

        // create new plugin if not exists
        if (!$plugin) {
            $plugin = new Plugin();
            $plugin->setName($package->getName());
        }

        list($vendor, $package) = explode('/', $plugin->getName());

        try {
            $data = $this->client->getPlugin($vendor, $package);
            $plugin->setTitle($data['title'])->setDescription($data['description']);
            if ($data['logo']) {
                $this->downloader->entity($data['logo'], $plugin, true);
            }
        } catch (\Exception $e) {
            // is not a critical error
        }

        $this->em->persist($plugin);
        $this->em->flush();
    }
protected function addPackage ( ComposerPackage $ package ) { $ plugin = $ this -> rep -> find ( $ package -> getName ( ) ) ; // create new plugin if not exists if ( ! $ plugin ) { $ plugin = new Plugin ( ) ; $ plugin -> setName ( $ package -> getName ( ) ) ; } list ( $ vendor , $ package ) = explode ( '/' , $ plugin -> getName ( ) ) ; try { $ data = $ this -> client -> getPlugin ( $ vendor , $ package ) ; $ plugin -> setTitle ( $ data [ 'title' ] ) -> setDescription ( $ data [ 'description' ] ) ; if ( $ data [ 'logo' ] ) { $ this -> downloader -> entity ( $ data [ 'logo' ] , $ plugin , true ) ; } } catch ( \ Exception $ e ) { // is not a critical error } $ this -> em -> persist ( $ plugin ) ; $ this -> em -> flush ( ) ; }
Add plugin from package.

@param ComposerPackage $package
Add plugin from package .