Code Duplication    Length = 76-82 lines in 2 locations

src/Surfnet/StepupMiddlewareClientBundle/Identity/Dto/RaListing.php 1 location

@@ 24-99 (lines=76) @@
21
use Surfnet\StepupMiddlewareClientBundle\Dto\Dto;
22
use Symfony\Component\Validator\Constraints as Assert;
23
24
class RaListing implements Dto
25
{
26
    /**
27
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.id.must_not_be_blank")
28
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.id.must_be_string")
29
     *
30
     * @var string
31
     */
32
    public $identityId;
33
34
    /**
35
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.institution.must_not_be_blank")
36
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.institution.must_be_string")
37
     *
38
     * @var string
39
     */
40
    public $institution;
41
42
    /**
43
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.common_name.must_not_be_blank")
44
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.common_name.must_be_string")
45
     *
46
     * @var string
47
     */
48
    public $commonName;
49
50
    /**
51
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.email.must_not_be_blank")
52
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.email.must_be_string")
53
     *
54
     * @var string
55
     */
56
    public $email;
57
58
    /**
59
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.role.must_not_be_blank")
60
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.role.must_be_string")
61
     *
62
     * @var string
63
     */
64
    public $role;
65
66
    /**
67
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.location.must_not_be_blank")
68
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.location.must_be_string")
69
     *
70
     * @var string
71
     */
72
    public $location;
73
74
    /**
75
     * @Assert\NotBlank(message="middleware_client.dto.ra_listing.contact_information.must_not_be_blank")
76
     * @Assert\Type(type="string", message="middleware_client.dto.ra_listing.contact_information.must_be_string")
77
     *
78
     * @var string
79
     */
80
    public $contactInformation;
81
82
    /**
83
     * @param array $data
84
     * @return static
85
     */
86
    public static function fromData(array $data)
87
    {
88
        $raListing                     = new self();
89
        $raListing->identityId         = $data['identity_id'];
90
        $raListing->institution        = $data['institution'];
91
        $raListing->commonName         = $data['common_name'];
92
        $raListing->email              = $data['email'];
93
        $raListing->role               = $data['role'];
94
        $raListing->location           = $data['location'];
95
        $raListing->contactInformation = $data['contact_information'];
96
97
        return $raListing;
98
    }
99
}
100

src/Surfnet/StepupMiddlewareClientBundle/Identity/Dto/VerifiedSecondFactor.php 1 location

@@ 24-105 (lines=82) @@
21
use Surfnet\StepupMiddlewareClientBundle\Dto\Dto;
22
use Symfony\Component\Validator\Constraints as Assert;
23
24
class VerifiedSecondFactor implements Dto
25
{
26
    /**
27
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.id.must_not_be_blank")
28
     * @Assert\Type(type="string", message="middleware_client.dto.verified_second_factor.id.must_be_string")
29
     * @var string
30
     */
31
    public $id;
32
33
    /**
34
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.type.must_not_be_blank")
35
     * @Assert\Type(type="string", message="middleware_client.dto.verified_second_factor.type.must_be_string")
36
     * @var string
37
     */
38
    public $type;
39
40
    /**
41
     * @Assert\NotBlank(
42
     *     message="middleware_client.dto.verified_second_factor.second_factor_identifier.must_not_be_blank"
43
     * )
44
     * @Assert\Type(
45
     *     type="string",
46
     *     message="middleware_client.dto.verified_second_factor.second_factor_identifier.must_be_string"
47
     * )
48
     * @var string
49
     */
50
    public $secondFactorIdentifier;
51
52
    /**
53
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.registration_code.must_not_be_blank")
54
     * @Assert\Type(
55
     *     type="string",
56
     *     message="middleware_client.dto.verified_second_factor.registration_code.must_be_string"
57
     * )
58
     * @var string
59
     */
60
    public $registrationCode;
61
62
    /**
63
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.identity_id.must_not_be_blank")
64
     * @Assert\Type(
65
     *     type="string",
66
     *     message="middleware_client.dto.verified_second_factor.identity_id.must_be_string"
67
     * )
68
     * @var string
69
     */
70
    public $identityId;
71
72
    /**
73
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.institution.must_not_be_blank")
74
     * @Assert\Type(
75
     *     type="string",
76
     *     message="middleware_client.dto.verified_second_factor.institution.must_be_string"
77
     * )
78
     * @var string
79
     */
80
    public $institution;
81
82
    /**
83
     * @Assert\NotBlank(message="middleware_client.dto.verified_second_factor.common_name.must_not_be_blank")
84
     * @Assert\Type(
85
     *     type="string",
86
     *     message="middleware_client.dto.verified_second_factor.common_name.must_be_string"
87
     * )
88
     * @var string
89
     */
90
    public $commonName;
91
92
    public static function fromData(array $data)
93
    {
94
        $secondFactor = new self();
95
        $secondFactor->id = $data['id'];
96
        $secondFactor->type = $data['type'];
97
        $secondFactor->secondFactorIdentifier = $data['second_factor_identifier'];
98
        $secondFactor->registrationCode = $data['registration_code'];
99
        $secondFactor->identityId = $data['identity_id'];
100
        $secondFactor->institution = $data['institution'];
101
        $secondFactor->commonName = $data['common_name'];
102
103
        return $secondFactor;
104
    }
105
}
106