respect-validation/library/Rules/No.php
Danilo Correa 54293d4ca2
Apply contribution guidelines to "Regex" rule
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>
2018-12-14 00:15:03 +01:00

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'));
}
}