PHP Class SimpleRoute, simpletest

Released under GPLv3 license; see LICENSE.
Inheritance: extends BaseRoute
显示文件 Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( SimpleUrl $url ) Sets the target URL.
createConnection ( string $method, integer $timeout ) : SimpleSocket Opens a socket to the route.
getUrl ( ) : SimpleUrl Resource name.

Protected Methods

Method Description
createSocket ( string $scheme, string $host, integer $port, integer $timeout ) : SimpleSocket/SimpleSecureSocket Factory for socket.
getHostLine ( ) : string Creates the host part of the request.
getRequestLine ( string $method ) : string Creates the first line which is the actual request.

Method Details

__construct() public method

Sets the target URL.
public __construct ( SimpleUrl $url )
$url SimpleUrl URL as object.

createConnection() public method

Opens a socket to the route.
public createConnection ( string $method, integer $timeout ) : SimpleSocket
$method string HTTP request method, usually GET.
$timeout integer Connection timeout.
return SimpleSocket New socket.

createSocket() protected method

Factory for socket.
protected createSocket ( string $scheme, string $host, integer $port, integer $timeout ) : SimpleSocket/SimpleSecureSocket
$scheme string Protocol to use.
$host string Hostname to connect to.
$port integer Remote port.
$timeout integer Connection timeout.
return SimpleSocket/SimpleSecureSocket

getHostLine() protected method

Creates the host part of the request.
protected getHostLine ( ) : string
return string Host line content.

getRequestLine() protected method

Creates the first line which is the actual request.
protected getRequestLine ( string $method ) : string
$method string HTTP request method, usually GET.
return string Request line content.

getUrl() public method

Resource name.
public getUrl ( ) : SimpleUrl
return SimpleUrl Current url.