TrustedHostsTestController.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php
  2. 10 core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php
  3. 11.x core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php

Namespace

Drupal\trusted_hosts_test\Controller

File

core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php

View source
<?php

namespace Drupal\trusted_hosts_test\Controller;

use Symfony\Component\HttpFoundation\Request;

/**
 * Provides a test controller for testing the trusted hosts setting.
 */
class TrustedHostsTestController {
    
    /**
     * Creates a fake request and prints out its host.
     */
    public function fakeRequestHost() {
        $request = Request::create('/');
        return [
            '#markup' => 'Host: ' . $request->getHost(),
        ];
    }

}

Classes

Title Deprecated Summary
TrustedHostsTestController Provides a test controller for testing the trusted hosts setting.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.