Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
IsStringValueObjectExample
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 convert
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 validate
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Apie\Fixtures\ValueObjects;
3
4use Apie\Core\ValueObjects\Exceptions\InvalidStringForValueObjectException;
5use Apie\Core\ValueObjects\Interfaces\ValueObjectInterface;
6use Apie\Core\ValueObjects\IsStringValueObject;
7use ReflectionClass;
8
9class IsStringValueObjectExample implements ValueObjectInterface
10{
11    use IsStringValueObject;
12
13    protected function convert(string $input): string
14    {
15        return trim($input);
16    }
17
18    public static function validate(string $input): void
19    {
20        if (empty($input)) {
21            throw new InvalidStringForValueObjectException($input, new ReflectionClass(self::class));
22        }
23    }
24}