Code Duplication    Length = 23-23 lines in 2 locations

src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php 2 locations

@@ 89-111 (lines=23) @@
86
        return $this->apiRaLocationService->search($query);
87
    }
88
89
    public function create(CreateRaLocationCommand $command)
90
    {
91
        $middlewareCommand = new MiddlewareCreateLocationCommand();
92
        $middlewareCommand->id = Uuid::generate();
93
        $middlewareCommand->name = $command->name;
94
        $middlewareCommand->institution = $command->institution;
95
        $middlewareCommand->contactInformation = $command->contactInformation;
96
        $middlewareCommand->location = $command->location;
97
98
        $result = $this->commandService->execute($middlewareCommand);
99
100
        if (!$result->isSuccessful()) {
101
            $this->logger->critical(sprintf(
102
                'Creation of RA location "%s" for institution "%s" by user "%s" failed: "%s"',
103
                $middlewareCommand->name,
104
                $middlewareCommand->institution,
105
                $command->currentUserId,
106
                implode(", ", $result->getErrors())
107
            ));
108
        }
109
110
        return $result->isSuccessful();
111
    }
112
113
    public function change(ChangeRaLocationCommand $command)
114
    {
@@ 113-135 (lines=23) @@
110
        return $result->isSuccessful();
111
    }
112
113
    public function change(ChangeRaLocationCommand $command)
114
    {
115
        $middlewareCommand = new MiddlewareChangeRaLocationCommand();
116
        $middlewareCommand->id = $command->id;
117
        $middlewareCommand->name = $command->name;
118
        $middlewareCommand->institution = $command->institution;
119
        $middlewareCommand->contactInformation = $command->contactInformation;
120
        $middlewareCommand->location = $command->location;
121
122
        $result = $this->commandService->execute($middlewareCommand);
123
124
        if (!$result->isSuccessful()) {
125
            $this->logger->critical(sprintf(
126
                'Changing of RA location "%s" for institution "%s" by user "%s" failed: "%s"',
127
                $middlewareCommand->name,
128
                $middlewareCommand->institution,
129
                $command->currentUserId,
130
                implode(", ", $result->getErrors())
131
            ));
132
        }
133
134
        return $result->isSuccessful();
135
    }
136
137
    /**
138
     * @param RemoveRaLocationCommand $command