Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
OrderStatus
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 ensureDraft
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2namespace Apie\Fixtures\Enums;
3
4use LogicException;
5
6enum OrderStatus: string
7{
8    case DRAFT = 'DRAFT';
9    case ACCEPTED = 'ACCEPTED';
10    case COMPLETED = 'COMPLETED';
11
12    public function ensureDraft(): void
13    {
14        if ($this !== self::DRAFT) {
15            throw new LogicException('Order should be in draft status');
16        }
17    }
18}