1 | <?php |
||
40 | class Http20Builder implements BuilderInterface |
||
41 | { |
||
42 | /** |
||
43 | * @var \SplPriorityQueue|HttpProtocolVisitorInterface[] |
||
44 | */ |
||
45 | private $visitors; |
||
46 | |||
47 | /** |
||
48 | * @var UriFactoryInterface |
||
49 | */ |
||
50 | private $uriFactory; |
||
51 | |||
52 | /** |
||
53 | * @var PayloadEncoderInterface |
||
54 | */ |
||
55 | private $payloadEncoder; |
||
56 | |||
57 | /** |
||
58 | * @var AuthenticatorInterface |
||
59 | */ |
||
60 | private $authenticator; |
||
61 | |||
62 | /** |
||
63 | * @var HttpSenderInterface |
||
64 | */ |
||
65 | private $httpSender; |
||
66 | |||
67 | /** |
||
68 | * @var ExceptionFactoryInterface |
||
69 | */ |
||
70 | private $exceptionFactory; |
||
71 | |||
72 | /** |
||
73 | * @var bool |
||
74 | */ |
||
75 | private $addedDefaultVisitors; |
||
76 | |||
77 | /** |
||
78 | * Constructor. |
||
79 | * |
||
80 | * @param AuthenticatorInterface $authenticator |
||
81 | */ |
||
82 | public function __construct(AuthenticatorInterface $authenticator) |
||
93 | |||
94 | /** |
||
95 | * Set authenticator |
||
96 | * |
||
97 | * @param AuthenticatorInterface $authenticator |
||
98 | * |
||
99 | * @return Http20Builder |
||
100 | */ |
||
101 | public function setAuthenticator(AuthenticatorInterface $authenticator): Http20Builder |
||
107 | |||
108 | /** |
||
109 | * Add visitor |
||
110 | * |
||
111 | * @param HttpProtocolVisitorInterface $visitor |
||
112 | * @param int $priority |
||
113 | * |
||
114 | * @return Http20Builder |
||
115 | */ |
||
116 | public function addVisitor(HttpProtocolVisitorInterface $visitor, int $priority = 0): Http20Builder |
||
122 | |||
123 | /** |
||
124 | * Add default visitors |
||
125 | * |
||
126 | * @return Http20Builder |
||
127 | * |
||
128 | * @deprecated This method is deprecated and will be a move to private scope. |
||
129 | * Please do not use this method in your code. |
||
130 | * This method will be called from the constructor of this builder. |
||
131 | */ |
||
132 | public function addDefaultVisitors(): Http20Builder |
||
148 | |||
149 | /** |
||
150 | * Set URI factory |
||
151 | * |
||
152 | * @param UriFactoryInterface $uriFactory |
||
153 | * |
||
154 | * @return Http20Builder |
||
155 | */ |
||
156 | public function setUriFactory(UriFactoryInterface $uriFactory): Http20Builder |
||
162 | |||
163 | /** |
||
164 | * Set notification encoder |
||
165 | * |
||
166 | * @param PayloadEncoderInterface $payloadEncoder |
||
167 | * |
||
168 | * @return Http20Builder |
||
169 | */ |
||
170 | public function setPayloadEncoder(PayloadEncoderInterface $payloadEncoder): Http20Builder |
||
176 | |||
177 | /** |
||
178 | * Set http sender |
||
179 | * |
||
180 | * @param HttpSenderInterface $httpSender |
||
181 | * |
||
182 | * @return Http20Builder |
||
183 | */ |
||
184 | public function setHttpSender(HttpSenderInterface $httpSender): Http20Builder |
||
190 | |||
191 | /** |
||
192 | * Set exception factory |
||
193 | * |
||
194 | * @param ExceptionFactoryInterface $exceptionFactory |
||
195 | * |
||
196 | * @return Http20Builder |
||
197 | */ |
||
198 | public function setExceptionFactory(ExceptionFactoryInterface $exceptionFactory): Http20Builder |
||
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | public function buildProtocol(): ProtocolInterface |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | public function build(): SenderInterface |
||
231 | |||
232 | /** |
||
233 | * Create chain visitor |
||
234 | * |
||
235 | * @return HttpProtocolChainVisitor |
||
236 | */ |
||
237 | private function createChainVisitor(): HttpProtocolChainVisitor |
||
249 | } |
||
250 |