Passed
Push — master ( 89de50...6aa9d5 )
by DeGracia
46s
created

BaseOccurrence   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 26
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 13 2
A size() 0 4 1
1
<?php
2
3
namespace DeGraciaMathieu\Riddler\Occurrences;
4
5
abstract class BaseOccurrence
6
{
7 13
    public function parse(array $dictionary)
8
    {
9 13
        $tmp = [];
10
11 13
        for ($i=0; $i < $this->size; $i++) {
0 ignored issues
show
Bug introduced by
The property size does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12
13 13
            shuffle($dictionary);
14
15 13
            $tmp[] = $dictionary[0];
16
        }
17
18 13
       return $tmp;
19
    }
20
21
    /**
22
     * Retourne la taille de l'occurence
23
     *
24
     * @return integer
25
     */
26 1
    public function size()
27
    {
28 1
        return $this->size;
29
    }
30
}
31