| 1 | <?php |
||
| 8 | final class TransformationFormat implements Comparable |
||
| 9 | { |
||
| 10 | const EIGHT = '8NE'; |
||
| 11 | const SIXTEEN = '16NE'; |
||
| 12 | const SIXTEEN_BIG_ENDIAN = '16BE'; |
||
| 13 | const SIXTEEN_LITTLE_ENDIAN = '16LE'; |
||
| 14 | const THIRTY_TWO = '32NE'; |
||
| 15 | const THIRTY_TWO_BIG_ENDIAN = '32BE'; |
||
| 16 | const THIRTY_TWO_LITTLE_ENDIAN = '32LE'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string[] |
||
| 20 | */ |
||
| 21 | private static $valid = [ |
||
| 22 | self::EIGHT, |
||
| 23 | self::SIXTEEN, |
||
| 24 | self::SIXTEEN_BIG_ENDIAN, |
||
| 25 | self::SIXTEEN_LITTLE_ENDIAN, |
||
| 26 | self::THIRTY_TWO, |
||
| 27 | self::THIRTY_TWO_BIG_ENDIAN, |
||
| 28 | self::THIRTY_TWO_LITTLE_ENDIAN |
||
| 29 | ]; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | private $type; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $type |
||
| 38 | * @throws InvalidArgumentException |
||
| 39 | */ |
||
| 40 | private function __construct($type) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $type |
||
| 51 | * @return TransformationFormat |
||
| 52 | */ |
||
| 53 | public static function ofType($type) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | public function getType() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param mixed $other |
||
| 68 | * @return bool |
||
| 69 | */ |
||
| 70 | public function equals($other) |
||
| 75 | } |