mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 15:50:03 +01:00
Because some classes extend the "Regex" class this commit will also change the implementation of those classes to use "Regex" by composition instead of extending the class. Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
30 lines
683 B
PHP
30 lines
683 B
PHP
<?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.md"
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
/**
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
*/
|
|
class No extends AbstractEnvelope
|
|
{
|
|
public function __construct($useLocale = false)
|
|
{
|
|
$pattern = '^n(o(t|pe)?|ix|ay)?$';
|
|
if ($useLocale && defined('NOEXPR')) {
|
|
$pattern = nl_langinfo(NOEXPR);
|
|
}
|
|
|
|
parent::__construct(new Regex('/'.$pattern.'/i'));
|
|
}
|
|
}
|