Completed
Push — master ( 2c1a94...065363 )
by Wachter
13:32 queued 10:25
created

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createTask() 0 4 1
A createTaskExecution() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of php-task library.
5
 *
6
 * (c) php-task
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Task\TaskBundle;
13
14
use Task\TaskBundle\Entity\Task;
15
use Task\TaskBundle\Entity\TaskExecution;
16
use Task\TaskInterface;
17
18
/**
19
 * Factory which returns doctrine entities for tasks and task-execution.
20
 */
21
class Factory extends \Task\Factory
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function createTask($handlerClass, $workload)
27
    {
28
        return new Task($handlerClass, $workload);
0 ignored issues
show
Bug introduced by
It seems like $workload defined by parameter $workload on line 26 can also be of type object<Serializable>; however, Task\Task::__construct() does only seem to accept string|null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function createTaskExecution(TaskInterface $task, \DateTime $scheduleTime)
35
    {
36
        return new TaskExecution($task, $task->getHandlerClass(), $scheduleTime, $task->getWorkload());
0 ignored issues
show
Bug introduced by
It seems like $task->getWorkload() targeting Task\TaskInterface::getWorkload() can also be of type object<Serializable>; however, Task\Execution\TaskExecution::__construct() does only seem to accept string|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
37
    }
38
}
39