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