Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class ImageFile implements File |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * The file name |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | private $name; |
||
21 | |||
22 | /** |
||
23 | * The image type |
||
24 | * |
||
25 | * @var integer |
||
26 | */ |
||
27 | private $type; |
||
28 | |||
29 | |||
30 | public function __construct($filename) |
||
31 | { |
||
32 | $info = @getimagesize($filename); // @: will be escalated to exception on failure |
||
33 | |||
34 | if ($info === FALSE) { |
||
35 | throw new ImageFileException($filename); |
||
36 | } |
||
37 | $this->setName($filename); |
||
38 | $this->setType($info[2]); |
||
39 | } |
||
40 | |||
41 | |||
42 | public function getType() |
||
43 | { |
||
44 | return $this->type; |
||
45 | } |
||
46 | |||
47 | |||
48 | public function setType($type) |
||
49 | { |
||
50 | $this->type = $type; |
||
51 | } |
||
52 | |||
53 | |||
54 | public function getName() |
||
57 | } |
||
58 | |||
59 | |||
60 | public function setName($name) |
||
63 | } |
||
64 | |||
66 |