| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* This file is part of the Nette Framework (https://nette.org) |
| 5 |
* Copyright (c) 2004 David Grudl (https://davidgrudl.com) |
| 6 |
*/ |
| 7 |
declare (strict_types=1); |
| 8 |
namespace Packetery\Nette\Forms; |
| 9 |
|
| 10 |
use Packetery\Nette; |
| 11 |
/** |
| 12 |
* Single validation rule or condition represented as value object. |
| 13 |
*/ |
| 14 |
class Rule |
| 15 |
{ |
| 16 |
use \Packetery\Nette\SmartObject; |
| 17 |
/** @var Control */ |
| 18 |
public $control; |
| 19 |
/** @var mixed */ |
| 20 |
public $validator; |
| 21 |
/** @var mixed */ |
| 22 |
public $arg; |
| 23 |
/** @var bool */ |
| 24 |
public $isNegative = \false; |
| 25 |
/** @var string|null */ |
| 26 |
public $message; |
| 27 |
/** @var Rules|null for conditions */ |
| 28 |
public $branch; |
| 29 |
/** @internal */ |
| 30 |
public function canExport() : bool |
| 31 |
{ |
| 32 |
return \is_string($this->validator) || \Packetery\Nette\Utils\Callback::isStatic($this->validator); |
| 33 |
} |
| 34 |
} |
| 35 |
|