/** * Category name * * @return string */ public function appCategory() { if ($this->file) { return $this->file->appCategory(); } else { return File::get_app_category($this->getExtension()); } }
/** * Guess file category from either a file or url * * @param string $url * @param File $file * @return string */ protected function getFileCategory($url, $file) { if ($file) { return $file->appCategory(); } if ($url) { return File::get_app_category(File::get_file_extension($url)); } return null; }
/** * @dataProvider allowedExtensions * @param string $extension */ public function testAllFilesHaveCategory($extension) { $this->assertNotEmpty(File::get_app_category($extension), "Assert that extension {$extension} has a valid category"); }