src/Jaspersoft/Service/RepositoryService.php
public function getResource($uri, $expanded = false)
    {
        if (!$expanded)
            $url = self::makeUrl(null, $uri);
        else
            $url = self::makeUrl(null, $uri, true);

        // If getting the root folder, we must use repository.folder+json
        if ($uri == "/")
            $type = "application/repository.folder+json";
        else
            $type = "application/repository.file+json";

        $response = $this->service->makeRequest($url, array(200, 204), 'GET', null, true, 'application/json', $type);

        $data = $response['body'];
        $headers = $response['headers'];
        $content_type = array_values(preg_grep("#repository\.(.*)\+#", $headers));
        preg_match("#repository\.(.*)\+#", $content_type[0], $resource_type);

        $class = RESOURCE_NAMESPACE . '\\' . ucfirst($resource_type[1]);
        if (class_exists($class) && is_subclass_of($class, RESOURCE_NAMESPACE . '\\Resource')) {
            return $class::createFromJSON(json_decode($data, true), $class);
        } else {
            return Resource::createFromJSON(json_decode($data, true));
        }
    }
public function getResource($uri, $expanded = false)
    {
        if (!$expanded)
            $url = self::makeUrl(null, $uri);
        else
            $url = self::makeUrl(null, $uri, true);

        // If getting the root folder, we must use repository.folder+json
        if ($uri == "/")
            $type = "application/repository.folder+json";
        else
            $type = "application/repository.file+json";

        $response = $this->service->makeRequest($url, array(200, 204), 'GET', null, true, 'application/json', $type);

        $data = $response['body'];
        $headers = $response['headers'];
        $content_type = array_values(preg_grep("#repository\.(.*)\+#", $headers));
        preg_match("#repository\.(.*)\+#", $content_type[0], $resource_type);

        $class = RESOURCE_NAMESPACE . '\\' . ucfirst($resource_type[1]);
        if (class_exists($class) && is_subclass_of($class, RESOURCE_NAMESPACE . '\\Resource')) {
            return $class::createFromJSON(json_decode($data, true), $class);
        } else {
            return Resource::createFromJSON(json_decode($data, true));
        }
    }
public function getResource ( $ uri , $ expanded = false ) { if ( ! $ expanded ) $ url = self :: makeUrl ( null , $ uri ) ; else $ url = self :: makeUrl ( null , $ uri , true ) ; // If getting the root folder, we must use repository.folder+json if ( $ uri == "/" ) $ type = "application/repository.folder+json" ; else $ type = "application/repository.file+json" ; $ response = $ this -> service -> makeRequest ( $ url , array ( 200 , 204 ) , 'GET' , null , true , 'application/json' , $ type ) ; $ data = $ response [ 'body' ] ; $ headers = $ response [ 'headers' ] ; $ content_type = array_values ( preg_grep ( "#repository\.(.*)\+#" , $ headers ) ) ; preg_match ( "#repository\.(.*)\+#" , $ content_type [ 0 ] , $ resource_type ) ; $ class = RESOURCE_NAMESPACE . '\\' . ucfirst ( $ resource_type [ 1 ] ) ; if ( class_exists ( $ class ) && is_subclass_of ( $ class , RESOURCE_NAMESPACE . '\\Resource' ) ) { return $ class :: createFromJSON ( json_decode ( $ data , true ) , $ class ) ; } else { return Resource :: createFromJSON ( json_decode ( $ data , true ) ) ; } }
Get resource by URI

@param string $uri
@param bool $expanded Return subresources as definitions and not references?
@return \Jaspersoft\Dto\Resource\Resource
Get resource by URI