| Total Complexity | 9 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class File extends Storable |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Instância um novo arquivo |
||
| 15 | * @param string $path Caminho relativo |
||
| 16 | */ |
||
| 17 | public function __construct($path) |
||
| 18 | { |
||
| 19 | $this->setPath($path); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** @return string */ |
||
| 23 | public function getExtension() |
||
| 26 | } |
||
| 27 | |||
| 28 | /** @return string */ |
||
| 29 | public function getType() |
||
| 30 | { |
||
| 31 | return mime_content_type($this->getAbsolutePath()); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** @return int|false */ |
||
| 35 | public function getSize() |
||
| 36 | { |
||
| 37 | $size = false; |
||
| 38 | if ($this->exists()) { |
||
| 39 | $size = filesize($this->getAbsolutePath()); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $size; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** @return bool */ |
||
| 46 | public function exists() |
||
| 47 | { |
||
| 48 | return is_file($this->getAbsolutePath()); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param string $path Caminho relativo |
||
| 53 | * @throws Exception |
||
| 54 | */ |
||
| 55 | protected function setPath($path) |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Retorna o conteúdo do arquivo |
||
| 65 | * @return string|false |
||
| 66 | */ |
||
| 67 | public function getContent() |
||
| 72 |