Conditions | 7 |
Paths | 7 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
13 | 10 | public function findTests($search = null) |
|
14 | { |
||
15 | 10 | if ($search === null || empty($search)) { |
|
16 | 6 | return $this->findAll(); |
|
17 | } |
||
18 | |||
19 | 4 | if (!is_array($search)) { |
|
20 | 1 | $search = [$search]; |
|
21 | 1 | } |
|
22 | |||
23 | 4 | $tests = []; |
|
24 | |||
25 | 4 | foreach ($search as $term) { |
|
26 | //Find test by name first |
||
27 | 4 | $test = $this->findByName($term); |
|
28 | 4 | if ($test !== null) { |
|
29 | 3 | $tests[] = $test; |
|
30 | 3 | continue; |
|
31 | } |
||
32 | |||
33 | 3 | $testsInGroup = $this->findByGroupName($term); |
|
34 | 3 | foreach ($testsInGroup as $test) { |
|
35 | 2 | $tests[] = $test; |
|
36 | 3 | } |
|
37 | 4 | } |
|
38 | |||
39 | 4 | return $tests; |
|
40 | } |
||
41 | |||
65 |