Code Duplication    Length = 23-23 lines in 2 locations

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

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