Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
NonEmptyString | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
getRegularExpression | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
convert | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createRandom | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\Core\ValueObjects; |
3 | |
4 | use Apie\Core\Attributes\Description; |
5 | use Apie\Core\Attributes\FakeMethod; |
6 | use Apie\Core\Attributes\ProvideIndex; |
7 | use Apie\Core\ValueObjects\Concerns\IndexesWords; |
8 | use Apie\Core\ValueObjects\Interfaces\HasRegexValueObjectInterface; |
9 | use Faker\Generator; |
10 | |
11 | #[FakeMethod('createRandom')] |
12 | #[ProvideIndex('getIndexes')] |
13 | #[Description('Any text, except the empty string.')] |
14 | class NonEmptyString implements HasRegexValueObjectInterface |
15 | { |
16 | use IndexesWords; |
17 | use IsStringWithRegexValueObject; |
18 | |
19 | public static function getRegularExpression(): string |
20 | { |
21 | return '/^.+$/s'; |
22 | } |
23 | |
24 | protected function convert(string $input): string |
25 | { |
26 | return trim($input); |
27 | } |
28 | |
29 | public static function createRandom(Generator $generator): self |
30 | { |
31 | return static::fromNative($generator->realText(1024)); |
32 | } |
33 | } |