| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | class ChallengeDefinition implements Serializable |
||
| 24 | { |
||
| 25 | /** @var string */ |
||
| 26 | private $classname; |
||
| 27 | |||
| 28 | /** @var int */ |
||
| 29 | private $number; |
||
| 30 | |||
| 31 | public function __construct(string $classname, int $number = 1) |
||
| 32 | { |
||
| 33 | if (!in_array(IChallenge::class, class_implements($classname), true)) { |
||
| 34 | throw new InvalidArgumentException(); |
||
| 35 | } elseif ($number < 1) { |
||
| 36 | throw new InvalidArgumentException(); |
||
| 37 | } |
||
| 38 | $this->classname = $classname; |
||
| 39 | $this->number = $number; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getClassname(): string |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getNumber(): int |
||
| 50 | } |
||
| 51 | |||
| 52 | public function serialize() |
||
| 53 | { |
||
| 54 | return serialize([ |
||
| 55 | $this->classname, |
||
| 56 | $this->number, |
||
| 57 | ]); |
||
| 58 | } |
||
| 59 | |||
| 60 | public function unserialize($serialized) |
||
| 65 | } |
||
| 66 | } |
||
| 67 |