BaseEntityTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 76
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A toArray() 0 3 1
A getId() 0 3 1
A setName() 0 5 1
A setId() 0 5 1
1
<?php namespace Comodojo\Extender\Traits;
2
3
/**
4
 * @package     Comodojo Extender
5
 * @author      Marco Giovinazzi <[email protected]>
6
 * @license     MIT
7
 *
8
 * LICENSE:
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16
 * THE SOFTWARE.
17
 */
18
19
trait BaseEntityTrait {
20
21
    /**
22
     * @var integer
23
     *
24
     * @ORM\Id
25
     * @ORM\Column(type="integer", nullable=false)
26
     * @ORM\GeneratedValue(strategy="AUTO")
27
     */
28
    protected $id = 0;
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="name", type="string", length=128, nullable=false)
34
     */
35
    protected $name;
36
37
    /**
38
     * Get queue item's id
39
     *
40
     * @return integer
41
     */
42
    public function getId() {
43
44
        return $this->id;
45
46
    }
47
48
    /**
49
     * Set queue item's id
50
     *
51
     * @param string $id
52
     * @return Schedule
0 ignored issues
show
Bug introduced by
The type Comodojo\Extender\Traits\Schedule was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
53
     */
54
    public function setId($id) {
55
56
        $this->id = $id;
0 ignored issues
show
Documentation Bug introduced by
The property $id was declared of type integer, but $id is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
57
58
        return $this;
59
60
    }
61
62
    /**
63
     * Get queue item's name
64
     *
65
     * @return string
66
     */
67
    public function getName() {
68
69
        return $this->name;
70
71
    }
72
73
    /**
74
     * Set queue item's name
75
     *
76
     * @param string $name
77
     * @return Schedule
78
     */
79
    public function setName($name) {
80
81
        $this->name = $name;
82
83
        return $this;
84
85
    }
86
87
    /**
88
     * Returns the properties of this object as an array for ease of use
89
     *
90
     * @return array
91
     */
92
    public function toArray() {
93
94
        return get_object_vars($this);
95
96
    }
97
98
}
99