| Conditions | 6 |
| Paths | 16 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 11 |
| Ratio | 57.89 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | public function __construct($name, array $subNodes = array(), array $attributes = array()) { |
||
| 29 | parent::__construct($attributes); |
||
| 30 | $this->name = $name; |
||
| 31 | $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array(); |
||
| 32 | $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); |
||
| 33 | |||
| 34 | View Code Duplication | if (isset(self::$specialNames[strtolower($this->name)])) { |
|
|
|
|||
| 35 | throw new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $this->name)); |
||
| 36 | } |
||
| 37 | |||
| 38 | View Code Duplication | foreach ($this->extends as $interface) { |
|
| 39 | if (isset(self::$specialNames[strtolower($interface)])) { |
||
| 40 | throw new Error( |
||
| 41 | sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), |
||
| 42 | $interface->getAttributes() |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 52 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.