| Conditions | 13 |
| Paths | 96 |
| Total Lines | 36 |
| 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 |
||
| 70 | protected function getDefaultMetadata() |
||
| 71 | { |
||
| 72 | //merge acl |
||
| 73 | $output = []; |
||
| 74 | if (isset($this->settings['acl']) && !empty($this->settings['acl'])) { |
||
| 75 | $output['ACL'] = $this->acl[$this->settings['acl']]; |
||
| 76 | } |
||
| 77 | |||
| 78 | //merge storage |
||
| 79 | if (isset($this->settings['storage'])) { |
||
| 80 | if ('standard' === $this->settings['storage']) { |
||
| 81 | $output['storage'] = static::STORAGE_STANDARD; |
||
| 82 | } elseif ('reduced' === $this->settings['storage']) { |
||
| 83 | $output['storage'] = static::STORAGE_REDUCED; |
||
| 84 | } |
||
| 85 | } |
||
| 86 | |||
| 87 | //merge meta |
||
| 88 | if (isset($this->settings['meta']) && !empty($this->settings['meta'])) { |
||
| 89 | $output['meta'] = $this->settings['meta']; |
||
| 90 | } |
||
| 91 | |||
| 92 | //merge cache control header |
||
| 93 | if (isset($this->settings['cache_control']) && !empty($this->settings['cache_control'])) { |
||
| 94 | $output['CacheControl'] = $this->settings['cache_control']; |
||
| 95 | } |
||
| 96 | |||
| 97 | //merge encryption |
||
| 98 | if (isset($this->settings['encryption']) && !empty($this->settings['encryption'])) { |
||
| 99 | if ('aes256' === $this->settings['encryption']) { |
||
| 100 | $output['encryption'] = 'AES256'; |
||
| 101 | } |
||
| 102 | } |
||
| 103 | |||
| 104 | return $output; |
||
| 105 | } |
||
| 106 | |||
| 122 |