| Conditions | 12 | 
| Paths | 193 | 
| Total Lines | 66 | 
| Code Lines | 44 | 
| 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  | 
            ||
| 102 | protected function execute(InputInterface $input, OutputInterface $output)  | 
            ||
| 103 |     { | 
            ||
| 104 | $this->detectMagento($output);  | 
            ||
| 105 |         if (!$this->initMagento()) { | 
            ||
| 106 | return;  | 
            ||
| 107 | }  | 
            ||
| 108 | |||
| 109 | $runOnStoreView = false;  | 
            ||
| 110 | if ($this->scope == self::SCOPE_STORE_VIEW  | 
            ||
| 111 |             || ($this->scope == self::SCOPE_STORE_VIEW_GLOBAL && !$input->getOption('global')) | 
            ||
| 112 |         ) { | 
            ||
| 113 | $runOnStoreView = true;  | 
            ||
| 114 | }  | 
            ||
| 115 | |||
| 116 |         if ($runOnStoreView) { | 
            ||
| 117 | $store = $this->initStore($input, $output);  | 
            ||
| 118 |         } else { | 
            ||
| 119 |             $storeManager = $this->getObjectManager()->get('Magento\Store\Model\StoreManagerInterface'); | 
            ||
| 120 | /* @var $storeManager \Magento\Store\Model\StoreManagerInterface */  | 
            ||
| 121 | $store = $storeManager->getStore(\Magento\Store\Model\Store::DEFAULT_STORE_ID);  | 
            ||
| 122 | }  | 
            ||
| 123 | |||
| 124 |         if ($input->getOption('on')) { | 
            ||
| 125 | $isFalse = true;  | 
            ||
| 126 |         } elseif ($input->getOption('off')) { | 
            ||
| 127 | $isFalse = false;  | 
            ||
| 128 |         } else { | 
            ||
| 129 |             $scopeConfig = $this->getObjectManager()->get('\Magento\Framework\App\Config\ScopeConfigInterface'); | 
            ||
| 130 | /* @var $scopeConfig \Magento\Framework\App\Config\ScopeConfigInterface */  | 
            ||
| 131 | $isFalse = !$scopeConfig->isSetFlag(  | 
            ||
| 132 | $this->configPath,  | 
            ||
| 133 | \Magento\Store\Model\ScopeInterface::SCOPE_STORE,  | 
            ||
| 134 | $store->getCode()  | 
            ||
| 135 | );  | 
            ||
| 136 | }  | 
            ||
| 137 | |||
| 138 | $this->beforeSave($store, $isFalse);  | 
            ||
| 139 | |||
| 140 |         if ($store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { | 
            ||
| 141 | $scope = 'default'; // @TODO Constant was removed in Magento2 ?  | 
            ||
| 142 |         } else { | 
            ||
| 143 | $scope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES;  | 
            ||
| 144 | }  | 
            ||
| 145 | |||
| 146 | $configSetCommands = [  | 
            ||
| 147 | 'command' => 'config:set',  | 
            ||
| 148 | 'path' => $this->configPath,  | 
            ||
| 149 | 'value' => $isFalse ? 1 : 0,  | 
            ||
| 150 | '--scope' => $scope,  | 
            ||
| 151 | '--scope-id' => $store->getId(),  | 
            ||
| 152 | ];  | 
            ||
| 153 | |||
| 154 | $input = new ArrayInput($configSetCommands);  | 
            ||
| 155 | $this->getApplication()->setAutoExit(false);  | 
            ||
| 156 | $this->getApplication()->run($input, new NullOutput());  | 
            ||
| 157 | |||
| 158 | $comment = '<comment>' . $this->toggleComment . '</comment> '  | 
            ||
| 159 | . '<info>' . (!$isFalse ? $this->falseName : $this->trueName) . '</info>'  | 
            ||
| 160 | . ($runOnStoreView ? ' <comment>for store</comment> <info>' . $store->getCode() . '</info>' : '');  | 
            ||
| 161 | $output->writeln($comment);  | 
            ||
| 162 | |||
| 163 | $this->afterSave($store, $isFalse);  | 
            ||
| 164 | |||
| 165 |         $input = new StringInput('cache:flush'); | 
            ||
| 166 | $this->getApplication()->run($input, new NullOutput());  | 
            ||
| 167 | }  | 
            ||
| 168 | |||
| 199 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.