1 | <?php |
||
39 | class Http20Builder implements BuilderInterface |
||
40 | { |
||
41 | /** |
||
42 | * @var \SplPriorityQueue|HttpProtocolVisitorInterface[] |
||
43 | */ |
||
44 | private $visitors; |
||
45 | |||
46 | /** |
||
47 | * @var UriFactoryInterface |
||
48 | */ |
||
49 | private $uriFactory; |
||
50 | |||
51 | /** |
||
52 | * @var PayloadEncoderInterface |
||
53 | */ |
||
54 | private $payloadEncoder; |
||
55 | |||
56 | /** |
||
57 | * @var AuthenticatorInterface |
||
58 | */ |
||
59 | private $authenticator; |
||
60 | |||
61 | /** |
||
62 | * @var HttpSenderInterface |
||
63 | */ |
||
64 | private $httpSender; |
||
65 | |||
66 | /** |
||
67 | * @var ExceptionFactoryInterface |
||
68 | */ |
||
69 | private $exceptionFactory; |
||
70 | |||
71 | /** |
||
72 | * Constructor. |
||
73 | * |
||
74 | * @param AuthenticatorInterface $authenticator |
||
75 | */ |
||
76 | public function __construct(AuthenticatorInterface $authenticator) |
||
85 | |||
86 | /** |
||
87 | * Set authenticator |
||
88 | * |
||
89 | * @param AuthenticatorInterface $authenticator |
||
90 | * |
||
91 | * @return Http20Builder |
||
92 | */ |
||
93 | public function setAuthenticator(AuthenticatorInterface $authenticator): Http20Builder |
||
99 | |||
100 | /** |
||
101 | * Add visitor |
||
102 | * |
||
103 | * @param HttpProtocolVisitorInterface $visitor |
||
104 | * @param int $priority |
||
105 | * |
||
106 | * @return Http20Builder |
||
107 | */ |
||
108 | public function addVisitor(HttpProtocolVisitorInterface $visitor, int $priority = 0): Http20Builder |
||
114 | |||
115 | /** |
||
116 | * Add default visitors |
||
117 | * |
||
118 | * @return Http20Builder |
||
119 | */ |
||
120 | public function addDefaultVisitors(): Http20Builder |
||
129 | |||
130 | /** |
||
131 | * Set URI factory |
||
132 | * |
||
133 | * @param UriFactoryInterface $uriFactory |
||
134 | * |
||
135 | * @return Http20Builder |
||
136 | */ |
||
137 | public function setUriFactory(UriFactoryInterface $uriFactory): Http20Builder |
||
143 | |||
144 | /** |
||
145 | * Set notification encoder |
||
146 | * |
||
147 | * @param PayloadEncoderInterface $payloadEncoder |
||
148 | * |
||
149 | * @return Http20Builder |
||
150 | */ |
||
151 | public function setPayloadEncoder(PayloadEncoderInterface $payloadEncoder): Http20Builder |
||
157 | |||
158 | /** |
||
159 | * Set http sender |
||
160 | * |
||
161 | * @param HttpSenderInterface $httpSender |
||
162 | * |
||
163 | * @return Http20Builder |
||
164 | */ |
||
165 | public function setHttpSender(HttpSenderInterface $httpSender): Http20Builder |
||
171 | |||
172 | /** |
||
173 | * Set exception factory |
||
174 | * |
||
175 | * @param ExceptionFactoryInterface $exceptionFactory |
||
176 | * |
||
177 | * @return Http20Builder |
||
178 | */ |
||
179 | public function setExceptionFactory(ExceptionFactoryInterface $exceptionFactory): Http20Builder |
||
185 | |||
186 | /** |
||
187 | * {@inheritdoc} |
||
188 | */ |
||
189 | public function buildProtocol(): ProtocolInterface |
||
202 | |||
203 | /** |
||
204 | * {@inheritdoc} |
||
205 | */ |
||
206 | public function build(): SenderInterface |
||
212 | |||
213 | /** |
||
214 | * Create chain visitor |
||
215 | * |
||
216 | * @return HttpProtocolChainVisitor |
||
217 | */ |
||
218 | private function createChainVisitor(): HttpProtocolChainVisitor |
||
230 | } |
||
231 |