| Conditions | 10 |
| Paths | 24 |
| Total Lines | 44 |
| Code Lines | 21 |
| 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 |
||
| 64 | public function process(): void |
||
| 65 | { |
||
| 66 | $target = (string) $this->config->get('static.target'); |
||
| 67 | $exclude = (array) $this->config->get('static.exclude'); |
||
| 68 | |||
| 69 | // copying assets in debug mode (for source maps) |
||
| 70 | if ($this->builder->isDebug() && $this->config->isEnabled('assets.compile.sourcemap')) { |
||
| 71 | // copying content of '<theme>/assets/' dir if exists |
||
| 72 | if ($this->config->hasTheme()) { |
||
| 73 | $themes = array_reverse($this->config->getTheme()); |
||
| 74 | foreach ($themes as $theme) { |
||
| 75 | $this->copy($this->config->getThemeDirPath($theme, 'assets')); |
||
| 76 | } |
||
| 77 | } |
||
| 78 | // copying content of 'assets/' dir if exists |
||
| 79 | $this->copy($this->config->getAssetsPath()); |
||
| 80 | // cancel exclusion for static files (see below) |
||
| 81 | $exclude = []; |
||
| 82 | } |
||
| 83 | |||
| 84 | // copying content of '<theme>/static/' dir if exists |
||
| 85 | if ($this->config->hasTheme()) { |
||
| 86 | $themes = array_reverse($this->config->getTheme()); |
||
| 87 | foreach ($themes as $theme) { |
||
| 88 | $this->copy($this->config->getThemeDirPath($theme, 'static'), $target, $exclude); |
||
| 89 | } |
||
| 90 | } |
||
| 91 | |||
| 92 | // copying content of 'static/' dir if exists |
||
| 93 | $this->copy($this->config->getStaticPath(), $target, $exclude); |
||
| 94 | |||
| 95 | // copying mounts |
||
| 96 | if ($this->config->get('static.mounts')) { |
||
| 97 | foreach ((array) $this->config->get('static.mounts') as $source => $destination) { |
||
| 98 | $this->copy(Util::joinFile($this->config->getStaticPath(), (string) $source), (string) $destination); |
||
| 99 | } |
||
| 100 | } |
||
| 101 | |||
| 102 | if ($this->count === 0) { |
||
| 103 | $this->builder->getLogger()->info('Nothing to copy'); |
||
| 104 | |||
| 105 | return; |
||
| 106 | } |
||
| 107 | $this->builder->getLogger()->info('Files copied', ['progress' => [$this->count, $this->count]]); |
||
| 108 | } |
||
| 147 |