1
|
|
|
<?php namespace Neomerx\JsonApi\Http\Headers; |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2015 [email protected] (www.neomerx.com) |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
use \Neomerx\JsonApi\Contracts\Http\Headers\HeaderInterface; |
20
|
|
|
use \Neomerx\JsonApi\Contracts\Http\Headers\AcceptHeaderInterface; |
21
|
|
|
use \Neomerx\JsonApi\Contracts\Http\Headers\HeaderParametersInterface; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @package Neomerx\JsonApi |
25
|
|
|
*/ |
26
|
|
|
class HeaderParameters implements HeaderParametersInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $method; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var HeaderInterface |
35
|
|
|
*/ |
36
|
|
|
private $contentType; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var AcceptHeaderInterface |
40
|
|
|
*/ |
41
|
|
|
private $accept; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $method |
45
|
|
|
* @param AcceptHeaderInterface $accept |
46
|
|
|
* @param HeaderInterface $contentType |
47
|
|
|
*/ |
48
|
10 |
|
public function __construct($method, AcceptHeaderInterface $accept, HeaderInterface $contentType) |
49
|
|
|
{ |
50
|
10 |
|
$this->accept = $accept; |
51
|
10 |
|
$this->contentType = $contentType; |
52
|
10 |
|
$this->method = $method; |
53
|
10 |
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @inheritdoc |
57
|
|
|
*/ |
58
|
8 |
|
public function getContentTypeHeader() |
59
|
|
|
{ |
60
|
8 |
|
return $this->contentType; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @inheritdoc |
65
|
|
|
*/ |
66
|
10 |
|
public function getAcceptHeader() |
67
|
|
|
{ |
68
|
10 |
|
return $this->accept; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @inheritdoc |
73
|
|
|
*/ |
74
|
1 |
|
public function getMethod() |
75
|
|
|
{ |
76
|
1 |
|
return $this->method; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|