Conditions | 9 |
Paths | 76 |
Total Lines | 26 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function AvailableWidgets() |
||
31 | { |
||
32 | $classes = ClassInfo::subclassesFor('Widget'); |
||
33 | array_shift($classes); |
||
34 | $widgets= new ArrayList(); |
||
35 | $hasSpecificallyAddedWidgets = count($this->availableWidgets) && is_array($this->availableWidgets); |
||
36 | $hasSpecificallyBlockedWidgets = count($this->blockedWidgets) && is_array($this->blockedWidgets); |
||
37 | |||
38 | foreach ($classes as $class) { |
||
39 | if ($hasSpecificallyAddedWidgets) { |
||
40 | if (!in_array($class, $this->availableWidgets)) { |
||
41 | $class = ''; |
||
42 | } |
||
43 | } |
||
44 | if ($hasSpecificallyBlockedWidgets) { |
||
45 | if (in_array($class, $this->blockedWidgets)) { |
||
46 | $class = ''; |
||
47 | } |
||
48 | } |
||
49 | if ($class) { |
||
50 | $widgets->push(singleton($class)); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | return $widgets; |
||
55 | } |
||
56 | } |
||
57 |
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.