Check::check()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\Check\http\GuzzleHttpService;
13
14
use JMS\Serializer\Annotation as JMS;
15
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
16
use GuzzleHttp\Message\RequestInterface as GuzzleRequestInterface;
0 ignored issues
show
Bug introduced by
The type GuzzleHttp\Message\RequestInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use InvalidArgumentException;
18
use Psr\Http\Message\RequestInterface as PsrRequestInterface;
19
use Tvi\MonitorBundle\Check\CheckAbstract;
20
21
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
22
 * @JMS\ExclusionPolicy("all")
23
 *
24
 * @author Vladimir Turnaev <[email protected]>
25
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
26
class Check extends CheckAbstract
27
{
28
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
29
     * @var GuzzleHttpService
30
     */
31
    private $checker;
0 ignored issues
show
Coding Style introduced by
Private member variable "checker" must be prefixed with an underscore
Loading history...
32
33
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
34
     * @param string|PsrRequestInterface|GuzzleRequestInterface $requestOrUrl
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
35
     *                                                                        The absolute url to check, or a
36
     *                                                                        fully-formed request instance
37
     * @param array                                             $headers      An array of headers used to create the
38
     *                                                                        request
39
     * @param array                                             $options      An array of guzzle options to use when
40
     *                                                                        sending the request
41
     * @param int                                               $statusCode   The response status code to check
42
     * @param null                                              $content      The response content to check
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $content is correct as it would always require null to be passed?
Loading history...
43
     * @param null|GuzzleClientInterface                        $guzzle       Instance of guzzle to use
44
     * @param string                                            $method       The method of the request
45
     * @param mixed                                             $body         The body of the request (used for POST,
46
     *                                                                        PUT and DELETE requests)
47
     * @param bool                                              $setData      set data to result
48
     *
49
     * @throws InvalidArgumentException
50
     */
51 2
    public function __construct(
52
        $requestOrUrl,
53
        array $headers = [],
54
        array $options = [],
55
        $statusCode = 200,
56
        $content = null,
57
        $guzzle = null,
58
        $method = 'GET',
59
        $body = null,
60
        $setData = false)
0 ignored issues
show
Coding Style introduced by
The closing parenthesis of a multi-line function declaration must be on a new line
Loading history...
61
    {
0 ignored issues
show
Coding Style introduced by
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Loading history...
62 2
        $this->checker = new GuzzleHttpService($requestOrUrl, $headers, $options, $statusCode, $content, $guzzle, $method, $body, $setData);
63 2
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
68 2
    public function check()
69
    {
70 2
        return $this->checker->check();
71
    }
72
}
73