Skip to content
Permalink
Browse files

Apply fixes from StyleCI

  • Loading branch information...
justmd5 authored and StyleCIBot committed Jun 25, 2018
1 parent fe84d2d commit 9d1937b1b643f66c52444647ecd079a1e81011a9
Showing with 17 additions and 17 deletions.
  1. +2 −2 phpunit.php
  2. +12 −11 src/Express/Express.php
  3. +3 −4 tests/NormalTest.php
@@ -4,6 +4,6 @@
* File: phpunit.php
* User: ding21st@gmail.com
* Date: 16/4/18
* Time: 下午4:06
* Time: 下午4:06.
*/
include __DIR__ . '/vendor/autoload.php';
include __DIR__.'/vendor/autoload.php';
@@ -4,19 +4,21 @@
* File: Express.php
* User: ding21st@gmail.com
* Date: 16/4/15
* Time: 下午4:39
* Time: 下午4:39.
*/
/**
* 查询快递接口
* Class Express
* Class Express.
*/
namespace JustMd5\Express;
use JustMd5\SimpleHttp\Http;
class Express
{
/**
*快递查询接口常量
*快递查询接口常量.
*/
const KUAIDI100 = 'http://www.kuaidi100.com';
@@ -28,17 +30,18 @@ class Express
*/
public static function getExpressInfo($ExpressNumber)
{
$keywords = self::getExpressName($ExpressNumber);
$keywords = self::getExpressName($ExpressNumber);
$ExpressNames = json_decode($keywords, true);
//未查看到快递信息返回false
if (empty($ExpressNames) || !isset($ExpressNames[0]['comCode'])) return false;
if (empty($ExpressNames) || !isset($ExpressNames[0]['comCode'])) {
return false;
}
//返回查询的信息
return Http::request('GET', self::KUAIDI100 . '/query', [
return Http::request('GET', self::KUAIDI100.'/query', [
'type' => $ExpressNames[0]['comCode'],
'postid' => $ExpressNumber
'postid' => $ExpressNumber,
]);
}
/**获得快递公司名字
@@ -49,8 +52,6 @@ public static function getExpressInfo($ExpressNumber)
*/
public static function getExpressName($ExpressNumber)
{
return Http::request('GET', self::KUAIDI100 . '/autonumber/auto', ['num' => $ExpressNumber]);
return Http::request('GET', self::KUAIDI100.'/autonumber/auto', ['num' => $ExpressNumber]);
}
}
?>
@@ -1,12 +1,13 @@
<?php
use JustMd5\Express\Express;
/**
* Created for express.
* File: NormalTest.php
* User: ding21st@gmail.com
* Date: 16/4/18
* Time: 下午4:09
* Time: 下午4:09.
*/
class NormalTest extends PHPUnit_Framework_TestCase
{
@@ -68,7 +69,5 @@ public function testDataInfo($InfoJsonObject)
$InfoArray = json_decode(json_encode($InfoJsonObject), true);
$this->assertArrayHasKey('data', $InfoArray, '数组中data信息不存在');
$this->assertNotEmpty($InfoArray['data'], '快递信息为空');
}
}
}

0 comments on commit 9d1937b

Please sign in to comment.
You can’t perform that action at this time.