예제 #1
0
 public function __construct($value)
 {
     parent::__construct($value);
     $parts = explode('/', $this->type);
     if (count($parts) !== 2 || !$parts[0] || !$parts[1]) {
         throw new InvalidMediaType();
     }
     $this->basePart = $parts[0];
     $this->subPart = $parts[1];
 }
 public function __construct($value)
 {
     parent::__construct($value);
     $parts = explode('-', $this->type);
     if (2 === count($parts)) {
         $this->basePart = $parts[0];
         $this->subPart = $parts[1];
     } elseif (1 === count($parts)) {
         $this->basePart = $parts[0];
     } else {
         // TODO: this part is never reached...
         throw new InvalidLanguage();
     }
 }