phplibrary/src/Validator/Rule/AbstractRule.php
2018-04-13 17:59:57 +03:00

48 lines
828 B
PHP

<?php
namespace ctiso\Validator\Rule;
use ctiso\Collection;
abstract class AbstractRule
{
public $field;
protected $errorMsg;
protected $ctx;
public function __construct($field, $errorMsg = null)
{
$this->field = $field;
$this->errorMsg = $errorMsg;
}
public function setName($field)
{
$this->field = $field;
return $this;
}
public function setErrorMsg($errorMsg)
{
$this->errorMsg = $errorMsg;
return $this;
}
public function getErrorMsg()
{
return $this->errorMsg;
}
public function isValid(Collection $container, $status = null)
{
return true;
}
function skipEmpty() {
return true;
}
public function setContext($ctx)
{
$this->ctx = $ctx;
}
}