Code Duplication    Length = 11-12 lines in 2 locations

src/PhoneNumber.php 2 locations

@@ 173-183 (lines=11) @@
170
     * @return string
171
     * @throws \Propaganistas\LaravelPhone\Exceptions\CountryCodeException
172
     */
173
    public function formatForCountry($country)
174
    {
175
        if (! static::isValidCountryCode($country)) {
176
            throw CountryCodeException::invalid($country);
177
        }
178
179
        return $this->lib->formatOutOfCountryCallingNumber(
180
            $this->getPhoneNumberInstance(),
181
            $country
182
        );
183
    }
184
185
    /**
186
     * Format the phone number in a way that it can be dialled from the provided country using a cellphone.
@@ 193-204 (lines=12) @@
190
     * @return string
191
     * @throws \Propaganistas\LaravelPhone\Exceptions\CountryCodeException
192
     */
193
    public function formatForMobileDialingInCountry($country, $removeFormatting = false)
194
    {
195
        if (! static::isValidCountryCode($country)) {
196
            throw CountryCodeException::invalid($country);
197
        }
198
199
        return $this->lib->formatNumberForMobileDialing(
200
            $this->getPhoneNumberInstance(),
201
            $country,
202
            $removeFormatting
203
        );
204
    }
205
206
    /**
207
     * Get the phone number's country.