2014-07-16 10:02:26 +02:00
|
|
|
<?php
|
|
|
|
|
2015-06-08 17:09:25 +02:00
|
|
|
/*
|
2023-02-17 05:13:51 +01:00
|
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
|
|
* SPDX-License-Identifier: MIT
|
2015-06-08 17:09:25 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-06-08 16:47:14 +02:00
|
|
|
namespace Respect\Validation\Rules;
|
2014-07-16 10:02:26 +02:00
|
|
|
|
2018-11-25 17:56:04 +01:00
|
|
|
/**
|
2024-03-11 23:14:36 +01:00
|
|
|
* Validates whether the input is a hex RGB color or not.
|
2019-04-05 19:05:42 +02:00
|
|
|
*
|
2018-11-25 17:56:04 +01:00
|
|
|
* @author Davide Pastore <pasdavide@gmail.com>
|
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
*/
|
2019-04-05 19:05:42 +02:00
|
|
|
final class HexRgbColor extends AbstractEnvelope
|
2014-07-16 10:02:26 +02:00
|
|
|
{
|
2019-04-05 19:05:42 +02:00
|
|
|
public function __construct()
|
2014-07-16 10:02:26 +02:00
|
|
|
{
|
2020-10-04 12:07:09 +02:00
|
|
|
parent::__construct(new Regex('/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i'));
|
2014-07-16 10:02:26 +02:00
|
|
|
}
|
|
|
|
}
|