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

ActionSearchJpg   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 19
loc 19
rs 10
c 1
b 0
f 0
ccs 0
cts 7
cp 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A search() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace App\Actions\Image;
3
4
use SearchManager\Manager as SearchManager;
5
use Staticus\Middlewares\ActionSearchAbstract;
6
use Staticus\Resources\ResourceDOInterface;
7
use Staticus\Resources\Image\ResourceImageDOInterface;
8
9 View Code Duplication
class ActionSearchJpg extends ActionSearchAbstract
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...
10
{
11
    public function __construct(
12
        ResourceImageDOInterface $resourceDO
13
        , SearchManager $manager
14
    )
15
    {
16
        parent::__construct($resourceDO, $manager);
17
    }
18
19
    protected function search(ResourceDOInterface $resourceDO)
20
    {
21
        /** @var SearchManager $searcher */
22
        $searcher = $this->searcher;
23
        $query = $resourceDO->getName() . ' ' . $resourceDO->getNameAlternative();
1 ignored issue
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 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...
24
25
        return $searcher->generate($query);
26
    }
27
}