Proxy
in package
Table of Contents
Properties
- $_profiles : array<string|int, mixed>
- loaded profiles.
- $appContext : mixed
- $httpMessageCode : mixed
- $services : mixed
Methods
- build() : null|WFSRequest|WMSRequest|WMTSRequest
- Build OGC Request.
- clearCache() : false|string
- clearLayerCache() : bool
- clearProjectCache() : bool
- constructUrl() : mixed
- createVirtualProfile() : string
- Create a profile to cache things related to a project.
- getAppContext() : AppContextInterface
- Returns the appContext property.
- getEchoFromRequest() : string
- return the content that was logged for the (url, body) params using a md5 hash to search it in the log file.
- getHttpStatusMsg() : string
- Returns the HTTP Status Message.
- getRemoteData() : array{0: string, 1: string, 2: int}
- Get remote data from URL, with curl or internal php functions.
- getRemoteDataAsStream() : ProxyResponse
- Sends a request, and return the body response as a stream.
- getServices() : lizmapServices
- Returns the services property.
- hasEchoInBody() : bool
- check if $body contains a '__echo__=&' param.
- logRequestToEcho() : mixed
- Log the URL and its body in the 'echoproxy' log file We add a md5 hash of the string to help retrieving it later NOTE : currently we log only the url & body, thus it doesn't really need to be logged because the same url & body are needed to retreive the content but the function will be useful when it will log additionnal content.
- normalizeParams() : array<string|int, mixed>
- Normalize and filter request parameters.
- setAppContext() : mixed
- Sets the appContext property that contains the context of the application (Jelix or Test).
- setServices() : mixed
- Sets the services property that contains lizmap Services.
- buildHeaders() : mixed
- buildOptions() : array<string|int, mixed>
- createFileProfile() : mixed
- createSqLiteProfile() : mixed
- curlProxy() : array{0: string, 1: string, 2: int}
- declareRedisProfile() : mixed
- encodeHttpHeaders() : array<string|int, mixed>
- fileProxy() : array{0: string, 1: string, 2: int}
- userHttpHeader() : array<string|int, mixed>
Properties
$_profiles
loaded profiles.
protected
static array<string|int, mixed>
$_profiles
= array()
$appContext
protected
static mixed
$appContext
$httpMessageCode
protected
static mixed
$httpMessageCode
= array(200 => 'OK', 206 => 'Partial Content', 304 => 'Not modified', 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 500 => 'Internal Server Error', 501 => 'Not Implemented')
$services
protected
static mixed
$services
Methods
build()
Build OGC Request.
public
static build(Project $project, array<string|int, mixed> $params[, null|string $requestXml = null ]) : null|WFSRequest|WMSRequest|WMTSRequest
Parameters
- $project : Project
-
the project
- $params : array<string|int, mixed>
-
the params array
- $requestXml : null|string = null
-
the params array
Return values
null|WFSRequest|WMSRequest|WMTSRequestclearCache()
public
static clearCache(Repository $lrep) : false|string
Parameters
- $lrep : Repository
Return values
false|string —the repository key, or false if clear has failed
clearLayerCache()
public
static clearLayerCache(string $repository, string $project, string $layer) : bool
Parameters
- $repository : string
- $project : string
- $layer : string
Return values
bool —the layer cache has been clear or not
clearProjectCache()
public
static clearProjectCache(string $repository, string $project) : bool
Parameters
- $repository : string
- $project : string
Return values
bool —the project cache has been clear or not
constructUrl()
public
static constructUrl(mixed $params, mixed $services[, mixed $url = null ]) : mixed
Parameters
- $params : mixed
- $services : mixed
- $url : mixed = null
createVirtualProfile()
Create a profile to cache things related to a project.
public
static createVirtualProfile(string $repository, string $project, string $layers, string $crs) : string
The profile will store content into files, redis or sqlite, depending on the lizmap configuration
Parameters
- $repository : string
- $project : string
- $layers : string
- $crs : string
Return values
string —the profile name of the cache
getAppContext()
Returns the appContext property.
public
static getAppContext() : AppContextInterface
Return values
AppContextInterfacegetEchoFromRequest()
return the content that was logged for the (url, body) params using a md5 hash to search it in the log file.
public
static getEchoFromRequest(string $url, string $body) : string
Parameters
- $url : string
- $body : string
Tags
Return values
stringgetHttpStatusMsg()
Returns the HTTP Status Message.
public
static getHttpStatusMsg(int $code) : string
Parameters
- $code : int
-
the HTTP Status Code
Return values
string —$msg the HTTP Status Message
getRemoteData()
Get remote data from URL, with curl or internal php functions.
public
static getRemoteData(string $url[, null|array<string|int, mixed>|string $options = null ][, null|int $debug = null ][, string|array<string|int, string> $method = 'get' ]) : array{0: string, 1: string, 2: int}
Parameters
- $url : string
-
url of the remote data to fetch
- $options : null|array<string|int, mixed>|string = null
-
list of options for the http request. Option items can be: "method", "referer", "proxyHttpBackend", "headers" (array of headers strings), "body", "debug". If $options is a string, this should be the proxy method for compatibility to old calls. $proxyHttpBackend: method for the proxy : 'php' or 'curl', or ''. by default, it is the proxy method indicated into lizmapService
- $debug : null|int = null
-
deprecated. 0 or 1 to get debug log. if null, it uses the method indicated into lizmapService. it is ignored if $options is an array.
- $method : string|array<string|int, string> = 'get'
-
deprecated. the http method. it is ignored if $options is an array.
Return values
array{0: string, 1: string, 2: int} —Array containing data (0: string), mime type (1: string) and HTTP code (2: int)
getRemoteDataAsStream()
Sends a request, and return the body response as a stream.
public
static getRemoteDataAsStream(string $url[, null|array<string|int, mixed> $options = null ]) : ProxyResponse
Parameters
- $url : string
-
url of the remote data to fetch
- $options : null|array<string|int, mixed> = null
-
list of options for the http request. Option items can be: "method", "referer", "proxyHttpBackend", "headers" (array of headers strings), "body", "debug".
Return values
ProxyResponsegetServices()
Returns the services property.
public
static getServices() : lizmapServices
Return values
lizmapServiceshasEchoInBody()
check if $body contains a '__echo__=&' param.
public
static hasEchoInBody(string $body) : bool
Parameters
- $body : string
Return values
boollogRequestToEcho()
Log the URL and its body in the 'echoproxy' log file We add a md5 hash of the string to help retrieving it later NOTE : currently we log only the url & body, thus it doesn't really need to be logged because the same url & body are needed to retreive the content but the function will be useful when it will log additionnal content.
public
static logRequestToEcho(string $url, string $body) : mixed
Parameters
- $url : string
- $body : string
normalizeParams()
Normalize and filter request parameters.
public
static normalizeParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
array of parameters
Return values
array<string|int, mixed> —$data normalized and filtered array
setAppContext()
Sets the appContext property that contains the context of the application (Jelix or Test).
public
static setAppContext(AppContextInterface $appContext) : mixed
Parameters
- $appContext : AppContextInterface
setServices()
Sets the services property that contains lizmap Services.
public
static setServices(lizmapServices $services) : mixed
Parameters
- $services : lizmapServices
buildHeaders()
protected
static buildHeaders(string $url, array<string|int, mixed> $options) : mixed
Parameters
- $url : string
- $options : array<string|int, mixed>
Tags
buildOptions()
protected
static buildOptions(null|array<string|int, mixed>|string $options, string $method, null|int $debug) : array<string|int, mixed>
Parameters
- $options : null|array<string|int, mixed>|string
- $method : string
- $debug : null|int
Return values
array<string|int, mixed>createFileProfile()
protected
static createFileProfile(string $cacheDirectory, string $cacheName, int $cacheExpiration) : mixed
Parameters
- $cacheDirectory : string
- $cacheName : string
- $cacheExpiration : int
createSqLiteProfile()
protected
static createSqLiteProfile(string $cacheDirectory, string $cacheName, int $cacheExpiration, string $cacheDatabase) : mixed
Parameters
- $cacheDirectory : string
- $cacheName : string
- $cacheExpiration : int
- $cacheDatabase : string
curlProxy()
protected
static curlProxy(string $url, array<string|int, mixed> $options) : array{0: string, 1: string, 2: int}
Parameters
- $url : string
- $options : array<string|int, mixed>
Return values
array{0: string, 1: string, 2: int} —Array containing data (0: string), mime type (1: string) and HTTP code (2: int)
declareRedisProfile()
protected
static declareRedisProfile(lizmapServices $ser, string $cacheName, string $repository[, null|string $project = null ][, null|string $layers = null ][, null|string $crs = null ]) : mixed
Parameters
- $ser : lizmapServices
- $cacheName : string
- $repository : string
- $project : null|string = null
- $layers : null|string = null
- $crs : null|string = null
encodeHttpHeaders()
protected
static encodeHttpHeaders(array<string|int, mixed> $optionHeaders) : array<string|int, mixed>
Parameters
- $optionHeaders : array<string|int, mixed>
Return values
array<string|int, mixed>fileProxy()
protected
static fileProxy(string $url, array<string|int, mixed> $options) : array{0: string, 1: string, 2: int}
Parameters
- $url : string
- $options : array<string|int, mixed>
Return values
array{0: string, 1: string, 2: int} —Array containing data (0: string), mime type (1: string) and HTTP code (2: int)
userHttpHeader()
protected
static userHttpHeader() : array<string|int, mixed>