Conditions | 2 |
Paths | 2 |
Total Lines | 57 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 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 |
||
101 | protected function addCustomAssets(?IStringerEntity $entity = null) |
||
102 | { |
||
103 | parent::addCustomAssets($entity); |
||
104 | |||
105 | if (!($entity instanceof Entity)) { |
||
106 | return; |
||
107 | } |
||
108 | |||
109 | $styles = $this->getResourceName(static::RESOURCE_DEFAULT); |
||
110 | $footer = $this->getResourceName(static::RESOURCE_FOOTER); |
||
111 | |||
112 | // Feature is disabled in favor of the base64 plugin |
||
113 | //$editorFileUploadPath = Routes::getApiBasePath() . '/editor-file-upload'; |
||
114 | //$this->assetManager->addJsVar('clientId', $this->envReader->get(AdminEnv::EDITOR_CLIENT_ID)); |
||
115 | //$this->assetManager->addJsVar('editorFileUploadPath', $this->envReader->get(AdminEnv::EDITOR_CLIENT_ID)); |
||
116 | |||
117 | $editorLang = $this->session->get(Session::LANGUAGE_IDENTIFIER); |
||
118 | $this->assetManager->addJsVar($footer, 'editorLang', $editorLang); |
||
119 | |||
120 | $this->assetManager->addCss($styles, '/admin-assets/vendor/trumbowyg/ui/trumbowyg.css'); |
||
121 | $this->assetManager->addCss($styles, '/admin-assets/vendor/trumbowyg/plugins/table/ui/trumbowyg.table.css'); |
||
122 | $this->assetManager->addCss( |
||
123 | $styles, |
||
124 | '/admin-assets/vendor/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css' |
||
125 | ); |
||
126 | $this->assetManager->addCss($styles, '/admin-assets/css/trumbowyg.css'); |
||
127 | |||
128 | $this->assetManager->addJs($footer, '/admin-assets/vendor/jquery/jquery-resizable.js'); |
||
129 | $this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/trumbowyg.js'); |
||
130 | $this->assetManager->addJs($footer, "/admin-assets/vendor/trumbowyg/langs/${editorLang}.js"); |
||
131 | $this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/plugins/base64/trumbowyg.base64.js'); |
||
132 | $this->assetManager->addJs( |
||
133 | $footer, |
||
134 | '/admin-assets/vendor/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js' |
||
135 | ); |
||
136 | $this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/plugins/history/trumbowyg.history.js'); |
||
137 | $this->assetManager->addJs( |
||
138 | $footer, |
||
139 | '/admin-assets/vendor/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js' |
||
140 | ); |
||
141 | $this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js'); |
||
142 | $this->assetManager->addJs( |
||
143 | $footer, |
||
144 | '/admin-assets/vendor/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js' |
||
145 | ); |
||
146 | $this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/plugins/table/trumbowyg.table.js'); |
||
147 | // Feature is disabled in favor of the base64 plugin |
||
148 | //$this->assetManager->addJs($footer, '/admin-assets/vendor/trumbowyg/plugins/upload/trumbowyg.upload.js'); |
||
149 | $this->assetManager->addJs($footer, '/admin-assets/js/editor.js'); |
||
150 | $this->assetManager->addJs($footer, '/admin-assets/js/countable-textarea.js'); |
||
151 | $this->assetManager->addJs($footer, '/admin-assets/js/hideable-container.js'); |
||
152 | $this->assetManager->addJs($footer, '/admin-assets/js/layout-or-id.js'); |
||
153 | $this->assetManager->addJs($footer, '/admin-assets/js/identifier.js'); |
||
154 | $this->assetManager->addJs($footer, '/admin-assets/js/semi-auto.js'); |
||
155 | $this->assetManager->addJs($footer, '/admin-assets/js/required.js'); |
||
156 | $this->assetManager->addJs($footer, '/admin-assets/js/validation.js'); |
||
157 | $this->assetManager->addJs($footer, '/admin-assets/js/page.js'); |
||
158 | } |
||
160 |