| 1 | <?php |
||
| 5 | class IsInRange implements Check |
||
|
|
|||
| 6 | { |
||
| 7 | /** |
||
| 8 | * minimum acceptable value in our range |
||
| 9 | */ |
||
| 10 | private $min; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * maximum acceptable value in our range |
||
| 14 | */ |
||
| 15 | private $max; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * constructor. used to create a customised check |
||
| 19 | * |
||
| 20 | * @param int $min |
||
| 21 | * minimum value for allowed range |
||
| 22 | * @param int $max |
||
| 23 | * maximum value for allowed range |
||
| 24 | */ |
||
| 25 | public function __construct($min, $max) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * generates a Check |
||
| 33 | * |
||
| 34 | * @param int $min |
||
| 35 | * minimum value for allowed range |
||
| 36 | * @param int $max |
||
| 37 | * maximum value for allowed range |
||
| 38 | * @return Check |
||
| 39 | * returns a check to use |
||
| 40 | */ |
||
| 41 | public static function using($min, $max) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * is $data within the require range? |
||
| 48 | * |
||
| 49 | * @param int $data |
||
| 50 | * the value to check |
||
| 51 | * @return bool |
||
| 52 | * TRUE if the data is in range |
||
| 53 | * FALSE otherwise |
||
| 54 | */ |
||
| 55 | public function inspect($data) |
||
| 59 | |||
| 60 | /** |
||
| 61 | * is $data within the require range? |
||
| 62 | * |
||
| 63 | * @param int $data |
||
| 64 | * the value to check |
||
| 65 | * @param int $min |
||
| 66 | * minimum value for allowed range |
||
| 67 | * @param int $max |
||
| 68 | * maximum value for allowed range |
||
| 69 | * @return bool |
||
| 70 | * TRUE if the data is in range |
||
| 71 | * FALSE otherwise |
||
| 72 | */ |
||
| 73 | public static function check($data, $min, $max) |
||
| 84 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.