Advertisement
Guest User

Codeception class to test

a guest
Jan 24th, 2020
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. class Status {
  2.     public const CODES = [
  3.         ......
  4.     ];
  5.  
  6.     protected $code;
  7.  
  8.     public function __construct(string $code) {
  9.         if (!$this->codeIsKnown($code)){
  10.             throw new Exception\UnknownStatusCodeException('Unknown code: '.$code);
  11.         }
  12.         $this->code = $code;
  13.     }
  14.  
  15.     protected function codeIsKnown(string $code):bool{
  16.         return in_array($code, self::CODES);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement