ResolvedCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the webmozart/console package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\Console\Api\Resolver;
13
14
use Webmozart\Console\Api\Args\Args;
15
use Webmozart\Console\Api\Args\RawArgs;
16
use Webmozart\Console\Api\Command\Command;
17
18
/**
19
 * A resolved command.
20
 *
21
 * @since  1.0
22
 *
23
 * @author Bernhard Schussek <[email protected]>
24
 */
25
class ResolvedCommand
26
{
27
    /**
28
     * @var Command
29
     */
30
    private $command;
31
32
    /**
33
     * @var RawArgs
34
     */
35
    private $args;
36
37
    /**
38
     * Creates a new resolved command.
39
     *
40
     * @param Command $command The command.
41
     * @param Args    $args    The console arguments.
42
     */
43 223
    public function __construct(Command $command, Args $args)
44
    {
45 223
        $this->command = $command;
46 223
        $this->args = $args;
0 ignored issues
show
Documentation Bug introduced by
It seems like $args of type object<Webmozart\Console\Api\Args\Args> is incompatible with the declared type object<Webmozart\Console\Api\Args\RawArgs> of property $args.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
47 223
    }
48
49
    /**
50
     * Returns the command.
51
     *
52
     * @return Command The command.
53
     */
54 223
    public function getCommand()
55
    {
56 223
        return $this->command;
57
    }
58
59
    /**
60
     * Returns the parsed console arguments.
61
     *
62
     * @return Args The parsed console arguments.
0 ignored issues
show
Documentation introduced by
Should the return type not be RawArgs?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
63
     */
64 42
    public function getArgs()
65
    {
66 42
        return $this->args;
67
    }
68
}
69