You are here

public function ProdCheckResource::get in Production check & Production monitor 8

Responds to POST requests.

Returns a resource for the prod check report

Return value

\Drupal\rest\ResourceResponse The response containing the log entry.

Throws

\Symfony\Component\HttpKernel\Exception\HttpException

File

modules/prod_check_rest/src/Plugin/rest/resource/ProdCheckResource.php, line 32

Class

ProdCheckResource
Provides a resource for the prod check report

Namespace

Drupal\prod_check_rest\Plugin\rest\resource

Code

public function get() {

  // Some checks might render or do things that we can not properly
  // collect cache ability metadata for. So, run it in our own render
  // context.
  $context = new RenderContext();
  $result = \Drupal::service('renderer')
    ->executeInRenderContext($context, function () {

    /** @var Rest $rest_processor */
    $rest_processor = \Drupal::service('plugin.manager.prod_check_processor')
      ->createInstance('rest');
    return $rest_processor
      ->requirements();
  });
  $response = $result;
  return new ResourceResponse($response, 200);
}