| Conditions | 6 | 
| Paths | 4 | 
| Total Lines | 21 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 15 | public function __construct($name, $title, $linkedObject, $methodOrVariable = 'getTitle') | ||
| 16 |     { | ||
| 17 | $name .= '_CMSEditLink'; | ||
| 18 |         if ($linkedObject && $linkedObject->exists() && $linkedObject->hasMethod('CMSEditLink')) { | ||
| 19 | $this->linkedObject = $linkedObject; | ||
| 20 |             if($linkedObject->hasMethod($methodOrVariable)) { | ||
| 21 | $description = $linkedObject->$methodOrVariable(); | ||
| 22 |             } elseif(isset($linkedObject->$methodOrVariable)) { | ||
| 23 | $description = $linkedObject->$methodOrVariable; | ||
| 24 |             } else { | ||
| 25 | $description = 'ERROR!'; | ||
| 26 | user_error($methodOrVariable.' does not exist on '.$linkedObject.' (as method or variable)'); | ||
| 27 | } | ||
| 28 | $content = '<p><a href="'.$linkedObject->CMSEditLink().'">'.$description.'</a></h3>'; | ||
| 29 | $this->dontEscape = true; | ||
| 30 | |||
| 31 | return parent::__construct($name, $title, $content); | ||
| 32 |         } else { | ||
| 33 | return parent::__construct($name, $title); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 38 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.