Code Duplication    Length = 11-12 lines in 2 locations

src/PhoneNumber.php 2 locations

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