Conditions | 3 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
20 | 2 | public static function toArrayWithPlural($pluralValue = false, $pluralKey = false) |
|
21 | { |
||
22 | 2 | return new static( |
|
23 | 2 | function ($value) use ($pluralValue, $pluralKey) { |
|
24 | 2 | return array_filter([ |
|
25 | 2 | key($value), |
|
26 | 2 | reset($value), |
|
27 | 2 | $pluralKey ? Word::fromString(key($value))->getPluralised() : null, |
|
28 | 2 | $pluralValue ? Word::fromString(reset($value))->getPluralised() : null |
|
29 | 2 | ]); |
|
30 | } |
||
31 | 2 | ); |
|
32 | } |
||
33 | } |
||
34 |