Open Data Catalog v2.0.0
Drupal\dkan_common\Service\Factory Class Reference

Public Member Functions

 newJsonResponse ($data=NULL, $status=200, array $headers=[], $json=FALSE)
 
 newHttpResponse ($content='', $status=200, array $headers=[])
 
 newServiceApiEngine (ContractsStorageInterface $storage, string $jsonSchema)
 

Detailed Description

Factory to generate DKAN API responses.

Coverage is ignored for this class since it's mostly a proxy to initialize new instances.

@codeCoverageIgnore

Definition at line 18 of file Factory.php.

Member Function Documentation

◆ newHttpResponse()

Drupal\dkan_common\Service\Factory::newHttpResponse (   $content = '',
  $status = 200,
array  $headers = [] 
)

Creates new HTTP Response.

Parameters
mixed$contentThe response content, see setContent()
int$statusThe response status code.
array$headersAn array of response headers.
Returns
static

Definition at line 48 of file Factory.php.

◆ newJsonResponse()

Drupal\dkan_common\Service\Factory::newJsonResponse (   $data = NULL,
  $status = 200,
array  $headers = [],
  $json = FALSE 
)

Creates a new json response.

Parameters
mixed$dataThe response data.
int$statusThe response status code.
array$headersAn array of response headers.
bool$jsonIf the data is already a JSON string.

Definition at line 32 of file Factory.php.

◆ newServiceApiEngine()

Drupal\dkan_common\Service\Factory::newServiceApiEngine ( ContractsStorageInterface  $storage,
string  $jsonSchema 
)

Creates new ServiceApiEngine.

Parameters
\Contracts\Storage$storageStorage.
string$jsonSchemaJson Schema.
Returns
\Sae\Sae New Service Api Engine.

Definition at line 63 of file Factory.php.