Completed
Push — dev ( 798ae0...4b619a )
by James Ekow Abaka
04:30
created

CommandFactory::__construct()   A

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 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "CommandFactory.php" doesn't match the expected filename "commandfactory.php"
Loading history...
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace yentu\factories;
4
5
6
use clearice\io\Io;
7
use yentu\Yentu;
8
9
class CommandFactory
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
10
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class CommandFactory
Loading history...
11
    private $io;
0 ignored issues
show
Coding Style introduced by
Private member variable "io" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
Coding Style introduced by
Private member variable "io" must be prefixed with an underscore
Loading history...
12
    private $yentu;
0 ignored issues
show
Coding Style introduced by
Private member variable "yentu" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
Coding Style introduced by
Private member variable "yentu" must be prefixed with an underscore
Loading history...
13
    private $manipulatorFactory;
0 ignored issues
show
Coding Style introduced by
Private member variable "manipulatorFactory" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
Coding Style introduced by
Private member variable "manipulatorFactory" must be prefixed with an underscore
Loading history...
14
15 41
    public function __construct(Io $io, DatabaseManipulatorFactory $manipulatorFactory, Yentu $yentu)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Missing function doc comment
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 101 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
16
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
17 41
        $this->io = $io;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
18 41
        $this->manipulatorFactory = $manipulatorFactory;
19 41
        $this->yentu = $yentu;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 14 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
20 41
    }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
21
22 33
    public function createCommand($command, $options = [])
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$options" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$options"; expected 0 but found 1
Loading history...
Coding Style introduced by
Short array syntax is not allowed
Loading history...
23
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
24 33
        $class = "yentu\\commands\\" . ucfirst($command);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal yentu\\commands\\ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
25 33
        return new $class($this->yentu, $this->manipulatorFactory, $this->io, $options);
26
    }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
27
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
28