You are here

public function HealthCheckController::healthCheckUrl in Health Check Url 8

Same name and namespace in other branches
  1. 8.3 src/Controller/HealthCheckController.php \Drupal\health_check_url\Controller\HealthCheckController::healthCheckUrl()
  2. 8.2 src/Controller/HealthCheckController.php \Drupal\health_check_url\Controller\HealthCheckController::healthCheckUrl()

Timestamp health check.

Return value

\Symfony\Component\HttpFoundation\Response Response.

File

src/Controller/HealthCheckController.php, line 34

Class

HealthCheckController
Controller for route that returns health check url type.

Namespace

Drupal\health_check_url\Controller

Code

public function healthCheckUrl() {
  $options = [
    "timestamp" => time(),
    "string" => $this->string,
    "stringWithTimestamp" => $this->string . ' - ' . time(),
    "stringWithDateTime" => $this->string . ' ' . strftime("at %T on %D"),
    "stringWithDateTimestamp" => $this->string . ' ' . strftime("at %T on %D") . ' (' . time() . ')',
  ];
  return $this
    ->buildResponse($options[$this->type]);
}