Ejemplo n.º 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)));
 }
Ejemplo n.º 2
0
 /**
  * @param $id
  * @return CountriesResponse
  * @throws \Exception
  */
 public function countries($id)
 {
     return $this->server->get('countries')->execute(new NativeParameters(array('id' => $id)));
 }
Ejemplo n.º 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));
Ejemplo n.º 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));