Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
19 / 19 |
Builder | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
8 | |
100.00% |
19 / 19 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
updateContextProcessor | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
buildRequestProcessor | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
parseBodyProcessor | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
attributeRegistryDispatcher | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
parsers | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
buildParsers | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace PHPixie\HTTPProcessors; | |
class Builder | |
{ | |
protected $http; | |
protected $parsers; | |
public function __construct($http) | |
{ | |
$this->http = $http; | |
} | |
public function updateContextProcessor($settableConextContainer) | |
{ | |
return new Processor\UpdateContext( | |
$this->http, | |
$settableConextContainer | |
); | |
} | |
public function buildRequestProcessor() | |
{ | |
return new Processor\BuildRequest( | |
$this->http | |
); | |
} | |
public function parseBodyProcessor() | |
{ | |
return new Processor\ParseBody( | |
$this->parsers() | |
); | |
} | |
public function attributeRegistryDispatcher($processorRegistry, $attributeName) | |
{ | |
return new Processor\Dispatcher\Registry\Attribute( | |
$processorRegistry, | |
$attributeName | |
); | |
} | |
public function parsers() | |
{ | |
if($this->parsers === null) { | |
$this->parsers = $this->buildParsers(); | |
} | |
return $this->parsers; | |
} | |
protected function buildParsers() | |
{ | |
return new Parsers(); | |
} | |
} |