/** * Perform command. * * @param TokenizerInterface $tokenizer */ public function perform(TokenizerInterface $tokenizer) { if (empty($modules = $this->modules->findModules($tokenizer))) { $this->writeln('<fg=red>' . 'No modules were found in any project file or library. Check Tokenizer config.' . '</fg=red>'); return; } $table = $this->tableHelper(['Module:', 'Version:', 'Status:', 'Size:', 'Location:', 'Description:']); foreach ($modules as $module) { $table->addRow([$module->getName(), $this->fetchVersion($module->getName()), $module->isInstalled() ? self::INSTALLED : self::NOT_INSTALLED, StringHelper::bytes($module->getSize()), $this->files->relativePath($module->getLocation(), directory('root')), wordwrap($module->getDescription())]); } $table->render(); }
/** * Perform command. */ public function perform() { /** * We are going to manipulate with encrypter configuration. * * @var ConfigWriter $write */ $configWriter = $this->container->get(ConfigWriter::class, ['name' => 'encrypter', 'method' => ConfigWriter::MERGE_REPLACE]); $key = StringHelper::random(32); //Exporting to environment specific configuration file $configWriter->setConfig(compact('key'))->writeConfig(directory('config') . '/' . $this->core->environment()); $this->writeln("<info>Encryption key <comment>{$key}</comment> was set for environment " . "<comment>{$this->core->environment()}</comment>.</info>"); }
/** * Remove blank lines. * * @param string $source * @param Isolator $isolator * @return string */ protected function normalizeEndings($source, Isolator $isolator) { //Step #1, \n only $source = $isolator->isolatePHP(StringHelper::normalizeEndings($source)); //Step #2, chunk by lines $sourceLines = explode("\n", $source); //Step #3, no blank lines and html comments (will keep conditional commends) $sourceLines = array_filter($sourceLines, function ($line) { return trim($line); }); $source = $isolator->repairPHP(join("\n", $sourceLines)); $isolator->reset(); return $source; }