| 1 | <?php |
||
| 2 | |||
| 3 | namespace PHPDish\DailySongPlugin\Entity; |
||
| 4 | |||
| 5 | use Carbon\Carbon; |
||
| 6 | use PHPDish\Bundle\CoreBundle\Model\DateTimeTrait; |
||
| 7 | use PHPDish\Bundle\CoreBundle\Model\EnabledTrait; |
||
| 8 | use PHPDish\Bundle\CoreBundle\Model\IdentifiableTrait; |
||
| 9 | use PHPDish\DailySongPlugin\Model\SongInterface; |
||
| 10 | |||
| 11 | class Song implements SongInterface |
||
| 12 | { |
||
| 13 | use IdentifiableTrait; |
||
| 14 | use DateTimeTrait; |
||
| 15 | use EnabledTrait; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $name; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $srcId; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $src; |
||
| 31 | |||
| 32 | public function __construct() |
||
| 33 | { |
||
| 34 | $this->createdAt = $this->updatedAt = Carbon::now(); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritdoc} |
||
| 39 | */ |
||
| 40 | public function getName() |
||
| 41 | { |
||
| 42 | return $this->name; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | public function setName($name) |
||
| 49 | { |
||
| 50 | $this->name = $name; |
||
| 51 | |||
| 52 | return $this; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | public function getSrcId() |
||
| 59 | { |
||
| 60 | return $this->srcId; |
||
|
0 ignored issues
–
show
|
|||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * {@inheritdoc} |
||
| 65 | */ |
||
| 66 | public function setSrcId($srcId) |
||
| 67 | { |
||
| 68 | $this->srcId = $srcId; |
||
| 69 | |||
| 70 | return $this; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * {@inheritdoc} |
||
| 75 | */ |
||
| 76 | public function getSrc() |
||
| 77 | { |
||
| 78 | return $this->src; |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * {@inheritdoc} |
||
| 83 | */ |
||
| 84 | public function setSrc($src) |
||
| 85 | { |
||
| 86 | $this->src = $src; |
||
| 87 | |||
| 88 | return $this; |
||
| 89 | } |
||
| 90 | } |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: