| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function getRepository($entityClass) |
||
| 12 | { |
||
| 13 | if (is_object($entityClass)) { |
||
| 14 | $entityClass = get_class($entityClass); |
||
| 15 | } |
||
| 16 | |||
| 17 | if (!isset($this->repositories[$entityClass])) { |
||
| 18 | throw new \Exception("no repository defined for: $entityClass"); |
||
| 19 | } |
||
| 20 | |||
| 21 | if (!is_object($this->repositories[$entityClass])) { |
||
| 22 | $this->repositories[$entityClass] = Yii::createObject($this->repositories[$entityClass]); |
||
| 23 | } |
||
| 24 | |||
| 25 | return $this->repositories[$entityClass]; |
||
| 26 | } |
||
| 27 | } |
||
| 28 |