| Total Complexity | 7 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class UniqueJsonRule |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string |
||
| 9 | */ |
||
| 10 | protected $rule = 'unique_json'; |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $table; |
||
| 15 | /** |
||
| 16 | * @var string|null |
||
| 17 | */ |
||
| 18 | protected $column = null; |
||
| 19 | /** |
||
| 20 | * @var mixed |
||
| 21 | */ |
||
| 22 | protected $ignoreValue = null; |
||
| 23 | /** |
||
| 24 | * @var string|null |
||
| 25 | */ |
||
| 26 | protected $ignoreColumn = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Create a new rule instance. |
||
| 30 | * |
||
| 31 | * @param string $table |
||
| 32 | * @param string|null $column |
||
| 33 | * |
||
| 34 | * @return static |
||
| 35 | */ |
||
| 36 | public static function for($table, $column = null) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Create a new rule instance. |
||
| 43 | * |
||
| 44 | * @param string $table |
||
| 45 | * @param string|null $column |
||
| 46 | */ |
||
| 47 | public function __construct($table, $column = null) |
||
| 48 | { |
||
| 49 | $this->table = $table; |
||
| 50 | $this->column = $column; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Ignore any record that has a column with the given value. |
||
| 55 | * |
||
| 56 | * @param mixed $value |
||
| 57 | * @param string $column |
||
| 58 | * |
||
| 59 | * @return $this |
||
| 60 | */ |
||
| 61 | public function ignore($value, $column = 'id') |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Generate a string representation of the validation rule. |
||
| 71 | * |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | public function __toString() |
||
| 83 | ); |
||
| 84 | } |
||
| 86 |