Test Failed
Push — master ( e86404...1009d9 )
by Tomasz
03:01
created

TreeManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A assignParent() 0 12 1
1
<?php
2
/**
3
 * (c) Tomasz Kunicki <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace Domain\CategoryStructure\Structure\Tree;
9
10
use Domain\Category\Entity\CategoryInterface;
11
use Domain\CategoryStructure\Repository\CategoryTreeRepositoryInterface;
12
13
/**
14
 * Class TreeManager
15
 *
16
 * @package Domain\Category\Structure\Tree
17
 */
18
class TreeManager
19
{
20
    /** @var  CategoryTreeRepositoryInterface */
21
    private $categoryTreeRepository;
22
23
    /**
24
     * TreeManager constructor.
25
     *
26
     * @param CategoryTreeRepositoryInterface $categoryTreeRepository
27
     */
28
    public function __construct(CategoryTreeRepositoryInterface $categoryTreeRepository)
29
    {
30
        $this->categoryTreeRepository = $categoryTreeRepository;
31
    }
32
33
    /**
34
     * @param CategoryInterface $parent
35
     * @param CategoryInterface $newChild
36
     */
37
    public function assignParent(CategoryInterface $parent, CategoryInterface $newChild)
0 ignored issues
show
Unused Code introduced by
The parameter $parent is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $newChild is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
//        $oldParent = $this->categoryTreeRepository->getParent($newChild);
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
//
41
//        if (!is_null($oldParent)) {
42
//            $oldParent->removeChild($newChild);
43
//            $this->categoryTreeRepository->update($oldParent);
44
//
45
//        }
46
//        $parent->addChild($newChild);
47
//        $this->categoryTreeRepository->update($parent);
48
    }
49
}
50