Completed
Push — master ( 0501a9...9176f8 )
by Iman
13:27 queued 10:05
created

Chain   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 45
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A http() 0 7 1
A __construct() 0 3 1
A __destruct() 0 3 1
A addAssertion() 0 3 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\MakeSure;
4
5
class Chain
6
{
7
    private $phpunit;
8
9 33
    public function __construct($phpunit)
10
    {
11 33
        $this->phpunit = $phpunit;
12 33
    }
13
14
    public $http = [];
15
16
    public $assertion = [];
17
18
    public $event;
19
20
    public $exception;
21
22 33
    public function __destruct()
23
    {
24 33
        (new CheckExpectations($this, $this->phpunit))->check();
25 32
    }
26
27
    /**
28
     * @param $uri
29
     * @param array $data
30
     * @param array $headers
31
     * @param $str
32
     */
33 6
    public function http($uri, array $data, array $headers, $str)
34
    {
35 6
        $this->http = [
36 6
            'method'  => $str,
37 6
            'url'     => $uri,
38 6
            'data'    => $data,
39 6
            'headers' => $headers,
40
        ];
41 6
    }
42
43
    /**
44
     * @param $url
45
     * @param $str
46
     */
47 28
    public function addAssertion($str, $url = null)
48
    {
49 28
        $this->assertion[] = ['type' => $str, 'value' => $url];
50 28
    }
51
}
52