| Total Complexity | 6 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait PrioritisedTrait |
||
| 9 | { |
||
| 10 | /** @var float */ |
||
| 11 | protected $priority; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param float $priority |
||
| 15 | * |
||
| 16 | * @return $this |
||
| 17 | */ |
||
| 18 | 4 | public function setPriority($priority) |
|
| 19 | { |
||
| 20 | 4 | $oldPriority = $this->priority; |
|
| 21 | 4 | $this->priority = $priority; |
|
| 22 | 4 | if (!($this instanceof RunInterface && $this->hasStarted()) |
|
| 23 | 4 | && method_exists($this, 'dispatch') |
|
| 24 | 4 | && $this instanceof PrioritisedInterface) { |
|
| 25 | 4 | $this->dispatch(PriorityChangedEvent::CHANGED, new PriorityChangedEvent($this, $priority, $oldPriority)); |
|
| 26 | } |
||
| 27 | 4 | return $this; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return float |
||
| 32 | */ |
||
| 33 | 42 | public function getPriority() |
|
| 36 | } |
||
| 37 | } |
||
| 38 |