Conditions | 5 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php namespace Propaganistas\LaravelPhone\Traits; |
||
34 | 47 | protected static function parseTypes($types) |
|
35 | { |
||
36 | 47 | static::loadTypes(); |
|
37 | |||
38 | 47 | return Collection::make(is_array($types) ? $types : func_get_args()) |
|
39 | 47 | ->map(function ($type) { |
|
40 | // If the type equals a constant's value, just return it. |
||
41 | 47 | if (is_numeric($type) && in_array($type, static::$types)) { |
|
42 | 20 | return (int) $type; |
|
43 | } |
||
44 | |||
45 | // Otherwise we'll assume the type is the constant's name. |
||
46 | 44 | return Arr::get(static::$types, strtoupper($type)); |
|
47 | 47 | }) |
|
48 | 47 | ->reject(function ($value) { |
|
49 | 47 | return is_null($value) || $value === false; |
|
50 | 47 | })->toArray(); |
|
51 | } |
||
52 | |||
80 | } |