| Total Complexity | 6 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Parser |
||
| 14 | { |
||
| 15 | public $country; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * CarpCai <2018/12/1 10:46 PM> |
||
| 19 | * @param $addressString |
||
| 20 | * @param string $country |
||
| 21 | * @return AddressStruct |
||
| 22 | */ |
||
| 23 | public function __construct($country = AddressStruct::US) |
||
| 26 | } |
||
| 27 | |||
| 28 | public function setCountry($country) |
||
| 29 | { |
||
| 30 | if (in_array($country, [AddressStruct::US])) { |
||
| 31 | $this->country = AddressStruct::US; |
||
| 32 | return $this; |
||
| 33 | } |
||
| 34 | return $this; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * |
||
| 39 | * CarpCai <2018/12/1 10:20 PM> |
||
| 40 | */ |
||
| 41 | static function newParse($addressString, $country = AddressStruct::US) |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * CarpCai <2018/12/1 10:19 PM> |
||
| 50 | */ |
||
| 51 | public function parse($addressString) |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * CarpCai <2018/12/1 10:46 PM> |
||
| 58 | * @param $addressString |
||
| 59 | * @param string $country |
||
| 60 | * @return AddressStruct |
||
| 61 | */ |
||
| 62 | private function _parse($addressString, $country = AddressStruct::US) |
||
| 66 | } |
||
| 67 | } |
||
| 68 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.