MockHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 1
b 0
f 0

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
    public function append()
17
    {
18
        $this->append = true;
19
20
        return call_user_func_array(['parent', 'append'], func_get_args());
21
    }
22
23
    public function count()
24
    {
25
        if (!$this->append) {
26
            return 0;
27
        }
28
29
        return parent::count();
30
    }
31
}
32