| Conditions | 1 |
| Paths | 1 |
| Total Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| Metric | Value |
|---|---|
| dl | 0 |
| loc | 4 |
| rs | 10 |
| c | 0 |
| b | 0 |
| f | 0 |
| cc | 1 |
| nc | 1 |
| nop | 0 |
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
|
0 ignored issues
–
show
|
|||
| 3 | namespace JMGQ\AStar\Benchmark\Result; |
||
| 4 | |||
| 5 | class AggregatedResult |
||
|
0 ignored issues
–
show
|
|||
| 6 | { |
||
|
0 ignored issues
–
show
|
|||
| 7 | private $size; |
||
|
0 ignored issues
–
show
|
|||
| 8 | private $averageDuration; |
||
|
0 ignored issues
–
show
|
|||
| 9 | private $minimumDuration; |
||
|
0 ignored issues
–
show
|
|||
| 10 | private $maximumDuration; |
||
|
0 ignored issues
–
show
|
|||
| 11 | private $numberOfSolutions; |
||
|
0 ignored issues
–
show
|
|||
| 12 | private $numberOfTerrains; |
||
|
0 ignored issues
–
show
|
|||
| 13 | |||
| 14 | /** |
||
|
0 ignored issues
–
show
|
|||
| 15 | * @param int $size |
||
|
0 ignored issues
–
show
|
|||
| 16 | * @param int $averageDuration |
||
|
0 ignored issues
–
show
|
|||
| 17 | * @param int $minimumDuration |
||
|
0 ignored issues
–
show
|
|||
| 18 | * @param int $maximumDuration |
||
|
0 ignored issues
–
show
|
|||
| 19 | * @param int $numberOfSolutions |
||
|
0 ignored issues
–
show
|
|||
| 20 | * @param int $numberOfTerrains |
||
|
0 ignored issues
–
show
|
|||
| 21 | */ |
||
| 22 | public function __construct( |
||
|
0 ignored issues
–
show
|
|||
| 23 | $size, |
||
| 24 | $averageDuration, |
||
| 25 | $minimumDuration, |
||
| 26 | $maximumDuration, |
||
| 27 | $numberOfSolutions, |
||
| 28 | $numberOfTerrains |
||
| 29 | ) { |
||
|
0 ignored issues
–
show
|
|||
| 30 | $this->size = $this->filterNaturalNumber($size, 'size'); |
||
|
0 ignored issues
–
show
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...
|
|||
| 31 | $this->averageDuration = $this->filterNonNegativeInteger($averageDuration, 'average duration'); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 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...
|
|||
| 32 | $this->minimumDuration = $this->filterNonNegativeInteger($minimumDuration, 'minimum duration'); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 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...
|
|||
| 33 | $this->maximumDuration = $this->filterNonNegativeInteger($maximumDuration, 'maximum duration'); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 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...
|
|||
| 34 | $this->numberOfSolutions = $this->filterNonNegativeInteger($numberOfSolutions, 'number of solutions'); |
||
| 35 | $this->numberOfTerrains = $this->filterNaturalNumber($numberOfTerrains, 'number of terrains'); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 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...
|
|||
| 36 | } |
||
|
0 ignored issues
–
show
|
|||
| 37 | |||
| 38 | public function getSize() |
||
|
0 ignored issues
–
show
|
|||
| 39 | { |
||
|
0 ignored issues
–
show
|
|||
| 40 | return $this->size; |
||
| 41 | } |
||
|
0 ignored issues
–
show
|
|||
| 42 | |||
| 43 | public function getAverageDuration() |
||
|
0 ignored issues
–
show
|
|||
| 44 | { |
||
|
0 ignored issues
–
show
|
|||
| 45 | return $this->averageDuration; |
||
| 46 | } |
||
|
0 ignored issues
–
show
|
|||
| 47 | |||
| 48 | public function getMinimumDuration() |
||
|
0 ignored issues
–
show
|
|||
| 49 | { |
||
|
0 ignored issues
–
show
|
|||
| 50 | return $this->minimumDuration; |
||
| 51 | } |
||
|
0 ignored issues
–
show
|
|||
| 52 | |||
| 53 | public function getMaximumDuration() |
||
|
0 ignored issues
–
show
|
|||
| 54 | { |
||
|
0 ignored issues
–
show
|
|||
| 55 | return $this->maximumDuration; |
||
| 56 | } |
||
|
0 ignored issues
–
show
|
|||
| 57 | |||
| 58 | public function getNumberOfSolutions() |
||
|
0 ignored issues
–
show
|
|||
| 59 | { |
||
|
0 ignored issues
–
show
|
|||
| 60 | return $this->numberOfSolutions; |
||
| 61 | } |
||
|
0 ignored issues
–
show
|
|||
| 62 | |||
| 63 | public function getNumberOfTerrains() |
||
|
0 ignored issues
–
show
|
|||
| 64 | { |
||
|
0 ignored issues
–
show
|
|||
| 65 | return $this->numberOfTerrains; |
||
| 66 | } |
||
|
0 ignored issues
–
show
|
|||
| 67 | |||
| 68 | private function filterNaturalNumber($value, $parameterName) |
||
|
0 ignored issues
–
show
|
|||
| 69 | { |
||
|
0 ignored issues
–
show
|
|||
| 70 | $naturalNumber = filter_var($value, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1))); |
||
|
0 ignored issues
–
show
|
|||
| 71 | |||
| 72 | if ($naturalNumber === false) { |
||
|
0 ignored issues
–
show
|
|||
| 73 | throw new \InvalidArgumentException('Invalid ' . $parameterName . ': ' . print_r($value, true)); |
||
|
0 ignored issues
–
show
|
|||
| 74 | } |
||
| 75 | |||
| 76 | return $naturalNumber; |
||
| 77 | } |
||
|
0 ignored issues
–
show
|
|||
| 78 | |||
| 79 | private function filterNonNegativeInteger($value, $parameterName) |
||
|
0 ignored issues
–
show
|
|||
| 80 | { |
||
|
0 ignored issues
–
show
|
|||
| 81 | $nonNegativeInteger = filter_var($value, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0))); |
||
|
0 ignored issues
–
show
|
|||
| 82 | |||
| 83 | if ($nonNegativeInteger === false) { |
||
|
0 ignored issues
–
show
|
|||
| 84 | throw new \InvalidArgumentException('Invalid ' . $parameterName . ': ' . print_r($value, true)); |
||
|
0 ignored issues
–
show
|
|||
| 85 | } |
||
| 86 | |||
| 87 | return $nonNegativeInteger; |
||
| 88 | } |
||
|
0 ignored issues
–
show
|
|||
| 89 | } |
||
|
0 ignored issues
–
show
|
|||
| 90 |