| Conditions | 16 |
| Paths | 8192 |
| Total Lines | 66 |
| Code Lines | 33 |
| 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 |
||
| 33 | public function get(AppConfiguration $configuration) |
||
| 34 | { |
||
| 35 | $manifest = [ ]; |
||
| 36 | |||
| 37 | if (($backgroundColor = $configuration->getBackgroundColor()) !== null) { |
||
| 38 | $manifest["background_color"] = $backgroundColor; |
||
| 39 | } |
||
| 40 | |||
| 41 | if (($description = $configuration->getDescription()) !== null) { |
||
| 42 | $manifest["description"] = $description; |
||
| 43 | } |
||
| 44 | |||
| 45 | if (($direction = $configuration->getDirection()) !== null) { |
||
| 46 | $manifest["dir"] = $direction; |
||
| 47 | } |
||
| 48 | |||
| 49 | if (($display = $configuration->getDisplay()) !== null) { |
||
| 50 | $manifest["display"] = $display; |
||
| 51 | } |
||
| 52 | |||
| 53 | if (count($icons = $configuration->getIcons()) > 0) { |
||
| 54 | $manifest["icons"] = [ ]; |
||
| 55 | |||
| 56 | foreach ($icons as $icon) { |
||
| 57 | $manifest["icons"][] = $this->getImageData($icon); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | |||
| 61 | if (($language = $configuration->getLanguage()) !== null) { |
||
| 62 | $manifest["lang"] = $language; |
||
| 63 | } |
||
| 64 | |||
| 65 | if (($name = $configuration->getName()) !== null) { |
||
| 66 | $manifest["name"] = $name; |
||
| 67 | } |
||
| 68 | |||
| 69 | if (($orientation = $configuration->getOrientation()) !== null) { |
||
| 70 | $manifest["orientation"] = $orientation; |
||
| 71 | } |
||
| 72 | |||
| 73 | if (($scope = $configuration->getScope()) !== null) { |
||
| 74 | $manifest["scope"] = $scope; |
||
| 75 | } |
||
| 76 | |||
| 77 | if (($shortName = $configuration->getShortName()) !== null) { |
||
| 78 | $manifest["short_name"] = $shortName; |
||
| 79 | } |
||
| 80 | |||
| 81 | if (($startUrl = $configuration->getStartUrl()) !== null) { |
||
| 82 | $manifest["start_url"] = $startUrl; |
||
| 83 | } |
||
| 84 | |||
| 85 | if (($themeColor = $configuration->getThemeColor()) !== null) { |
||
| 86 | $manifest["theme_color"] = $themeColor; |
||
| 87 | } |
||
| 88 | |||
| 89 | if (count($splashScreens = $configuration->getSplashScreens()) > 0) { |
||
| 90 | $manifest["splash_screens"] = [ ]; |
||
| 91 | |||
| 92 | foreach ($splashScreens as $splashScreen) { |
||
| 93 | $manifest["splash_screens"][] = $this->getImageData($splashScreen); |
||
| 94 | } |
||
| 95 | } |
||
| 96 | |||
| 97 | return $manifest; |
||
| 98 | } |
||
| 99 | |||
| 130 |