1: <?php
2:
3: namespace PHPixie\HTTPProcessors;
4:
5: class Builder
6: {
7: protected $http;
8: protected $parsers;
9:
10: public function __construct($http)
11: {
12: $this->http = $http;
13: }
14:
15: public function updateContextProcessor($settableConextContainer)
16: {
17: return new Processor\UpdateContext(
18: $this->http,
19: $settableConextContainer
20: );
21: }
22:
23: public function buildRequestProcessor()
24: {
25: return new Processor\BuildRequest(
26: $this->http
27: );
28: }
29:
30: public function parseBodyProcessor()
31: {
32: return new Processor\ParseBody(
33: $this->parsers()
34: );
35: }
36:
37: public function attributeRegistryDispatcher($processorRegistry, $attributeName)
38: {
39: return new Processor\Dispatcher\Registry\Attribute(
40: $processorRegistry,
41: $attributeName
42: );
43: }
44:
45: public function parsers()
46: {
47: if($this->parsers === null) {
48: $this->parsers = $this->buildParsers();
49: }
50:
51: return $this->parsers;
52: }
53:
54: protected function buildParsers()
55: {
56: return new Parsers();
57: }
58: }