| Conditions | 2 |
| Paths | 2 |
| Total Lines | 80 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 1 |
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 |
||
| 100 | private |
||
| 101 | static function getAssetsIfNotIncluded() |
||
| 102 | { |
||
| 103 | if (!self::$assetsIncluded) { |
||
| 104 | self::$assetsIncluded = true; |
||
| 105 | return '<style> |
||
| 106 | .ccEditDocumentButton{ |
||
| 107 | opacity:0; |
||
| 108 | -webkit-transition: opacity 0.5s;-moz-transition: opacity 0.5s;-ms-transition: opacity 0.5s;-o-transition: opacity 0.5s;transition: opacity 0.5s; |
||
| 109 | } |
||
| 110 | |||
| 111 | .ccEditDocumentButton.active { |
||
| 112 | display:block; |
||
| 113 | position:absolute; |
||
| 114 | line-height:50px; |
||
| 115 | width:50px; |
||
| 116 | height:50px; |
||
| 117 | background: rgb(0, 106, 193) url("data:image/svg+xml;utf8,<svg width=\'25\' height=\'25\' viewBox=\'0 0 1792 1792\' xmlns=\'http://www.w3.org/2000/svg\'><path d=\'M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z\' fill=\'#fff\'/></svg>") no-repeat center; |
||
| 118 | border-radius:50%; |
||
| 119 | color:#fff; |
||
| 120 | font-family:Arial, sans-serif; |
||
| 121 | text-align:center; |
||
| 122 | cursor:pointer; |
||
| 123 | box-shadow: 5px 5px 5px rgba(128, 128, 128, 0.5); |
||
| 124 | z-index:255; |
||
| 125 | opacity:0.7; |
||
| 126 | } |
||
| 127 | |||
| 128 | @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { |
||
| 129 | /* IE10+ CSS styles go here */ |
||
| 130 | .ccEditDocumentButton.active:before { |
||
| 131 | content:\'edit\'; |
||
| 132 | font-family:Arial, sans-serif; |
||
| 133 | font-size:12px; |
||
| 134 | line-height:50px; |
||
| 135 | } |
||
| 136 | } |
||
| 137 | |||
| 138 | .ccEditDocumentButton.active:hover { |
||
| 139 | color:rgb(0, 106, 193); |
||
| 140 | background: #fff url("data:image/svg+xml;utf8,<svg width=\'25\' height=\'25\' viewBox=\'0 0 1792 1792\' xmlns=\'http://www.w3.org/2000/svg\'><path d=\'M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z\' fill=\'#006AC1\'/></svg>") no-repeat center; |
||
| 141 | opacity:1; |
||
| 142 | } |
||
| 143 | |||
| 144 | .ccEditDocumentButton.active.ccNewDocumentButton { |
||
| 145 | background-image:none; |
||
| 146 | } |
||
| 147 | |||
| 148 | .ccEditDocumentButton.active.ccNewDocumentButton:before { |
||
| 149 | content:\'+\'; |
||
| 150 | font-family:Arial, sans-serif; |
||
| 151 | font-size:20px; |
||
| 152 | line-height:50px; |
||
| 153 | } |
||
| 154 | |||
| 155 | .ccDocumentEditorHidden { |
||
| 156 | transform: translateX(100%); |
||
| 157 | } |
||
| 158 | |||
| 159 | @keyframes slideInFromRight { |
||
| 160 | 0% { |
||
| 161 | transform: translateX(100%); |
||
| 162 | } |
||
| 163 | 100% { |
||
| 164 | transform: translateX(0); |
||
| 165 | } |
||
| 166 | } |
||
| 167 | |||
| 168 | @keyframes slideOutToRight { |
||
| 169 | 0% { |
||
| 170 | transform: translateX(0); |
||
| 171 | } |
||
| 172 | 100% { |
||
| 173 | transform: translateX(100%); |
||
| 174 | } |
||
| 175 | } |
||
| 176 | </style>' . |
||
| 177 | '<script src="' . Request::$subfolders . 'js/cms.js"></script>'; |
||
| 178 | } |
||
| 179 | return ''; |
||
| 180 | } |
||
| 183 |