Conditions | 12 |
Paths | 192 |
Total Lines | 70 |
Code Lines | 45 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 1 | Features | 1 |
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 |
||
89 | protected function execute(InputInterface $input, OutputInterface $output) |
||
90 | { |
||
91 | if (DIRECTORY_SEPARATOR === '\\' || $input->getOption('pack-logs')) { |
||
92 | Factory::getZipperClassName(); // Be sure we have a way to zip files |
||
93 | } |
||
94 | $helper = $this->getHelper('package'); |
||
95 | Util\TmpDir::set($input->getOption('tmp-dir')); |
||
96 | |||
97 | $cb = function (Interfaces\Package $package) use ($helper, $output) { |
||
98 | $helper->showInfo($output, $package); |
||
99 | }; |
||
100 | $path = rtrim($input->getArgument('path'), '/\\'); |
||
101 | |||
102 | /* Getting package unpacked first, then use the path*/ |
||
103 | $package = $this->getHelper('package')->convey($input, $output, $path); |
||
104 | |||
105 | $release = Release::factory($package->getRootDir(), $cb, $input->getOption('no-convert'), $input->getOption('binary')); |
||
106 | |||
107 | if ($input->getOption('binary')) { |
||
108 | [$optionsValue, $force_opts] = $this->buildOptions($package, $input, $output); |
||
109 | |||
110 | $build = \Pickle\Package\Command\Build::factory($package, $optionsValue); |
||
111 | |||
112 | try { |
||
113 | $build->prepare(); |
||
114 | $build->createTempDir($package->getUniqueNameForFs()); |
||
|
|||
115 | $build->configure($force_opts); |
||
116 | $build->make(); |
||
117 | $this->saveBuildLogs($input, $build); |
||
118 | } catch (Exception $e) { |
||
119 | if ($input->getOption('pack-logs')) { |
||
120 | $release->packLog($build); |
||
121 | } else { |
||
122 | $this->saveBuildLogs($input, $build); |
||
123 | } |
||
124 | |||
125 | $output->writeln('The following error(s) happened: ' . $e->getMessage()); |
||
126 | } |
||
127 | |||
128 | $args = [ |
||
129 | 'build' => $build, |
||
130 | ]; |
||
131 | |||
132 | try { |
||
133 | $release->create($args); |
||
134 | if ($input->getOption('pack-logs')) { |
||
135 | $release->packLog(); |
||
136 | } |
||
137 | } catch (Exception $e) { |
||
138 | if ($input->getOption('pack-logs')) { |
||
139 | $release->packLog(); |
||
140 | } |
||
141 | $build->cleanup(); |
||
142 | throw new Exception($e->getMessage()); |
||
143 | } |
||
144 | } else { |
||
145 | /* imply --source */ |
||
146 | try { |
||
147 | $release->create(); |
||
148 | if ($input->getOption('pack-logs')) { |
||
149 | $release->packLog(); |
||
150 | } |
||
151 | } catch (Exception $e) { |
||
152 | if ($input->getOption('pack-logs')) { |
||
153 | $release->packLog(); |
||
154 | } |
||
155 | throw new Exception($e->getMessage()); |
||
156 | } |
||
157 | } |
||
158 | return 0; |
||
159 | } |
||
163 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.