AddTimeFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Copyright Andrea Heigl <[email protected]>
7
 *
8
 * Licenses under the MIT-license. For details see the included file LICENSE.md
9
 */
10
11
namespace Org_Heigl\CaptainHook\Hooks\AddTime;
12
13
use CaptainHook\App\Config;
14
use CaptainHook\App\Hook\Action;
15
use CaptainHook\App\Hook\ActionFactory;
0 ignored issues
show
Bug introduced by
The type CaptainHook\App\Hook\ActionFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Org_Heigl\CaptainHook\Hooks\AddTime\Formatter\TimeDifference;
17
18
class AddTimeFactory implements ActionFactory
19
{
20
    public function getAction(Config\Options $options) : Action
21
    {
22
        $fuzziness = null;
23
        if ($options->get('fuzziness') != null) {
24
            $class = $options->get('fuzziness');
25
            $fuzziness = new $class();
26
        }
27
28
        return new AddTime(new TimeDifference($fuzziness));
29
    }
30
}