Completed
Push — master ( 77ccc6...f13dc8 )
by Propa
05:09
created

helpers.php ➔ phone_format()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Propaganistas\LaravelPhone\PhoneNumber;
4
5
if (! function_exists('phone')) {
6
    /**
7
     * Get a PhoneNumber instance or a formatted string.
8
     *
9
     * @param string       $number
10
     * @param string|array $country
11
     * @param string       $format
12
     * @return string|Propaganistas\LaravelPhone\PhoneNumber
13
     */
14
    function phone($number, $country = [], $format = null)
15
    {
16 3
        $phone = PhoneNumber::make($number, $country);
17
18 3
        if (! is_null($format)) {
19 3
            return $phone->format($format);
20
        }
21
22 3
        return $phone;
23
    }
24
}
25