Class ServerRequestFactory

Factory for making ServerRequest instances.

This subclass adds in CakePHP specific behavior to populate the basePath and webroot attributes. Furthermore the Uri's path is corrected to only contain the 'virtual' path for the request.

Zend\Diactoros\ServerRequestFactory
Extended by Cake\Http\ServerRequestFactory
Abstract
Namespace: Cake\Http
Location: Http/ServerRequestFactory.php

Method Summary

  • fromGlobals() public static
  • getBase() protected static
    Calculate the base directory and webroot directory.
  • updatePath() protected static
    Updates the request URI to remove the base directory.

Method Detail

fromGlobals()source public static

fromGlobals( array $server null , array $query null , array $body null , array $cookies null , array $files null )

getBase()source protected static

getBase( Psr\Http\Message\ServerRequestInterface $request )

Calculate the base directory and webroot directory.

This code is a copy/paste from Cake\Network\Request::_base()

Parameters

Psr\Http\Message\ServerRequestInterface $request
The request.

Returns

array
An array containing the [baseDir, webroot]

updatePath()source protected static

updatePath( string $base , Psr\Http\Message\ServerRequestInterface $request )

Updates the request URI to remove the base directory.

Parameters

string $base
The base path to remove.
Psr\Http\Message\ServerRequestInterface $request
The request to modify.

Returns

Psr\Http\Message\ServerRequestInterface
The modified request.

© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.3/class-Cake.Http.ServerRequestFactory.html