Completed
Push — 2.0 ( 76e968...4129d9 )
by Marco
13:01
created

BaseEntityTrait::setTask()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php namespace Comodojo\Extender\Traits;
2
3
use \Comodojo\Extender\Task\TaskParameters;
4
5
/**
6
 * @package     Comodojo Extender
7
 * @author      Marco Giovinazzi <[email protected]>
8
 * @license     MIT
9
 *
10
 * LICENSE:
11
 *
12
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18
 * THE SOFTWARE.
19
 */
20
21
trait BaseEntityTrait {
22
23
    /**
24
     * @var integer
25
     *
26
     * @ORM\Id
27
     * @ORM\Column(type="integer", nullable=false)
28
     * @ORM\GeneratedValue(strategy="AUTO")
29
     */
30
    protected $id = 0;
31
32
    /**
33
     * @var string
34
     *
35
     * @ORM\Column(name="name", type="string", length=256, nullable=false)
36
     */
37
    protected $name;
38
39
    /**
40
     * Get queue item's id
41
     *
42
     * @return integer
43
     */
44
    public function getId() {
45
46
        return $this->id;
47
48
    }
49
50
    /**
51
     * Set queue item's id
52
     *
53
     * @param string $id
54
     * @return Schedule
55
     */
56
    public function setId($id) {
57
58
        $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...
59
60
        return $this;
61
62
    }
63
64
    /**
65
     * Get queue item's name
66
     *
67
     * @return string
68
     */
69
    public function getName() {
70
71
        return $this->name;
72
73
    }
74
75
    /**
76
     * Set queue item's name
77
     *
78
     * @param string $name
79
     * @return Schedule
80
     */
81
    public function setName($name) {
82
83
        $this->name = $name;
84
85
        return $this;
86
87
    }
88
89
    /**
90
     * Returns the properties of this object as an array for ease of use
91
     *
92
     * @return array
93
     */
94
    public function toArray() {
95
96
        return get_object_vars($this);
97
98
    }
99
100
}
101