Exemple #1
0
 /**
  * Adds the specified library in the autoload.php.
  *
  * @param  string $library
  * @return void
  */
 protected function addLibrary($library)
 {
     $autoload = new Config('autoload', APPPATH . 'config');
     $libraries = $autoload->get('libraries', 60, 'array');
     if (!in_array($library, $libraries)) {
         array_push($libraries, $library);
         $autoload->set('libraries', 60, $libraries, 'array');
         $autoload->save();
     }
 }
Exemple #2
0
 /**
  * Executes the command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return OutputInterface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $autoload = new Config('autoload', APPPATH . 'config');
     $libraries = $autoload->get('libraries', 60, 'array');
     if (in_array($this->library, $libraries)) {
         $position = array_search($this->library, $libraries);
         unset($libraries[$position]);
         $autoload->set('libraries', 60, $libraries, 'array');
         $autoload->save();
     }
     if ($this->library == 'doctrine') {
         system('composer remove doctrine/orm');
     }
     unlink(APPPATH . 'libraries/' . ucfirst($this->library) . '.php');
     $message = ucfirst($this->library) . ' is now successfully removed!';
     return $output->writeln('<info>' . $message . '</info>');
 }