├── src └── Generation │ └── Commands │ ├── Resources │ ├── extModel.txt │ ├── viewCatalog.txt │ ├── 3.x.x.x │ │ ├── viewCatalog.txt │ │ ├── view.txt │ │ └── extModController.txt │ ├── model.txt │ ├── lang.txt │ ├── modControllerCatalog.txt │ ├── extModControllerCatalog.txt │ ├── view.txt │ ├── language-en.php │ ├── modController.txt │ └── extModController.txt │ ├── CommandInterface.php │ ├── language │ ├── language.php │ └── english │ │ └── language.php │ ├── ClearCache.php │ ├── WkOcSql.php │ ├── SetUpOpencart.php │ ├── dummyData.php │ └── CreateExtension.php ├── app ├── install_oc.sh └── console ├── composer.json └── README.md /src/Generation/Commands/Resources/extModel.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/viewCatalog.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/3.x.x.x/viewCatalog.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/model.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Generation/Commands/CommandInterface.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpmaster/console_demo", 3 | "description": "creating console application", 4 | "require": { 5 | "php": ">=5.3.3", 6 | "symfony/console": "3.1" 7 | }, 8 | "autoload": { 9 | "psr-0": { 10 | "": "src/" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Generation/Commands/language/language.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/modControllerCatalog.txt: -------------------------------------------------------------------------------- 1 | load->language('module/consolefilename')); 7 | 8 | if (isset($this->error['warning'])) { 9 | $data['error_warning'] = $this->error['warning']; 10 | } else { 11 | $data['error_warning'] = ''; 12 | } 13 | 14 | return $this->load->view('module/consolefilename.tpl', $data); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/extModControllerCatalog.txt: -------------------------------------------------------------------------------- 1 | load->language('extension/module/consolefilename')); 7 | 8 | if (isset($this->error['warning'])) { 9 | $data['error_warning'] = $this->error['warning']; 10 | } else { 11 | $data['error_warning'] = ''; 12 | } 13 | 14 | return $this->load->view('extension/module/consolefilename', $data); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getFileName(), 0, strrpos($reflection->getFileName(), '/')); 20 | 21 | $collection = array_filter(scandir($pathToCommandsDir), function($path) use ($pathToCommandsDir) { 22 | if (($path != '.' || $path != '..') && is_file($pathToCommandsDir . "/" . $path) && !is_dir(is_file($pathToCommandsDir . "/" . $path))) { 23 | return true; 24 | } 25 | 26 | return false; 27 | }); 28 | 29 | foreach ($collection as $className) { 30 | $classPath = $reflection->getNamespaceName() . "\\" . substr($className, 0, strpos($className, '.')); 31 | $reflectionClass = new ReflectionClass($classPath); 32 | 33 | if ($reflectionClass->isInterface() || $reflectionClass->isAbstract()) { 34 | continue; 35 | } else if ($reflectionClass->getParentClass()->getName() != Command::class || false == $reflectionClass->isInstantiable()) { 36 | continue; 37 | } 38 | 39 | $app->add($reflectionClass->newInstance()); 40 | } 41 | 42 | $app->run(); 43 | 44 | ?> -------------------------------------------------------------------------------- /src/Generation/Commands/Resources/3.x.x.x/view.txt: -------------------------------------------------------------------------------- 1 | {{ header }}{{ column_left }} 2 |