GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Phalcon::getBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Sid\Phalcon\Cron\Job;
4
5
use Phalcon\DiInterface;
6
use Sid\Phalcon\Cron\Exception;
7
use Sid\Phalcon\Cron\Job;
8
9
class Phalcon extends Job
10
{
11
    /**
12
     * @var array|null
13
     */
14
    protected $body;
15
16
17
18
    /**
19
     * @param array|null $body
20
     *
21
     * @throws Exception
22
     */
23
    public function __construct(string $expression, $body = null)
24
    {
25
        $di = $this->getDI();
26
27
        if (!($di instanceof DiInterface)) {
0 ignored issues
show
Bug introduced by
The class Phalcon\DiInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
28
            throw new Exception(
29
                "A dependency injection object is required to access internal services"
30
            );
31
        }
32
33
34
35
        parent::__construct($expression);
36
37
38
39
        $this->body = $body;
40
    }
41
42
43
44
    /**
45
     * @return array|null
46
     */
47
    public function getBody()
48
    {
49
        return $this->body;
50
    }
51
52
53
54
    public function runInForeground() : string
55
    {
56
        $di = $this->getDI();
57
58
        $console = $di->get("console");
59
60
61
62
        ob_start();
63
64
        $console->handle(
65
            $this->getBody()
66
        );
67
68
        $contents = ob_get_contents();
69
70
        ob_end_clean();
71
72
73
74
        return $contents;
75
    }
76
}
77