Code Duplication    Length = 8-9 lines in 11 locations

src/Bpost/Order/Address.php 6 locations

@@ 49-56 (lines=8) @@
46
     * @param string $box
47
     * @throws BpostInvalidLengthException
48
     */
49
    public function setBox($box)
50
    {
51
        $length = 8;
52
        if (mb_strlen($box) > $length) {
53
            throw new BpostInvalidLengthException('box', mb_strlen($box), $length);
54
        }
55
        $this->box = $box;
56
    }
57
58
    /**
59
     * @return string
@@ 70-77 (lines=8) @@
67
     * @param string $countryCode
68
     * @throws BpostInvalidLengthException
69
     */
70
    public function setCountryCode($countryCode)
71
    {
72
        $length = 2;
73
        if (mb_strlen($countryCode) > $length) {
74
            throw new BpostInvalidLengthException('countryCode', mb_strlen($countryCode), $length);
75
        }
76
        $this->countryCode = strtoupper($countryCode);
77
    }
78
79
    /**
80
     * @return string
@@ 91-98 (lines=8) @@
88
     * @param string $locality
89
     * @throws BpostInvalidLengthException
90
     */
91
    public function setLocality($locality)
92
    {
93
        $length = 40;
94
        if (mb_strlen($locality) > $length) {
95
            throw new BpostInvalidLengthException('locality', mb_strlen($locality), $length);
96
        }
97
        $this->locality = $locality;
98
    }
99
100
    /**
101
     * @return string
@@ 112-119 (lines=8) @@
109
     * @param string $number
110
     * @throws BpostInvalidLengthException
111
     */
112
    public function setNumber($number)
113
    {
114
        $length = 8;
115
        if (mb_strlen($number) > $length) {
116
            throw new BpostInvalidLengthException('number', mb_strlen($number), $length);
117
        }
118
        $this->number = $number;
119
    }
120
121
    /**
122
     * @return string
@@ 133-140 (lines=8) @@
130
     * @param string $postalCode
131
     * @throws BpostInvalidLengthException
132
     */
133
    public function setPostalCode($postalCode)
134
    {
135
        $length = 40;
136
        if (mb_strlen($postalCode) > $length) {
137
            throw new BpostInvalidLengthException('postalCode', mb_strlen($postalCode), $length);
138
        }
139
        $this->postalCode = $postalCode;
140
    }
141
142
    /**
143
     * @return string
@@ 154-161 (lines=8) @@
151
     * @param string $streetName
152
     * @throws BpostInvalidLengthException
153
     */
154
    public function setStreetName($streetName)
155
    {
156
        $length = 40;
157
        if (mb_strlen($streetName) > $length) {
158
            throw new BpostInvalidLengthException('streetName', mb_strlen($streetName), $length);
159
        }
160
        $this->streetName = $streetName;
161
    }
162
163
    /**
164
     * @return string

src/Bpost/Order/Box/Option/Messaging.php 2 locations

@@ 52-60 (lines=9) @@
49
     * @param string $emailAddress
50
     * @throws BpostInvalidLengthException
51
     */
52
    public function setEmailAddress($emailAddress)
53
    {
54
        $length = 50;
55
        if (mb_strlen($emailAddress) > $length) {
56
            throw new BpostInvalidLengthException('emailAddress', mb_strlen($emailAddress), $length);
57
        }
58
59
        $this->emailAddress = $emailAddress;
60
    }
61
62
    /**
63
     * @return string
@@ 110-118 (lines=9) @@
107
     * @param string $mobilePhone
108
     * @throws BpostInvalidLengthException
109
     */
110
    public function setMobilePhone($mobilePhone)
111
    {
112
        $length = 20;
113
        if (mb_strlen($mobilePhone) > $length) {
114
            throw new BpostInvalidLengthException('mobilePhone', mb_strlen($mobilePhone), $length);
115
        }
116
117
        $this->mobilePhone = $mobilePhone;
118
    }
119
120
    /**
121
     * @return string

src/Bpost/Order/Customer.php 2 locations

@@ 76-83 (lines=8) @@
73
     * @param string $emailAddress
74
     * @throws BpostInvalidLengthException
75
     */
76
    public function setEmailAddress($emailAddress)
77
    {
78
        $length = 50;
79
        if (mb_strlen($emailAddress) > $length) {
80
            throw new BpostInvalidLengthException('emailAddress', mb_strlen($emailAddress), $length);
81
        }
82
        $this->emailAddress = $emailAddress;
83
    }
84
85
    /**
86
     * @return string
@@ 113-120 (lines=8) @@
110
     * @param string $phoneNumber
111
     * @throws BpostInvalidLengthException
112
     */
113
    public function setPhoneNumber($phoneNumber)
114
    {
115
        $length = 20;
116
        if (mb_strlen($phoneNumber) > $length) {
117
            throw new BpostInvalidLengthException('phoneNumber', mb_strlen($phoneNumber), $length);
118
        }
119
        $this->phoneNumber = $phoneNumber;
120
    }
121
122
    /**
123
     * @return string

src/Bpost/Order/Box/CustomsInfo/CustomsInfo.php 1 location

@@ 58-66 (lines=9) @@
55
     * @param string $contentDescription
56
     * @throws BpostInvalidLengthException
57
     */
58
    public function setContentDescription($contentDescription)
59
    {
60
        $length = 50;
61
        if (mb_strlen($contentDescription) > $length) {
62
            throw new BpostInvalidLengthException('contentDescription', mb_strlen($contentDescription), $length);
63
        }
64
65
        $this->contentDescription = $contentDescription;
66
    }
67
68
    /**
69
     * @return string