コード例 #1
0
 public function testParseInvalidType()
 {
     try {
         $this->parser->parse('t e x t/html; charset=ISO-8859-4');
     } catch (\webignition\InternetMediaType\Parser\TypeParserException $exception) {
         $this->assertEquals(1, $exception->getCode());
         return;
     }
     $this->fail('Invalid internal character exception not thrown');
 }
コード例 #2
0
 /**
  * 
  * @param string $possibleTypeSubtype
  * @return string|null
  */
 private function getTypeSubtypeFromPossibleTypeSubtype($possibleTypeSubtype)
 {
     try {
         $typeParser = new TypeParser();
         $type = $typeParser->parse($possibleTypeSubtype);
         $subtypeParser = new SubtypeParser();
         $subtype = $subtypeParser->parse($possibleTypeSubtype);
         return $type . self::TYPE_SUBTYPE_SEPARATOR . $subtype;
     } catch (\Exception $ex) {
         return null;
     }
 }