| 1 | <?php |
||
| 13 | class TimestampValidator |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * The name of the table to check against |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $table = ''; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Creates a new TimestampValidator object, for a particular table. |
||
| 23 | * The `tbl_` prefix is automatically added. |
||
| 24 | * |
||
| 25 | * @param string $table |
||
| 26 | * The table name |
||
| 27 | */ |
||
| 28 | public function __construct($table) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Checks if the modified date of the record identified with $id |
||
| 38 | * if equal to the supplied $timestamp |
||
| 39 | * |
||
| 40 | * @param int|string $id |
||
| 41 | * The record id to check |
||
| 42 | * @param string $timestamp |
||
| 43 | * The user supplied timestamp |
||
| 44 | * @return boolean |
||
| 45 | * true if the $timestamp is the latest or the $id is invalid, false other wise |
||
| 46 | */ |
||
| 47 | public function check($id, $timestamp) |
||
| 62 | } |
||
| 63 |