Code Duplication    Length = 23-23 lines in 2 locations

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

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