Code Duplication    Length = 20-21 lines in 2 locations

src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php 1 location

@@ 75-95 (lines=21) @@
72
        $this->logger = $logger;
73
    }
74
75
    public function revoke(RevokeSecondFactorCommand $command)
76
    {
77
        $middlewareCommand                 = new RevokeRegistrantsSecondFactorCommand();
78
        $middlewareCommand->secondFactorId = $command->secondFactorId;
79
        $middlewareCommand->identityId     = $command->identityId;
80
        $middlewareCommand->authorityId    = $command->currentUserId;
81
82
        $result = $this->commandService->execute($middlewareCommand);
83
84
        if (!$result->isSuccessful()) {
85
            $this->logger->critical(sprintf(
86
                'Revocation of Second Factor "%s" of Identity "%s" by user "%s" failed: "%s"',
87
                $middlewareCommand->secondFactorId,
88
                $middlewareCommand->identityId,
89
                $middlewareCommand->authorityId,
90
                implode(", ", $result->getErrors())
91
            ));
92
        }
93
94
        return $result->isSuccessful();
95
    }
96
97
    /**
98
     * @param SearchRaSecondFactorsCommand $command

src/Surfnet/StepupRa/RaBundle/Service/RaService.php 1 location

@@ 48-67 (lines=20) @@
45
        $this->logger = $logger;
46
    }
47
48
    public function amendRegistrationAuthorityInformation(AmendRegistrationAuthorityInformationCommand $command)
49
    {
50
        $apiCommand = new AmendRegistrationAuthorityInformationApiCommand();
51
        $apiCommand->identityId = $command->identityId;
52
        $apiCommand->location = $command->location;
53
        $apiCommand->contactInformation = $command->contactInformation;
54
        $apiCommand->raInstitution = $command->institution;
55
56
        $result = $this->commandService->execute($apiCommand);
57
58
        if (!$result->isSuccessful()) {
59
            $this->logger->error(sprintf(
60
                "Amending of registration authority %s's information failed: '%s'",
61
                $apiCommand->identityId,
62
                implode("', '", $result->getErrors())
63
            ));
64
        }
65
66
        return $result->isSuccessful();
67
    }
68
69
    public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command)
70
    {