Пример #1
0
 /**
  * @param $name
  * @param string $auth
  * @return Response
  * @throws \Exception
  */
 public function findname($name, $auth = '')
 {
     return $this->server->get('findname')->execute(new NativeParameters(array('name' => $name, 'auth' => $auth)));
 }
Пример #2
0
 /**
  * @param $id
  * @return CountriesResponse
  * @throws \Exception
  */
 public function countries($id)
 {
     return $this->server->get('countries')->execute(new NativeParameters(array('id' => $id)));
 }
Пример #3
0
<?php

require __DIR__ . '/vendor/autoload.php';
use Paro\Communicator\Adapter\Json\JsonAdapter;
use Paro\Communicator\Parameters\NativeParameters;
use Paro\Communicator\Server;
$vsServer = new Server(new JsonAdapter());
$vsServer->register(new \Paro\Endpoints\Biolib\FindName\FindName(), 'findname', function (\Paro\Communicator\Parameters\ParametersInterface $params) {
    throw new Exception('error on the server');
    return new \Paro\Endpoints\Response('aaaa');
});
//echo($vsServer->get('cancelorder')->execute(new NativeParameters($_GET, $_POST)));
echo $vsServer->get($_GET['service'])->execute(new NativeParameters($_GET, $_POST));
Пример #4
0
<?php

require __DIR__ . '/vendor/autoload.php';
use Paro\Communicator\Adapter\Json\JsonAdapter;
use Paro\Communicator\Parameters\NativeParameters;
use Paro\Communicator\Server;
use Paro\Endpoints\Order\CancelOrder\CancelOrder;
use Paro\Endpoints\Order\CancelOrder\CancelOrderResponse;
$vsServer = new Server(new JsonAdapter());
$vsServer->register(new CancelOrder(), 'cancelorder', function (\Paro\Communicator\Parameters\ParametersInterface $params) {
    //do something clever
    $return = false;
    if ($params->isDefined('name')) {
        $return = $params->getParameter('name') . ' processed on server at ' . time();
    }
    return new CancelOrderResponse($return);
});
echo $vsServer->get($_GET['service'])->execute(new NativeParameters($_GET, $_POST));