Completed
Pull Request — master (#15)
by Pavel
05:22
created

MockHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 25
c 1
b 0
f 0
wmc 3
lcom 1
cbo 1
ccs 6
cts 7
cp 0.8571
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A append() 0 6 1
A count() 0 8 2
1
<?php
2
3
namespace ScayTrase\Api\JsonRpc\Tests;
4
5
use GuzzleHttp\Handler\MockHandler as GuzzleMockHandler;
6
7
class MockHandler extends GuzzleMockHandler
8
{
9
    private $append = false;
10
11
    /**
12
     * Prevent empty queue being countable (PHP 7.2)
13
     *
14
     * @see https://github.com/guzzle/guzzle/pull/1809
15
     */
16 5
    public function append()
17
    {
18 5
        $this->append = true;
19
20 5
        return call_user_func_array(['parent', 'append'], func_get_args());
21
    }
22
23 5
    public function count()
24
    {
25 5
        if (!$this->append) {
26
            return 0;
27
        }
28
29 5
        return parent::count();
30
    }
31
}
32