Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
CompanyName
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 getRegularExpression
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 convert
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createRandom
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\TextValueObjects;
3
4use Apie\Core\Attributes\FakeMethod;
5use Apie\Core\Attributes\ProvideIndex;
6use Apie\Core\ValueObjects\Concerns\IndexesWords;
7use Apie\Core\ValueObjects\Interfaces\HasRegexValueObjectInterface;
8use Apie\Core\ValueObjects\IsStringWithRegexValueObject;
9use Faker\Generator;
10
11#[FakeMethod('createRandom')]
12#[ProvideIndex('getIndexes')]
13class CompanyName implements HasRegexValueObjectInterface
14{
15    use IndexesWords;
16    use IsStringWithRegexValueObject;
17
18    public static function getRegularExpression(): string
19    {
20        return '/^\w[\w\-\s\'`"‘’“”‟,]*$/u';
21    }
22
23    protected function convert(string $input): string
24    {
25        return trim($input);
26    }
27
28    public static function createRandom(Generator $generator): self
29    {
30        return self::fromNative($generator->company());
31    }
32}