Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
8 / 8
ProductType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
7
100.00% covered (success)
100.00%
8 / 8
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 fromString
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 type
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 drink
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 food
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toString
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __toString
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
declare(strict_types=1);
namespace App\Order\Domain\ValueObject;
final class ProductType
{
    public const DRINK = 'drink';
    public const FOOD = 'food';
    private string $type;
    public function __construct(string $type)
    {
        $this->type = $type;
    }
    public static function fromString(string $type): self
    {
        return new self($type);
    }
    public function type(): string
    {
        return $this->type;
    }
    public static function drink(): self
    {
        return new static(self::DRINK);
    }
    public static function food(): self
    {
        return new static(self::FOOD);
    }
    public function toString(): string
    {
        return $this->type;
    }
    public function __toString(): string
    {
        return $this->type;
    }
}