Passed
Push — master ( eac84f...04da79 )
by Tomasz
01:29
created

UseCase::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 1
dl 0
loc 15
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
namespace Aggrego\Neo4jIntegration\Api\Command\CreateRelationship;
13
14
use GraphAware\Neo4j\Client\Client;
15
use GraphAware\Neo4j\Client\Exception\Neo4jExceptionInterface;
16
17
class UseCase
18
{
19
    /** @var Client */
20
    private $client;
21
22
    public function __construct(Client $client)
23
    {
24
        $this->client = $client;
25
    }
26
27
    public function handle(Command $command): Response
0 ignored issues
show
Unused Code introduced by
The parameter $command is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
    public function handle(/** @scrutinizer ignore-unused */ Command $command): Response

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

Loading history...
28
    {
29
        try {
30
            $this->client->run(
31
                'MATCH (u:{nodeType} {uuid:{uuid}}), (p:Event {uuid:{parent_uuid}}) CREATE (u)-[:CREATED_FROM]->(p)',
32
                [
33
                    'uuid' => $boardUuidValue,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $boardUuidValue seems to be never defined.
Loading history...
34
                    'parent_uuid' => $payload['parent_uuid']
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $payload seems to be never defined.
Loading history...
35
                ]
36
            );
37
        } catch (Neo4jExceptionInterface $e) {
38
            return Response::fail($e->getMessage());
39
        }
40
41
        return Response::ok();
42
    }
43
}
44