本文整理汇总了PHP中Api::handle方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::handle方法的具体用法?PHP Api::handle怎么用?PHP Api::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::handle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHandlesGetRequestToLocateContainer
public function testHandlesGetRequestToLocateContainer()
{
$request = $this->getMockBuilder(HttpRequest::class)->disableOriginalConstructor()->getMock();
$requestUrl = $this->getMockBuilder(HttpRequestUrl::class)->disableOriginalConstructor()->getMock();
$requestUrl->method('getFirstComponent')->willReturn('containers');
$requestUrl->method('getSecondComponent')->willReturn('the-tracking-number');
$request->method('isGet')->willReturn(true);
$request->method('getUrl')->willReturn($requestUrl);
$trackingNumber = ContainerTrackingNumber::fromString('the-tracking-number');
$location = Location::fromCoordinates(Latitude::fromFloat(10.0), Longitude::fromFloat(20.0));
$this->reader->expects($this->once())->method('locateContainer')->with($trackingNumber)->willReturn($location);
$this->assertEquals('{"latitude":10,"longitude":20}', $this->api->handle($request));
}
示例2: Api
<?php
include "Api.php";
include "Parser/Json.php";
include "Parser/Xml.php";
include "Vo/ResponseVO.php";
$api = new Api();
$api->setType(Api::TYPE_XML);
$api->handle();
示例3: Api
<?php
namespace bgphp15\nameless;
require __DIR__ . '/src/autoload.php';
header('Content-type: application/json; charset=utf-8');
$api = new Api(new ContainerTrackingReader(), new ContainerTrackingWriter());
$api->handle(HttpRequest::fromSuperglobals());