Documentation

RepoTrait

A common (mostly boiler plate) code for classes implementing the RepoInterface.

Tags
author

zozlak

Table of Contents

Properties

$baseUrl  : string
Repository REST API base URL
$headers  : Schema
An object providing mappings of repository REST API parameters to HTTP headers used by a given repository instance.
$queryLog  : AbstractLogger|null
$schema  : Schema
An object providing mappings of repository concepts to RDF properties used to denote them by a given repository instance.

Methods

getBaseUrl()  : string
Returns the repository REST API base URL.
getHeaderName()  : string
Returns an HTTP header name to be used to pass a given information in the repository request.
getResourceById()  : RepoResourceInterface
Tries to find a repository resource with a given id.
getSchema()  : Schema
Returns the `Schema` object defining repository entities to RDF property mappings.
setQueryLog()  : void
Sets a search queries logger
sortMatchingResources()  : void

Properties

$baseUrl

Repository REST API base URL

private string $baseUrl

$headers

An object providing mappings of repository REST API parameters to HTTP headers used by a given repository instance.

private Schema $headers

$queryLog

private AbstractLogger|null $queryLog

$schema

An object providing mappings of repository concepts to RDF properties used to denote them by a given repository instance.

private Schema $schema

Methods

getBaseUrl()

Returns the repository REST API base URL.

public getBaseUrl() : string
Return values
string

getHeaderName()

Returns an HTTP header name to be used to pass a given information in the repository request.

public getHeaderName(string $purpose) : string
Parameters
$purpose : string
Return values
string

getResourceById()

Tries to find a repository resource with a given id.

public getResourceById(string $id[, string $class = null ]) : RepoResourceInterface

Throws an error on failure.

Parameters
$id : string
$class : string = null

an optional class of the resulting object representing the resource (to be used by extension libraries)

Return values
RepoResourceInterface

getSchema()

Returns the `Schema` object defining repository entities to RDF property mappings.

public getSchema() : Schema
Return values
Schema

setQueryLog()

Sets a search queries logger

public setQueryLog(AbstractLogger $log) : void
Parameters
$log : AbstractLogger

sortMatchingResources()

private sortMatchingResources(array<string|int, resource> &$resources, string $searchOrderProp) : void
Parameters
$resources : array<string|int, resource>
$searchOrderProp : string

        
On this page

Search results