Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
88.89% covered (warning)
88.89%
8 / 9
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ReflectionMethodList
88.89% covered (warning)
88.89%
8 / 9
50.00% covered (danger)
50.00%
1 / 2
2.01
0.00% covered (danger)
0.00%
0 / 1
 offsetGet
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 filterOnApieContext
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\Core\Lists;
3
4use Apie\Core\Context\ApieContext;
5use ReflectionMethod;
6
7final class ReflectionMethodList extends ItemList
8{
9    public function offsetGet(mixed $offset): ReflectionMethod
10    {
11        return parent::offsetGet($offset);
12    }
13
14    public function filterOnApieContext(ApieContext $apieContext, bool $runtimeChecks = true): self
15    {
16        $clone = new ReflectionMethodList();
17        $clone->internal = array_values(array_filter(
18            $this->internal,
19            function (ReflectionMethod $item) use ($apieContext, $runtimeChecks) {
20                return $apieContext->appliesToContext($item, $runtimeChecks);
21            }
22        ));
23        return $clone;
24    }
25}