Passed
Branch master (fc4881)
by Eugene
02:31
created

ActionPost::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
cc 1
eloc 6
nc 1
nop 4
dl 9
loc 9
rs 9.6666
c 3
b 0
f 1
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
namespace App\Actions\Image;
3
4
use League\Flysystem\FilesystemInterface;
5
use SearchManager\Manager as SearchManager;
6
use Staticus\Middlewares\ActionPostAbstract;
7
use Staticus\Resources\ResourceDOInterface;
8
use Staticus\Resources\Image\ResourceImageDOInterface;
9
use FractalManager\Manager as FractalManager;
10
11 View Code Duplication
class ActionPost extends ActionPostAbstract
1 ignored issue
show
Duplication introduced by
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...
12
{
13 4
    public function __construct(
14
        ResourceImageDOInterface $resourceDO
15
        , FilesystemInterface $filesystem
16
        , FractalManager $fractal
17
        , SearchManager $generatorSearch
18
    )
19
    {
20 4
        parent::__construct($resourceDO, $filesystem, $fractal, $generatorSearch);
0 ignored issues
show
Unused Code introduced by
The call to ActionPostAbstract::__construct() has too many arguments starting with $generatorSearch.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21 4
    }
22
23
    /**
24
     * @param ResourceDOInterface $resourceDO
25
     * @return mixed
26
     */
27 2
    protected function generate(ResourceDOInterface $resourceDO)
28
    {
29 2
        $query = $resourceDO->getName() . ' ' . $resourceDO->getNameAlternative();
1 ignored issue
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
30 2
        $content = $this->generator->generate($query);
31
32 2
        return $content;
33
    }
34
}