MockHandler::append()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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