| Conditions | 5 | 
| Paths | 16 | 
| Total Lines | 22 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 15 | 
| CRAP Score | 5 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 12 | 5 | public static function createFromArray(array $data)  | 
            |
| 13 |     { | 
            ||
| 14 | 5 |         if (array_key_exists('data', $data)) { | 
            |
| 15 | 4 | $data = $data['data'];  | 
            |
| 16 | }  | 
            ||
| 17 | |||
| 18 | 5 | $item = new self();  | 
            |
| 19 | 5 | $item->itemNo = $data['item_no'] ?? null;  | 
            |
| 20 | 5 | $item->title = $data['title'] ?? null;  | 
            |
| 21 | 5 | $item->description = $data['description'] ?? null;  | 
            |
| 22 | 5 | $item->price = $data['price'] ?? null;  | 
            |
| 23 | 5 | $item->vat = $data['vat'] ?? null;  | 
            |
| 24 | 5 | $item->unit = $data['unit'] ?? null;  | 
            |
| 25 | 5 | $item->createdAt = isset($data['created_at']) ? new \DateTime($data['created_at']) : null;  | 
            |
| 26 | 5 | $item->updatedAt = isset($data['updated_at']) ? new \DateTime($data['updated_at']) : null;  | 
            |
| 27 | |||
| 28 | 5 |         if (array_key_exists('bookkeeping', $data)) { | 
            |
| 29 | 4 | $item->bookkeeping = Bookkeeping::createFromArray($data['bookkeeping']);  | 
            |
| 30 | }  | 
            ||
| 31 | |||
| 32 | 5 | return $item;  | 
            |
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 |