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.

Commander::optionVersion()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
cc 3
eloc 6
c 2
b 2
f 0
nc 3
nop 0
dl 0
loc 9
rs 10
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Kernel\Cli;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Kernel\Cli\Abstracts\AbstractCommander;
19
use O2System\Kernel\Cli\Writers\Format;
20
21
/**
22
 * Class Commander
23
 *
24
 * @package O2System\Framework\Abstracts
25
 */
26
abstract class Commander extends AbstractCommander
27
{
28
    /**
29
     * Commander::$app
30
     *
31
     * Commander cli-app.
32
     *
33
     * @var App
34
     */
35
    protected $app;
36
37
    // ------------------------------------------------------------------------
38
39
    /**
40
     * Commander::setApp
41
     *
42
     * @param \O2System\Kernel\Cli\App $app
43
     */
44
    public function setApp(App $app)
45
    {
46
        $this->app = $app;
47
    }
48
49
    // ------------------------------------------------------------------------
50
51
    /**
52
     * Commander::optionVersion
53
     *
54
     * Option version method, write commander version string.
55
     *
56
     * @return void
57
     */
58
    public function optionVersion()
59
    {
60
        if (property_exists($this, 'commandVersion')) {
61
            if ( ! empty($this->commandVersion)) {
62
                // Show Name & Version Line
63
                output()->write(
0 ignored issues
show
Bug introduced by
The method write() does not exist on O2System\Kernel\Http\Output. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
                output()->/** @scrutinizer ignore-call */ write(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
64
                    (new Format())
65
                        ->setString($this->optionVersion() . ucfirst($this->commandName) . ' v' . $this->commandVersion)
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->optionVersion() targeting O2System\Kernel\Cli\Commander::optionVersion() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug introduced by
Are you sure $this->optionVersion() of type void can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

65
                        ->setString(/** @scrutinizer ignore-type */ $this->optionVersion() . ucfirst($this->commandName) . ' v' . $this->commandVersion)
Loading history...
66
                        ->setNewLinesAfter(1)
67
                );
68
            }
69
        }
70
    }
71
72
    // ------------------------------------------------------------------------
73
74
    /**
75
     * Commander::__call
76
     *
77
     * @param string  $method
78
     * @param array   $args
79
     *
80
     * @return mixed
81
     */
82
    public function __call($method, array $args = [])
83
    {
84
        if (method_exists($this, $method)) {
85
            return call_user_func_array([$this, $method], $args);
86
        }
87
    }
88
}