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