Ejemplo n.º 1
0
 /**
  * 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);
     }
 }
Ejemplo n.º 2
0
 function testBinaryIsDefaultIfCannotMatchString()
 {
     $this->assertEquals(new T_Mime(T_Mime::BINARY), T_Mime::getByString('not_a_mime'));
 }