<?php namespace Negotiation; use Negotiation\Exception\InvalidMediaType; final class Accept extends BaseAccept implements AcceptHeader { private $basePart; private $subPart; public function __construct($value) { parent::__construct($value); if ($this->type === '*') { $this->type = '*/*'; } $parts = explode('/', $this->type); if (count($parts) !== 2 || !$parts[0] || !$parts[1]) { throw new InvalidMediaType(); } $this->basePart = $parts[0]; $this->subPart = $parts[1]; } /** * @return string */ public function getSubPart() { return $this->subPart; } /** * @return string */ public function getBasePart() { return $this->basePart; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Exception | Folder | 0755 |
|
|
AbstractNegotiator.php | File | 5 KB | 0644 |
|
Accept.php | File | 825 B | 0644 |
|
AcceptCharset.php | File | 104 B | 0644 |
|
AcceptEncoding.php | File | 105 B | 0644 |
|
AcceptHeader.php | File | 58 B | 0644 |
|
AcceptLanguage.php | File | 1.04 KB | 0644 |
|
AcceptMatch.php | File | 1.17 KB | 0644 |
|
BaseAccept.php | File | 2.95 KB | 0644 |
|
CharsetNegotiator.php | File | 224 B | 0644 |
|
EncodingNegotiator.php | File | 226 B | 0644 |
|
LanguageNegotiator.php | File | 1.05 KB | 0644 |
|
Match.php | File | 1.12 KB | 0644 |
|
Negotiator.php | File | 2.81 KB | 0644 |
|