Skip to content

Commit

Permalink
Update style
Browse files Browse the repository at this point in the history
  • Loading branch information
shitoudev committed Nov 28, 2016
1 parent 6c3c110 commit 493f0a4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/PhoneLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class PhoneLocation
private $_fileHandle = null;
private $_fileSize = 0;

function __construct() {
function __construct()
{
$this->_fileHandle = fopen(self::DATA_FILE, 'r');
$this->_fileSize = filesize(self::DATA_FILE);
}
Expand All @@ -25,7 +26,8 @@ function __construct() {
* @return array
* @author shitoudev <[email protected]>
*/
public function find($phone) {
public function find($phone)
{
$item = [];
if (strlen($phone) != 11) return $item;
$telPrefix = substr($phone, 0, 7);
Expand Down Expand Up @@ -72,15 +74,16 @@ public function find($phone) {
* @return array
* @author shitoudev <[email protected]>
*/
private function phoneInfo($itemStr, $type) {
private function phoneInfo($itemStr, $type)
{
$typeStr = self::$spList[$type];
$itemArr = explode('|', $itemStr);
$data = ['province'=>$itemArr[0], 'city'=>$itemArr[1], 'postcode'=>$itemArr[2], 'tel_prefix'=>$itemArr[3], 'sp'=>$typeStr];
return $data;
}

function __destruct() {
function __destruct()
{
fclose($this->_fileHandle);
}
}
?>

0 comments on commit 493f0a4

Please sign in to comment.