This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
26
{
27
/** Error context key */
28
const CONTEXT_FORMAT = 0;
29
30
/**
31
* @var string
32
*/
33
private $format;
34
35
/**
36
* @param string $format
37
*/
38
1
public function __construct($format)
39
{
40
1
$this->format = $format;
41
1
}
42
43
/**
44
* @inheritdoc
45
*
46
* @SuppressWarnings(PHPMD.StaticAccess)
47
*/
48
1
public function validate($input)
49
{
50
1
if (DateTime::createFromFormat($this->format, (string)$input) === false) {
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.