コード例 #1
0
 /**
  * Category name
  *
  * @return string
  */
 public function appCategory()
 {
     if ($this->file) {
         return $this->file->appCategory();
     } else {
         return File::get_app_category($this->getExtension());
     }
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 /**
  * @dataProvider allowedExtensions
  * @param string $extension
  */
 public function testAllFilesHaveCategory($extension)
 {
     $this->assertNotEmpty(File::get_app_category($extension), "Assert that extension {$extension} has a valid category");
 }