| Total Complexity | 6 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | final class PivotedCollection extends ArrayCollection implements PivotedCollectionInterface |
||
| 21 | { |
||
| 22 | /** @var \SplObjectStorage */ |
||
| 23 | protected $pivotContext; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param array $elements |
||
| 27 | * @param \SplObjectStorage|null $pivotData |
||
| 28 | */ |
||
| 29 | public function __construct(array $elements = [], \SplObjectStorage $pivotData = null) |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritdoc |
||
| 37 | */ |
||
| 38 | public function hasPivot($element): bool |
||
| 39 | { |
||
| 40 | return $this->pivotContext->offsetExists($element); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @inheritdoc |
||
| 45 | */ |
||
| 46 | public function getPivot($element) |
||
| 47 | { |
||
| 48 | return $this->pivotContext[$element] ?? null; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @inheritdoc |
||
| 53 | */ |
||
| 54 | public function setPivot($element, $pivot): void |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @inheritdoc |
||
| 61 | */ |
||
| 62 | public function getPivotContext(): \SplObjectStorage |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param array $elements |
||
| 69 | * @return PivotedCollection |
||
| 70 | */ |
||
| 71 | protected function createFrom(array $elements) |
||
| 79 |