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...
22
{
23
const PRIORITY = 900;
24
25
/**
26
* @var DateTimeSerializer
27
*/
28
protected $dateTimeSerializer;
29
30
/**
31
* DateTimeFactory constructor.
32
* @param DateTimeSerializer $dateTimeSerializer
33
*/
34
public function __construct(DateTimeSerializer $dateTimeSerializer)
35
{
36
$this->dateTimeSerializer = $dateTimeSerializer;
37
}
38
39
/**
40
* @param Schema $schema
41
* @param ProcessorBuilder $builder
42
* @return Processor|null
43
*/
44
public function create(Schema $schema, ProcessorBuilder $builder)
45
{
46
if (!$schema instanceof ScalarSchema || !$schema->isDateTime()) {
47
return null;
48
}
49
50
return new DateTimeProcessor($schema, $this->dateTimeSerializer);
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.