Conditions | 6 |
Paths | 8 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
42 | 3 | public function build(array $contract) |
|
43 | { |
||
44 | 3 | $this->validateContractProtocol($contract); |
|
45 | 3 | $imposter = new HttpImposter( |
|
46 | 3 | isset($contract['port']) ? $contract['port'] : null, |
|
47 | 3 | isset($contract['requests']) ? $contract['requests'] : [] |
|
48 | 3 | ); |
|
49 | |||
50 | 3 | if (isset($contract['name'])) { |
|
51 | 3 | $imposter->setName($contract['name']); |
|
52 | 3 | } |
|
53 | |||
54 | 3 | $stubs = isset($contract['stubs']) ? $contract['stubs'] : []; |
|
55 | 3 | foreach ($stubs as $stub_contract) { |
|
56 | 1 | $imposter->addStub($this->stubBuilder->build($stub_contract)); |
|
57 | 3 | } |
|
58 | |||
59 | 3 | return $imposter; |
|
60 | } |
||
61 | } |