| Total Complexity | 55 |
| Total Lines | 327 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
Complex classes like Zend_Gdata_Kind_EventEntry often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Zend_Gdata_Kind_EventEntry, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 98 | class Zend_Gdata_Kind_EventEntry extends Zend_Gdata_Entry |
||
| 99 | { |
||
| 100 | protected $_who = array(); |
||
| 101 | protected $_when = array(); |
||
| 102 | protected $_where = array(); |
||
| 103 | protected $_recurrence = null; |
||
| 104 | protected $_eventStatus = null; |
||
| 105 | protected $_comments = null; |
||
| 106 | protected $_transparency = null; |
||
| 107 | protected $_visibility = null; |
||
| 108 | protected $_recurrenceException = array(); |
||
| 109 | protected $_extendedProperty = array(); |
||
| 110 | protected $_originalEvent = null; |
||
| 111 | protected $_entryLink = null; |
||
| 112 | |||
| 113 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) |
||
| 114 | { |
||
| 115 | $element = parent::getDOM($doc, $majorVersion, $minorVersion); |
||
| 116 | if ($this->_who != null) { |
||
| 117 | foreach ($this->_who as $who) { |
||
| 118 | $element->appendChild($who->getDOM($element->ownerDocument)); |
||
| 119 | } |
||
| 120 | } |
||
| 121 | if ($this->_when != null) { |
||
| 122 | foreach ($this->_when as $when) { |
||
| 123 | $element->appendChild($when->getDOM($element->ownerDocument)); |
||
| 124 | } |
||
| 125 | } |
||
| 126 | if ($this->_where != null) { |
||
| 127 | foreach ($this->_where as $where) { |
||
| 128 | $element->appendChild($where->getDOM($element->ownerDocument)); |
||
| 129 | } |
||
| 130 | } |
||
| 131 | if ($this->_recurrenceException != null) { |
||
| 132 | foreach ($this->_recurrenceException as $recurrenceException) { |
||
| 133 | $element->appendChild($recurrenceException->getDOM($element->ownerDocument)); |
||
| 134 | } |
||
| 135 | } |
||
| 136 | if ($this->_extendedProperty != null) { |
||
| 137 | foreach ($this->_extendedProperty as $extProp) { |
||
| 138 | $element->appendChild($extProp->getDOM($element->ownerDocument)); |
||
| 139 | } |
||
| 140 | } |
||
| 141 | |||
| 142 | if ($this->_recurrence != null) { |
||
| 143 | $element->appendChild($this->_recurrence->getDOM($element->ownerDocument)); |
||
| 144 | } |
||
| 145 | if ($this->_eventStatus != null) { |
||
| 146 | $element->appendChild($this->_eventStatus->getDOM($element->ownerDocument)); |
||
| 147 | } |
||
| 148 | if ($this->_comments != null) { |
||
| 149 | $element->appendChild($this->_comments->getDOM($element->ownerDocument)); |
||
| 150 | } |
||
| 151 | if ($this->_transparency != null) { |
||
| 152 | $element->appendChild($this->_transparency->getDOM($element->ownerDocument)); |
||
| 153 | } |
||
| 154 | if ($this->_visibility != null) { |
||
| 155 | $element->appendChild($this->_visibility->getDOM($element->ownerDocument)); |
||
| 156 | } |
||
| 157 | if ($this->_originalEvent != null) { |
||
| 158 | $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument)); |
||
| 159 | } |
||
| 160 | if ($this->_entryLink != null) { |
||
| 161 | $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); |
||
| 162 | } |
||
| 163 | |||
| 164 | |||
| 165 | return $element; |
||
| 166 | } |
||
| 167 | |||
| 168 | protected function takeChildFromDOM($child) |
||
| 169 | { |
||
| 170 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; |
||
| 171 | switch ($absoluteNodeName) { |
||
| 172 | case $this->lookupNamespace('gd') . ':' . 'where'; |
||
| 173 | $where = new Zend_Gdata_Extension_Where(); |
||
| 174 | $where->transferFromDOM($child); |
||
| 175 | $this->_where[] = $where; |
||
| 176 | break; |
||
| 177 | case $this->lookupNamespace('gd') . ':' . 'when'; |
||
| 178 | $when = new Zend_Gdata_Extension_When(); |
||
| 179 | $when->transferFromDOM($child); |
||
| 180 | $this->_when[] = $when; |
||
| 181 | break; |
||
| 182 | case $this->lookupNamespace('gd') . ':' . 'who'; |
||
| 183 | $who = new Zend_Gdata_Extension_Who(); |
||
| 184 | $who ->transferFromDOM($child); |
||
| 185 | $this->_who[] = $who; |
||
| 186 | break; |
||
| 187 | case $this->lookupNamespace('gd') . ':' . 'recurrence'; |
||
| 188 | $recurrence = new Zend_Gdata_Extension_Recurrence(); |
||
| 189 | $recurrence->transferFromDOM($child); |
||
| 190 | $this->_recurrence = $recurrence; |
||
| 191 | break; |
||
| 192 | case $this->lookupNamespace('gd') . ':' . 'eventStatus'; |
||
| 193 | $eventStatus = new Zend_Gdata_Extension_EventStatus(); |
||
| 194 | $eventStatus->transferFromDOM($child); |
||
| 195 | $this->_eventStatus = $eventStatus; |
||
| 196 | break; |
||
| 197 | case $this->lookupNamespace('gd') . ':' . 'comments'; |
||
| 198 | $comments = new Zend_Gdata_Extension_Comments(); |
||
| 199 | $comments->transferFromDOM($child); |
||
| 200 | $this->_comments = $comments; |
||
| 201 | break; |
||
| 202 | case $this->lookupNamespace('gd') . ':' . 'transparency'; |
||
| 203 | $transparency = new Zend_Gdata_Extension_Transparency(); |
||
| 204 | $transparency ->transferFromDOM($child); |
||
| 205 | $this->_transparency = $transparency; |
||
| 206 | break; |
||
| 207 | case $this->lookupNamespace('gd') . ':' . 'visibility'; |
||
| 208 | $visiblity = new Zend_Gdata_Extension_Visibility(); |
||
| 209 | $visiblity ->transferFromDOM($child); |
||
| 210 | $this->_visibility = $visiblity; |
||
| 211 | break; |
||
| 212 | case $this->lookupNamespace('gd') . ':' . 'recurrenceException'; |
||
| 213 | require_once 'Zend/Gdata/Extension/RecurrenceException.php'; |
||
| 214 | $recurrenceException = new Zend_Gdata_Extension_RecurrenceException(); |
||
| 215 | $recurrenceException ->transferFromDOM($child); |
||
| 216 | $this->_recurrenceException[] = $recurrenceException; |
||
| 217 | break; |
||
| 218 | case $this->lookupNamespace('gd') . ':' . 'originalEvent'; |
||
| 219 | $originalEvent = new Zend_Gdata_Extension_OriginalEvent(); |
||
| 220 | $originalEvent ->transferFromDOM($child); |
||
| 221 | $this->_originalEvent = $originalEvent; |
||
| 222 | break; |
||
| 223 | case $this->lookupNamespace('gd') . ':' . 'extendedProperty'; |
||
| 224 | $extProp = new Zend_Gdata_Extension_ExtendedProperty(); |
||
| 225 | $extProp->transferFromDOM($child); |
||
| 226 | $this->_extendedProperty[] = $extProp; |
||
| 227 | break; |
||
| 228 | case $this->lookupNamespace('gd') . ':' . 'entryLink': |
||
| 229 | $entryLink = new Zend_Gdata_Extension_EntryLink(); |
||
| 230 | $entryLink->transferFromDOM($child); |
||
| 231 | $this->_entryLink = $entryLink; |
||
| 232 | break; |
||
| 233 | |||
| 234 | default: |
||
| 235 | parent::takeChildFromDOM($child); |
||
| 236 | break; |
||
| 237 | } |
||
| 238 | } |
||
| 239 | |||
| 240 | public function getWhen() |
||
| 241 | { |
||
| 242 | return $this->_when; |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param array $value |
||
| 247 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 248 | */ |
||
| 249 | public function setWhen($value) |
||
| 250 | { |
||
| 251 | $this->_when = $value; |
||
| 252 | return $this; |
||
| 253 | } |
||
| 254 | |||
| 255 | public function getWhere() |
||
| 256 | { |
||
| 257 | return $this->_where; |
||
| 258 | } |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @param array $value |
||
| 262 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 263 | */ |
||
| 264 | public function setWhere($value) |
||
| 265 | { |
||
| 266 | $this->_where = $value; |
||
| 267 | return $this; |
||
| 268 | } |
||
| 269 | |||
| 270 | public function getWho() |
||
| 271 | { |
||
| 272 | return $this->_who; |
||
| 273 | } |
||
| 274 | |||
| 275 | /** |
||
| 276 | * @param array $value |
||
| 277 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 278 | */ |
||
| 279 | public function setWho($value) |
||
| 280 | { |
||
| 281 | $this->_who = $value; |
||
| 282 | return $this; |
||
| 283 | } |
||
| 284 | |||
| 285 | public function getRecurrence() |
||
| 286 | { |
||
| 287 | return $this->_recurrence; |
||
| 288 | } |
||
| 289 | |||
| 290 | /** |
||
| 291 | * @param array $value |
||
| 292 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 293 | */ |
||
| 294 | public function setRecurrence($value) |
||
| 295 | { |
||
| 296 | $this->_recurrence = $value; |
||
| 297 | return $this; |
||
| 298 | } |
||
| 299 | |||
| 300 | public function getEventStatus() |
||
| 301 | { |
||
| 302 | return $this->_eventStatus; |
||
| 303 | } |
||
| 304 | |||
| 305 | /** |
||
| 306 | * @param array $value |
||
| 307 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 308 | */ |
||
| 309 | public function setEventStatus($value) |
||
| 310 | { |
||
| 311 | $this->_eventStatus = $value; |
||
| 312 | return $this; |
||
| 313 | } |
||
| 314 | |||
| 315 | public function getComments() |
||
| 316 | { |
||
| 317 | return $this->_comments; |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
| 321 | * @param array $value |
||
| 322 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 323 | */ |
||
| 324 | public function setComments($value) |
||
| 325 | { |
||
| 326 | $this->_comments = $value; |
||
| 327 | return $this; |
||
| 328 | } |
||
| 329 | |||
| 330 | public function getTransparency() |
||
| 331 | { |
||
| 332 | return $this->_transparency; |
||
| 333 | } |
||
| 334 | |||
| 335 | /** |
||
| 336 | * @param Zend_Gdata_Transparency $value |
||
|
|
|||
| 337 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 338 | */ |
||
| 339 | public function setTransparency($value) |
||
| 340 | { |
||
| 341 | $this->_transparency = $value; |
||
| 342 | return $this; |
||
| 343 | } |
||
| 344 | |||
| 345 | public function getVisibility() |
||
| 346 | { |
||
| 347 | return $this->_visibility; |
||
| 348 | } |
||
| 349 | |||
| 350 | /** |
||
| 351 | * @param Zend_Gdata_Visibility $value |
||
| 352 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 353 | */ |
||
| 354 | public function setVisibility($value) |
||
| 355 | { |
||
| 356 | $this->_visibility = $value; |
||
| 357 | return $this; |
||
| 358 | } |
||
| 359 | |||
| 360 | public function getRecurrenceExcption() |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @param array $value |
||
| 367 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 368 | */ |
||
| 369 | public function setRecurrenceException($value) |
||
| 370 | { |
||
| 371 | $this->_recurrenceException = $value; |
||
| 372 | return $this; |
||
| 373 | } |
||
| 374 | |||
| 375 | public function getExtendedProperty() |
||
| 376 | { |
||
| 377 | return $this->_extendedProperty; |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * @param array $value |
||
| 382 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 383 | */ |
||
| 384 | public function setExtendedProperty($value) |
||
| 385 | { |
||
| 386 | $this->_extendedProperty = $value; |
||
| 387 | return $this; |
||
| 388 | } |
||
| 389 | |||
| 390 | public function getOriginalEvent() |
||
| 391 | { |
||
| 392 | return $this->_originalEvent; |
||
| 393 | } |
||
| 394 | |||
| 395 | /** |
||
| 396 | * @param Zend_Gdata_Extension_OriginalEvent $value |
||
| 397 | * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface |
||
| 398 | */ |
||
| 399 | public function setOriginalEvent($value) |
||
| 400 | { |
||
| 401 | $this->_originalEvent = $value; |
||
| 402 | return $this; |
||
| 403 | } |
||
| 404 | |||
| 405 | /** |
||
| 406 | * Get this entry's EntryLink element. |
||
| 407 | * |
||
| 408 | * @return Zend_Gdata_Extension_EntryLink The requested entry. |
||
| 409 | */ |
||
| 410 | public function getEntryLink() |
||
| 411 | { |
||
| 412 | return $this->_entryLink; |
||
| 413 | } |
||
| 414 | |||
| 415 | /** |
||
| 416 | * Set the child's EntryLink element. |
||
| 417 | * |
||
| 418 | * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute. |
||
| 419 | * @return Zend_Gdata_Extension_Who The element being modified. |
||
| 420 | */ |
||
| 421 | public function setEntryLink($value) |
||
| 425 | } |
||
| 426 | |||
| 427 | |||
| 428 | } |
||
| 429 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths