decodifica dell'estensione per risalire al titolo
| | |
| | | * Date: 08/07/2019 |
| | | */ |
| | | |
| | | class FilesFilter { |
| | | class FilesFilter |
| | | { |
| | | |
| | | private $filtro = array(); |
| | | |
| | |
| | | } |
| | | return $this; |
| | | } |
| | | |
| | | /** |
| | | * Decodifico il titolo in base all'estensione. |
| | | * Il confronto viene eseguito in lowercase |
| | | * @param string $ext |
| | | * @return string |
| | | */ |
| | | public function decodeTitolo($ext) |
| | | { |
| | | switch (strtolower($ext)) { |
| | | case 'gif': |
| | | $titolo = "Image files"; |
| | | break; |
| | | case 'doc': |
| | | case 'txt': |
| | | $titolo = "Documenti"; |
| | | break; |
| | | } |
| | | |
| | | return $titolo; |
| | | } |
| | | |
| | | } |
| | |
| | | ]; |
| | | } |
| | | |
| | | |
| | | public function testDecodeTitolo() |
| | | { |
| | | $atteso = "Documenti"; |
| | | |
| | | $this->assertEquals($atteso, $this->object->decodeTitolo('Doc')); |
| | | $this->assertEquals($atteso, $this->object->decodeTitolo('doc')); |
| | | } |
| | | |
| | | } |