Conditions | 7 |
Paths | 8 |
Total Lines | 69 |
Code Lines | 31 |
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 |
||
30 | public function updateClientConfig($clientConfig) |
||
31 | { |
||
32 | $brandColourProviders = ClassInfo::implementorsOf(BrandColourProvider::class); |
||
33 | if($brandColourProviders) { |
||
34 | foreach($brandColourProviders as $provider) { |
||
35 | $providerInstance = new $provider(); |
||
36 | $brandColours = $providerInstance->getBrandColours(); |
||
37 | if($brandColours) { |
||
38 | $clientConfig['brand_colours'] = $brandColours; |
||
39 | break; |
||
40 | } |
||
41 | } |
||
42 | } else { |
||
43 | $clientConfig['brand_colours'] = $this->owner->config()->get('brand_colours'); |
||
44 | } |
||
45 | $light = $clientConfig['brand_colours']['Light'] ?? ''; |
||
46 | $dark = $clientConfig['brand_colours']['Dark'] ?? ''; |
||
47 | $font = $clientConfig['brand_colours']['Font'] ?? ''; |
||
48 | if ($light && $dark && $font) { |
||
49 | Requirements::customCSS( |
||
50 | ' |
||
51 | #cms-menu, |
||
52 | #cms-menu *, |
||
53 | #cms-menu a:link, |
||
54 | #cms-menu a:visited, |
||
55 | #cms-menu input::placeholder, |
||
56 | #cms-menu .flexbox-area-grow |
||
57 | { |
||
58 | background-color: ' . $light . '; |
||
59 | color: ' . $font . '; |
||
60 | border-color: #fff; |
||
61 | } |
||
62 | #cms-menu .cms-menu__list > li.current.children > a, |
||
63 | #cms-menu .cms-menu__list > li.current.children > a * { |
||
64 | background-color: ' . $dark . '!important; |
||
65 | color: #fff!important; |
||
66 | } |
||
67 | #cms-menu .cms-menu__list > .current.children, |
||
68 | #cms-menu .cms-menu__list > .current.children *, |
||
69 | #cms-menu .cms-menu__list > .link.children > a, |
||
70 | #cms-menu .cms-menu__list > .link.children > a { |
||
71 | background-color: ' . $light . '!important; |
||
72 | color: ' . $font . '!important; |
||
73 | } |
||
74 | #cms-menu .cms-menu__header, |
||
75 | #cms-menu .cms-menu__header *, |
||
76 | #cms-menu .cms-menu__header .cms-sitename, |
||
77 | #cms-menu .cms-menu__header .cms-login-status, |
||
78 | #cms-menu .toolbar, |
||
79 | #cms-menu .toolbar * { |
||
80 | background-color: ' . $dark . '!important; |
||
81 | color: #fff!important; |
||
82 | } |
||
83 | |||
84 | #cms-menu li a:hover { |
||
85 | filter: brightness(110%); |
||
86 | } |
||
87 | #cms-menu li.current a { |
||
88 | filter: brightness(105%); |
||
89 | } |
||
90 | .breadcrumbs-wrapper, |
||
91 | .breadcrumbs-wrapper * |
||
92 | { |
||
93 | color: ' . $dark . '; |
||
94 | } |
||
95 | |||
96 | |||
97 | ', |
||
98 | 'LeftAndMainExtensionCMSNiceties' |
||
99 | ); |
||
103 |