| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 10 |
| Ratio | 62.5 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | public function create($resource, array $constraints) |
||
| 46 | { |
||
| 47 | foreach ($constraints as $name => $value) { |
||
| 48 | View Code Duplication | if (!isset($this->resources['resources'][$resource]['constraints']['allowed'])) { |
|
|
|
|||
| 49 | throw new RuntimeException( |
||
| 50 | 'Not allowed `' . $name . '` constraint' |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | |||
| 54 | View Code Duplication | if (!in_array($name, $this->resources['resources'][$resource]['constraints']['allowed'])) { |
|
| 55 | throw new RuntimeException( |
||
| 56 | 'Not allowed `' . $name . '` constraint' |
||
| 57 | ); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 67 |
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.