| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 8 | public function get($itemcode_str) |
|
| 32 | { |
||
| 33 | // Grab Item code instance from container: |
||
| 34 | 8 | if ($this->has($itemcode_str)): |
|
| 35 | 4 | return parent::get($itemcode_str); |
|
| 36 | endif; |
||
| 37 | |||
| 38 | // So its missing in the database: |
||
| 39 | // create new Instance and push it to the container. |
||
| 40 | 4 | $itemcode = new ItemCode; |
|
| 41 | 4 | $itemcode->setCode($itemcode_str)->setName($itemcode_str); |
|
| 42 | 4 | $this->push($itemcode); |
|
| 43 | 4 | return $itemcode; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |