Code Duplication    Length = 23-23 lines in 2 locations

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

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