You are here

public function NspiController::spiDefinition in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 tests/modules/src/Controller/NspiController.php \Drupal\acquia_connector_test\Controller\NspiController::spiDefinition()
  2. 3.x tests/modules/src/Controller/NspiController.php \Drupal\acquia_connector_test\Controller\NspiController::spiDefinition()

Return spi definition.

Parameters

\GuzzleHttp\Psr7\Request $request: Request.

string $version: Version.

Return value

\GuzzleHttp\Psr7\Response JsonResponse.

File

tests/modules/src/Controller/NspiController.php, line 305

Class

NspiController
Class NspiController.

Namespace

Drupal\acquia_connector_test\Controller

Code

public function spiDefinition(Request $request, $version) {
  $vars = [
    'test_variable_1' => [
      'optional' => FALSE,
      'description' => 'test_variable_1',
    ],
    'test_variable_2' => [
      'optional' => TRUE,
      'description' => 'test_variable_2',
    ],
    'test_variable_3' => [
      'optional' => TRUE,
      'description' => 'test_variable_3',
    ],
  ];
  $data = [
    'drupal_version' => (string) $version,
    'timestamp' => (string) (\Drupal::time()
      ->getRequestTime() + 9),
    'acquia_spi_variables' => $vars,
  ];
  return new Response(200, [], json_encode($data));
}