コード例 #1
0
ファイル: ResourceTest.php プロジェクト: robert-horvath/rest
 protected function setUp()
 {
     if ($this->getName() == 'testNotAvailableResource') {
         $resource = ['customers', '*****@*****.**', 'password'];
     } elseif ($this->getName() == 'testEmptyResource') {
         $resource = [];
     } elseif ($this->getName() == 'testInvalidResource') {
         $resource = ['invalid', '*****@*****.**', 'password'];
     } elseif ($this->getName() == 'testResourcePathWrong') {
         $resource = ['users', '*****@*****.**', 'passwords'];
     } else {
         $resource = ['users', '*****@*****.**', 'password'];
     }
     $this->restResource = RestResource::build($resource);
 }
コード例 #2
0
ファイル: index.php プロジェクト: robert-horvath/rest
<?php

ini_set('xdebug.var_display_max_depth', 10);
use RHo\HTTP\JwtConnection as HttpConnection;
use RHo\RESTful\Service as RestfulService;
use RHo\RESTful\Resource as RestfulResource;
$restfulService = new RestfulService(HttpConnection::build());
$restfulResource = RestfulResource::build($restfulService->resources());
if (false === $restfulResource || false === $restfulResource->findPath()) {
    $restfulService->sendClientErrorNotFound();
    exit;
}
$ctrlClassName = $restfulResource->ctrlClassName();
$ctrl = new $ctrlClassName();
var_dump($restfulResource, $ctrl);
コード例 #3
0
ファイル: Resource.php プロジェクト: robert-horvath/rest
 private static function initClassFromArray(Resource $me, array $array)
 {
     foreach ($array as $key => $value) {
         Resource::setPropertyIfExists($me, $key, $value);
     }
 }