Code Duplication    Length = 11-12 lines in 2 locations

src/PhoneNumber.php 2 locations

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