PyRowMan /
pheanstalk
| 1 | <?php |
||||
| 2 | |||||
| 3 | |||||
| 4 | namespace Pheanstalk\Structure; |
||||
| 5 | |||||
| 6 | use Doctrine\Common\Collections\ArrayCollection; |
||||
| 7 | |||||
| 8 | class JobInstance |
||||
| 9 | { |
||||
| 10 | /** @var ArrayCollection[TaskInstance] */ |
||||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||||
| 11 | private $taskInstances; |
||||
| 12 | |||||
| 13 | /** |
||||
| 14 | * JobInstance constructor. |
||||
| 15 | * |
||||
| 16 | * @param ArrayCollection[TaskInstance] $taskInstances |
||||
|
0 ignored issues
–
show
|
|||||
| 17 | */ |
||||
| 18 | 9 | public function __construct(ArrayCollection $taskInstances) |
|||
| 19 | { |
||||
| 20 | 9 | $this->setTaskInstances($taskInstances); |
|||
| 21 | } |
||||
| 22 | |||||
| 23 | /** |
||||
| 24 | * @return ArrayCollection |
||||
| 25 | */ |
||||
| 26 | 3 | public function getTaskInstances(): ArrayCollection |
|||
| 27 | { |
||||
| 28 | 3 | return $this->taskInstances; |
|||
| 29 | } |
||||
| 30 | |||||
| 31 | /** |
||||
| 32 | * @param ArrayCollection $taskInstances |
||||
| 33 | * |
||||
| 34 | * @return JobInstance |
||||
| 35 | */ |
||||
| 36 | 9 | public function setTaskInstances(ArrayCollection $taskInstances): JobInstance |
|||
| 37 | { |
||||
| 38 | $this->taskInstances = $taskInstances->filter(function (TaskInstance $taskInstance) { |
||||
|
0 ignored issues
–
show
The parameter
$taskInstance is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 39 | 9 | return true; |
|||
| 40 | 9 | }); |
|||
| 41 | 9 | return $this; |
|||
| 42 | } |
||||
| 43 | |||||
| 44 | /** |
||||
| 45 | * @param TaskInstance $taskInstance |
||||
| 46 | * |
||||
| 47 | * @return JobInstance |
||||
| 48 | */ |
||||
| 49 | 1 | public function addTaskInstance(TaskInstance $taskInstance): JobInstance |
|||
| 50 | { |
||||
| 51 | 1 | $this->taskInstances[] = $taskInstance; |
|||
| 52 | 1 | return $this; |
|||
| 53 | } |
||||
| 54 | |||||
| 55 | /** |
||||
| 56 | * @param TaskInstance $taskInstance |
||||
| 57 | * |
||||
| 58 | * @return JobInstance |
||||
| 59 | */ |
||||
| 60 | 1 | public function removeTaskInstance(TaskInstance $taskInstance): JobInstance |
|||
| 61 | { |
||||
| 62 | 1 | $this->taskInstances->removeElement($taskInstance); |
|||
| 63 | 1 | return $this; |
|||
| 64 | } |
||||
| 65 | } |
||||
| 66 |