Code Duplication    Length = 30-31 lines in 2 locations

TaskManager/src/Kreta/TaskManager/Infrastructure/Symfony/GraphQl/Query/Project/ProjectResolver.php 1 location

@@ 87-116 (lines=30) @@
84
        }
85
    }
86
87
    public function byProjectInput($projectInput)
88
    {
89
        try {
90
            $this->queryBus->handle(
91
                new ProjectOfSlugQuery(
92
                    $projectInput['slug'],
93
                    $projectInput['organizationSlug'],
94
                    $this->currentUser
95
                ),
96
                $result
97
            );
98
99
            return $result;
100
        } catch (ProjectDoesNotExistException $exception) {
101
            throw new UserError(
102
                sprintf(
103
                    'Does not exist any project with the given "%s" slug',
104
                    $projectInput['slug']
105
                )
106
            );
107
        } catch (UnauthorizedProjectResourceException $exception) {
108
            throw new UserError(
109
                sprintf(
110
                    'The "%s" user does not allow to access the "%s" project',
111
                    $this->currentUser,
112
                    $projectInput['slug']
113
                )
114
            );
115
        }
116
    }
117
}
118

TaskManager/src/Kreta/TaskManager/Infrastructure/Symfony/GraphQl/Query/Project/Task/TaskResolver.php 1 location

@@ 41-71 (lines=31) @@
38
        $this->taskBuilderResolver = $taskBuilderResolver;
39
    }
40
41
    public function resolve($args)
42
    {
43
        try {
44
            $this->queryBus->handle(
45
                new TaskOfIdQuery(
46
                    $args['id'],
47
                    $this->currentUser
48
                ),
49
                $result
50
            );
51
52
            $result = $this->taskBuilderResolver->resolve($result);
53
        } catch (TaskDoesNotExistException $exception) {
54
            throw new UserError(
55
                sprintf(
56
                    'Does not exist any task with the given "%s" id',
57
                    $args['id']
58
                )
59
            );
60
        } catch (UnauthorizedTaskResourceException $exception) {
61
            throw new UserError(
62
                sprintf(
63
                    'The "%s" user does not allow to access the "%s" task',
64
                    $this->currentUser,
65
                    $args['id']
66
                )
67
            );
68
        }
69
70
        return $result;
71
    }
72
73
    public function resolveByParent($parentId)
74
    {