| Conditions | 12 |
| Total Lines | 76 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 28 | public function __construct() |
||
| 29 | { |
||
| 30 | $this->exec = \function_exists('exec'); |
||
| 31 | $this->climate = new \League\CLImate\CLImate(); |
||
| 32 | if (!$this->exec) { |
||
| 33 | $this->climate->setUtil(new \League\CLImate\Util\UtilFactory(new class() extends \League\CLImate\Util\System\System { |
||
| 34 | public function width() |
||
| 35 | { |
||
| 36 | return 120; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function height() |
||
| 40 | { |
||
| 41 | return 40; |
||
| 42 | } |
||
| 43 | |||
| 44 | protected function systemHasAnsiSupport() |
||
| 45 | { |
||
| 46 | return true; |
||
| 47 | } |
||
| 48 | |||
| 49 | public function exec($command, $full = false) |
||
| 50 | { |
||
| 51 | return ''; |
||
| 52 | } |
||
| 53 | })); |
||
| 54 | } |
||
| 55 | $this->climate->clear(); |
||
| 56 | if (\function_exists('getmyuid') && getmyuid() !== fileowner(__FILE__)) { |
||
| 57 | $this->climate->to('error')->lightRed('Error: YetiForce CLI works only on the OS user who owns the CRM files'); |
||
| 58 | return; |
||
| 59 | } |
||
| 60 | if (\PHP_SAPI !== 'cli') { |
||
| 61 | $this->climate->to('error')->lightRed('Error: YetiForce CLI only works from the operating system console (CLI)'); |
||
| 62 | return; |
||
| 63 | } |
||
| 64 | $this->climate->lightGreen()->border('─', 200); |
||
| 65 | $this->climate->tab(2)->lightGreen('Y e t i F o r c e C L I'); |
||
| 66 | $this->climate->lightGreen()->border('─', 200); |
||
| 67 | $this->climate->white('Version: ' . Version::get() . ' | CRM URL: ' . \Config\Main::$site_URL); |
||
|
|
|||
| 68 | $this->climate->lightGreen()->border('─', 200); |
||
| 69 | \App\User::setCurrentUserId(\Users::getActiveAdminId()); |
||
| 70 | \App\Language::setTemporaryLanguage('en-US'); |
||
| 71 | |||
| 72 | $this->climate->arguments->add([ |
||
| 73 | 'module' => [ |
||
| 74 | 'prefix' => 'm', |
||
| 75 | 'description' => 'Module name', |
||
| 76 | ], |
||
| 77 | 'action' => [ |
||
| 78 | 'prefix' => 'a', |
||
| 79 | 'description' => 'Module action name', |
||
| 80 | ], |
||
| 81 | 'help' => [ |
||
| 82 | 'prefix' => 'h', |
||
| 83 | 'description' => 'Help', |
||
| 84 | ], |
||
| 85 | ]); |
||
| 86 | $this->climate->arguments->parse(); |
||
| 87 | if ($this->climate->arguments->defined('help')) { |
||
| 88 | $this->showHelp(); |
||
| 89 | $this->climate->usage(); |
||
| 90 | } elseif ($this->climate->arguments->defined('module') && !$this->climate->arguments->defined('action') && !empty($this->climate->arguments->get('module'))) { |
||
| 91 | $this->actionsList($this->climate->arguments->get('module')); |
||
| 92 | } elseif ($this->climate->arguments->defined('module') && $this->climate->arguments->defined('action')) { |
||
| 93 | $className = "\\App\\Cli\\{$this->climate->arguments->get('module')}"; |
||
| 94 | $instance = new $className($this); |
||
| 95 | if (!method_exists($instance, $this->climate->arguments->get('action'))) { |
||
| 96 | $this->climate->to('error')->lightRed("Error: Action '{$this->climate->arguments->get('action')}' does not exist in '{$this->climate->arguments->get('module')}'"); |
||
| 97 | return; |
||
| 98 | } |
||
| 99 | $this->climate->backgroundBlue()->out($instance->methods[$this->climate->arguments->get('action')]); |
||
| 100 | $this->climate->border('─', 200); |
||
| 101 | \call_user_func([$instance, $this->climate->arguments->get('action')]); |
||
| 102 | } else { |
||
| 103 | $this->modulesList(); |
||
| 104 | } |
||
| 222 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths