예제 #1
0
파일: Mime.php 프로젝트: robtuley/knotwerk
 /**
  * Encapsulate MIME type.
  *
  * @param string $ext  file extension
  */
 function __construct($ext)
 {
     $this->ext = $ext;
     $ext = strtolower((string) $ext);
     $type = array_search($ext, self::$lookup, true);
     if ($type !== false) {
         parent::__construct($type);
     } elseif (array_key_exists($ext, self::$alias)) {
         parent::__construct(self::$alias[$ext]);
     } else {
         parent::__construct(parent::BINARY);
     }
 }
예제 #2
0
파일: Mime.php 프로젝트: robtuley/knotwerk
 function testBinaryIsDefaultIfCannotMatchString()
 {
     $this->assertEquals(new T_Mime(T_Mime::BINARY), T_Mime::getByString('not_a_mime'));
 }