Framework Update
This commit is contained in:
+40
-15
@@ -1,12 +1,8 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Respect/Validation.
|
||||
*
|
||||
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -18,13 +14,21 @@ use Respect\Validation\Factory;
|
||||
use Respect\Validation\Validatable;
|
||||
|
||||
/**
|
||||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Alexandre Gomes Gaigalas <alganet@gmail.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Nick Lombard <github@jigsoft.co.za>
|
||||
* @author Vicente Mendoza <vicentemmor@yahoo.com.mx>
|
||||
*/
|
||||
abstract class AbstractRule implements Validatable
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $default;
|
||||
/**
|
||||
* @var bool|false
|
||||
*/
|
||||
protected $defaultType;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
@@ -35,14 +39,6 @@ abstract class AbstractRule implements Validatable
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @param mixed$input
|
||||
*/
|
||||
public function __invoke($input): bool
|
||||
{
|
||||
return $this->validate($input);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -98,4 +94,33 @@ abstract class AbstractRule implements Validatable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDefault(): ?string
|
||||
{
|
||||
return $this->default;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDefaultType(): ?bool
|
||||
{
|
||||
return $this->defaultType;
|
||||
}
|
||||
public function setDefault(string $default, bool $defaultType=false): Validatable
|
||||
{
|
||||
$this->default = $default;
|
||||
$this->defaultType = $defaultType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed$input
|
||||
*/
|
||||
public function __invoke($input): bool
|
||||
{
|
||||
return $this->validate($input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user