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

MoveCategoryUseCase::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 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\UseCase\MoveCategory;
9
10
use Domain\CategoryStructure\Structure\Tree\TreeManager;
11
use Domain\Common\UseCase\ResponderAwareInterface;
12
use Domain\Common\UseCase\ResponderAwareTrait;
13
14
/**
15
 * Class MoveCategoryUseCase
16
 *
17
 * @package Domain\CategoryStructure\UseCase\MoveCategory
18
 */
19
class MoveCategoryUseCase implements ResponderAwareInterface
20
{
21
    use ResponderAwareTrait;
22
23
    /** @var  TreeManager */
24
    private $treeManager;
25
26
    /**
27
     * MoveCategoryUseCase constructor.
28
     *
29
     * @param TreeManager $treeManager
30
     */
31
    public function __construct(TreeManager $treeManager)
32
    {
33
        $this->treeManager = $treeManager;
34
    }
35
36
    /**
37
     * @param MoveCategoryRequest $request
38
     */
39
    public function execute(MoveCategoryRequest $request)
40
    {
41
        $child = $request->getChild();
42
        $parent = $request->getNewParent();
43
44
        $this->treeManager->assignParent($child, $parent);
45
    }
46
47
48
}