Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
27 | public function __construct(array $data) |
||
28 | { |
||
29 | |||
30 | if (!isset($data['id'])) |
||
31 | throw new BadRequestHttpException('ID of file is not set.'); |
||
32 | |||
33 | if (!isset($data['alt'])) |
||
34 | throw new BadRequestHttpException('Alt of file is not set.'); |
||
35 | |||
36 | $this->alt = $data['alt']; |
||
37 | |||
38 | $this->_file = File::findOne($data['id']); |
||
39 | |||
40 | if (!$this->_file) |
||
41 | throw new NotFoundHttpException('File not found.'); |
||
42 | |||
58 | } |