| Conditions | 8 |
| Paths | 11 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 2 | Features | 1 |
| 1 | <?php |
||
| 45 | public function getOwnerPage() |
||
| 46 | { |
||
| 47 | foreach (get_declared_classes() as $class) { |
||
| 48 | if (is_subclass_of($class, 'SiteTree')) { |
||
| 49 | $object = singleton($class); |
||
| 50 | $classes = ClassInfo::subclassesFor('ElementPageExtension'); |
||
| 51 | $isElemental = false; |
||
| 52 | |||
| 53 | foreach ($classes as $extension) { |
||
| 54 | if ($object->hasExtension($extension)) { |
||
| 55 | $isElemental = true; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | if ($isElemental) { |
||
| 60 | $page = $class::get()->filter('ElementAreaID', $this->ID); |
||
| 61 | if ($page && $page->exists()) { |
||
| 62 | return $page->first(); |
||
| 63 | } |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 68 | return false; |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
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.