phramework doc
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Phramework
    • Authentication
    • Database
      • Operations
    • Exceptions
    • Extensions
    • Models
    • URIStrategy
    • Validate
    • Viewers

Classes

  • Cache
  • Compress
  • Email
  • Execute
  • Filter
  • Language
  • Operator
  • Request
  • Response
  • Upload
  • Util

Class Request

Request related functions

Namespace: Phramework\Models
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since 0
Located at Models/Request.php

Methods summary

public static object
# checkPermission( integer $userId = false )

Check if current request is authenticated

Check if current request is authenticated

Optionaly it checks the authenticated user has a specific user_id

Parameters

$userId
[Optional] Check if current user has the same id with $userId

Returns

object
Returns the user object

Throws

Phramework\Exceptions\PermissionException
Phramework\Exceptions\UnauthorizedException
public static
# requireParameters( array|object $parameters, string|array $required )

Check if required parameters are set

Check if required parameters are set

Parameters

$parameters
Request's parameters
$required
The required parameters

Throws

Phramework\Exceptions\MissingParametersException
public static string|integer
# resourceId( array|object $parameters, boolean $UINTEGER = true )

Require id parameter if it's set else return NULL, it uses resource_id or id parameter if available

Require id parameter if it's set else return NULL, it uses resource_id or id parameter if available

Parameters

$parameters
The request parameters
$UINTEGER
[Optional], Check id's type to be unsigned integer

Returns

string|integer

Returns the id or NULL if not set, if $UINTEGER the returned value will be converted to unsigned integer

Throws

Phramework\Exceptions\IncorrectParameters
When value is not correct
public static
# requireId( array|object $parameters, boolean $UINTEGER = true )

Require id parameter, it uses resource_id or id parameter if available

Require id parameter, it uses resource_id or id parameter if available

Parameters

$parameters
The request paramters
$UINTEGER
[Optional], Check id's type to be unsigned integer, default is true

Throws

Phramework\Exceptions\IncorrectParameters
When value is not correct
Phramework\Exceptions\MissingParametersException

When id is missing if $UINTEGER the returned value will be converted to unsigned integer

public static array
# parseModel( array|object $parameters, array $model )

Required required values and parse provided parameters into an array Validate the provided request model and return the

Required required values and parse provided parameters into an array Validate the provided request model and return the

Deprecated

since 1.0.0

Parameters

$parameters
$model

Returns

array
Return the keys => values collection

Uses

\Phramework\Models\Request::requireParameters
public static array
# headers( )

Get the headers send with client's HTTP Request

Get the headers send with client's HTTP Request

Returns

array
Return the array with the headers (indexes in lowercase)

Constants summary

string HEADER_CONTENT_TYPE
# 'Content-Type'
string HEADER_ACCEPT
# 'Accept'
phramework doc API documentation generated by ApiGen