Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractGroupElement
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 add
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 remove
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 getElements
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace PhpOffice\Math\Element;
4
5abstract class AbstractGroupElement extends AbstractElement
6{
7    /**
8     * @var AbstractElement[]
9     */
10    protected $elements = [];
11
12    public function add(AbstractElement $element): self
13    {
14        $this->elements[] = $element;
15
16        return $this;
17    }
18
19    public function remove(AbstractElement $element): self
20    {
21        $this->elements = array_filter($this->elements, function ($child) use ($element) {
22            return $child != $element;
23        });
24
25        return $this;
26    }
27
28    /**
29     * @return AbstractElement[]
30     */
31    public function getElements(): array
32    {
33        return $this->elements;
34    }
35}