Loading code/NewCommand.php +11 Changes for code/NewCommand.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @var $this \Application\View\Renderer\PhpRenderer * @var $controller \Laminas\Mvc\Controller\AbstractController * @var $container \Psr\Container\ContainerInterface * @var $viewName string * @var $viewFile string */ \UnicaenCode\Util::codeGenerator()->generer('command'); No newline at end of file code/generator/command.php +46 Changes for code/generator/command.php: 46 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use UnicaenCode\Util; return [ 'title' => 'Création d\'une nouvelle commande console', 'generator' => function (array $params): array { $class = $params['class'] ?? null; $type = $params['type'] ?? Util::classType($class) ?? 'Command'; $author = $params['author'] ?? Util::getAuthor(); $template = $params['template'] ?? 'Command'; $namespace = Util::classNamespace($class); $classname = Util::classClassname($class); $filename = Util::classFilename($class); $params['namespace'] = $namespace; $params['classname'] = $classname; $params['author'] = $author; $params['template'] = $template; $params['type'] = $type; $params['filename'] = $filename; $params['commandConfig'] = true; return $params; }, 'class' => [ 'label' => 'Classe de la commande', 'value' => 'Application\Command\ExempleCommand', ], 'name' => [ 'label' => 'Nom pour l\'accès à la commande', 'value' => 'module:exemple', ], 'factory' => [ 'type' => 'checkbox', 'label' => 'Générer une factory', 'value' => true, ], 'subDir' => [ 'type' => 'checkbox', 'label' => 'La Factory sera placée dans un sous-dossier dédié', 'value' => false, ], ]; No newline at end of file code/generator/commandConfig.php +44 Changes for code/generator/commandConfig.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use UnicaenCode\Util; return [ 'title' => 'Génération de configuration de commande console', 'class' => [ 'label' => 'Classe de la console', 'value' => 'Application\Command\ExempleCommand', ], 'name' => [ 'label' => 'Nom de la commande', 'value' => 'application:exemple', ], 'factory' => [ 'label' => 'Classe de la factory correspondante', 'value' => 'Application\Service\ExempleServiceFactory', ], 'generator' => function (array $params): array { $class = $params['class'] ?? null; $template = $params['template'] ?? 'CommandConfig'; $namespace = Util::classModule($class, Util::CLASS_MODULE_NAMESPACE); $filename = Util::classModule($class, Util::CLASS_MODULE_CONFIG)['relPath'] . '/config/module.config.php'; $category = 'services'; $factoryClass = $params['factory']['class'] ?? $class; $params = [ 'factoinvo' => 'factories', 'namespace' => $namespace, 'name' => $params['name'], 'class' => Util::classTruncated($class, $namespace), 'category' => $category, 'template' => $template, 'filename' => $filename, 'factoryClass' => Util::classTruncated($factoryClass, $namespace), 'write' => false, // ne jamais écrire cette config : tout est à copier/coller ]; return $params; }, ]; No newline at end of file code/template/Command.php +35 Changes for code/template/Command.php: 35 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace <namespace>; use Symfony\Component\Console\Command\Command as SymfonyCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * Description of <classname> * * @author <author> */ class <classname> extends SymfonyCommand { protected function execute(InputInterface $input, OutputInterface $output): int { // ... put here the code to create the user // this method must return an integer number with the "exit status code" // of the command. You can also use these constants to make code more readable // return this if there was no problem running the command // (it's equivalent to returning int(0)) return SymfonyCommand::SUCCESS; // or return this if some error happened during the execution // (it's equivalent to returning int(1)) // return Command::FAILURE; // or return this to indicate incorrect command usage; e.g. invalid options // or missing arguments (it's equivalent to returning int(2)) // return Command::INVALID } } No newline at end of file code/template/CommandConfig.php +17 Changes for code/template/CommandConfig.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace <namespace>; return [ 'laminas-cli' => [ 'commands' => [ '<name>' => <class>::class, ], ], '<category>' => [ '<factoinvo>' => [ <class>::class => <factoryClass>::class, ], ], ]; No newline at end of file Loading
code/NewCommand.php +11 Changes for code/NewCommand.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @var $this \Application\View\Renderer\PhpRenderer * @var $controller \Laminas\Mvc\Controller\AbstractController * @var $container \Psr\Container\ContainerInterface * @var $viewName string * @var $viewFile string */ \UnicaenCode\Util::codeGenerator()->generer('command'); No newline at end of file
code/generator/command.php +46 Changes for code/generator/command.php: 46 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use UnicaenCode\Util; return [ 'title' => 'Création d\'une nouvelle commande console', 'generator' => function (array $params): array { $class = $params['class'] ?? null; $type = $params['type'] ?? Util::classType($class) ?? 'Command'; $author = $params['author'] ?? Util::getAuthor(); $template = $params['template'] ?? 'Command'; $namespace = Util::classNamespace($class); $classname = Util::classClassname($class); $filename = Util::classFilename($class); $params['namespace'] = $namespace; $params['classname'] = $classname; $params['author'] = $author; $params['template'] = $template; $params['type'] = $type; $params['filename'] = $filename; $params['commandConfig'] = true; return $params; }, 'class' => [ 'label' => 'Classe de la commande', 'value' => 'Application\Command\ExempleCommand', ], 'name' => [ 'label' => 'Nom pour l\'accès à la commande', 'value' => 'module:exemple', ], 'factory' => [ 'type' => 'checkbox', 'label' => 'Générer une factory', 'value' => true, ], 'subDir' => [ 'type' => 'checkbox', 'label' => 'La Factory sera placée dans un sous-dossier dédié', 'value' => false, ], ]; No newline at end of file
code/generator/commandConfig.php +44 Changes for code/generator/commandConfig.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use UnicaenCode\Util; return [ 'title' => 'Génération de configuration de commande console', 'class' => [ 'label' => 'Classe de la console', 'value' => 'Application\Command\ExempleCommand', ], 'name' => [ 'label' => 'Nom de la commande', 'value' => 'application:exemple', ], 'factory' => [ 'label' => 'Classe de la factory correspondante', 'value' => 'Application\Service\ExempleServiceFactory', ], 'generator' => function (array $params): array { $class = $params['class'] ?? null; $template = $params['template'] ?? 'CommandConfig'; $namespace = Util::classModule($class, Util::CLASS_MODULE_NAMESPACE); $filename = Util::classModule($class, Util::CLASS_MODULE_CONFIG)['relPath'] . '/config/module.config.php'; $category = 'services'; $factoryClass = $params['factory']['class'] ?? $class; $params = [ 'factoinvo' => 'factories', 'namespace' => $namespace, 'name' => $params['name'], 'class' => Util::classTruncated($class, $namespace), 'category' => $category, 'template' => $template, 'filename' => $filename, 'factoryClass' => Util::classTruncated($factoryClass, $namespace), 'write' => false, // ne jamais écrire cette config : tout est à copier/coller ]; return $params; }, ]; No newline at end of file
code/template/Command.php +35 Changes for code/template/Command.php: 35 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace <namespace>; use Symfony\Component\Console\Command\Command as SymfonyCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * Description of <classname> * * @author <author> */ class <classname> extends SymfonyCommand { protected function execute(InputInterface $input, OutputInterface $output): int { // ... put here the code to create the user // this method must return an integer number with the "exit status code" // of the command. You can also use these constants to make code more readable // return this if there was no problem running the command // (it's equivalent to returning int(0)) return SymfonyCommand::SUCCESS; // or return this if some error happened during the execution // (it's equivalent to returning int(1)) // return Command::FAILURE; // or return this to indicate incorrect command usage; e.g. invalid options // or missing arguments (it's equivalent to returning int(2)) // return Command::INVALID } } No newline at end of file
code/template/CommandConfig.php +17 Changes for code/template/CommandConfig.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace <namespace>; return [ 'laminas-cli' => [ 'commands' => [ '<name>' => <class>::class, ], ], '<category>' => [ '<factoinvo>' => [ <class>::class => <factoryClass>::class, ], ], ]; No newline at end of file