PHP Class RestComponent, cakephp-rest-plugin

Inheritance: extends Object
Afficher le fichier Open project: kvz/cakephp-rest-plugin

Méthodes publiques

Свойство Type Description
$Controller
$codes
$isActive string Should the rest plugin be active?
$postData
$settings

Protected Properties

Свойство Type Description
$_RestLog
$_View
$_aborting
$_credentials
$_feedback
$_logData

Méthodes publiques

Méthode Description
RestLog ( ) : object Return an instance of the log model
View ( boolean $object = true, string $ext = null ) : mixed Returns either string or reference to active View object
__call ( string $name, array $arguments ) Catch & fire callbacks. You can map callbacks to different places using the value parts in $this->settings['callbacks'].
__construct ( ComponentCollection $collection, $settings = [] )
abort ( $params = [], $data = [] ) Could be called by e.g. ->redirect to dump an error & stop further execution.
beforeRedirect ( Controller $Controller, $url, $status = null, $exit = true )
beforeRender ( Controller $Controller ) : Collects viewVars, reformats, and makes them available as viewVar: response for use in REST serialization
controllers ( boolean $cached = true ) : array Returns a list of Controllers where Rest component has been activated uses Cache::read & Cache::write by default to tackle performance issues.
credentials ( $set = false ) : Sets or returns credentials as found in the 'Authorization' header sent by the client.
debug ( $format, $arg1 = null, $arg2 = null )
error ( $format, $arg1 = null, $arg2 = null )
getFeedBack ( boolean $format = false ) : array Returns (optionally) formatted feedback.
headers ( $ext = null ) : Set content-type headers based on extension
info ( $format, $arg1 = null, $arg2 = null )
initialize ( Controller $Controller )
inject ( array $take, array $viewVars ) : array Reformats data according to Xpaths in $take
isActive ( )
log ( mixed $key, mixed $val = null, $scope = null ) : boolean log(true) writes log to disk. otherwise stores key-value pairs in memory for later saving. Can also work recursively by giving an array as the key
numeric ( array $array = [] ) : boolean Determines is an array is numerically indexed
ratelimit ( $time, $max ) : Works together with Logging to ratelimit incomming requests by identfield
response ( array $data = [] ) : array Get an array of everything that needs to go into the Xml / Json
shutdown ( Controller $Controller ) Write the accumulated logentry
startup ( Controller $Controller ) : Controls layout & view files
validate ( $format, $arg1 = null, $arg2 = null )
warning ( $format, $arg1 = null, $arg2 = null )

Méthodes protégées

Méthode Description
_modelizePost ( &$data ) : Prepares REST data for cake interaction

Method Details

RestLog() public méthode

Return an instance of the log model
public RestLog ( ) : object
Résultat object

View() public méthode

Returns either string or reference to active View object
public View ( boolean $object = true, string $ext = null ) : mixed
$object boolean
$ext string
Résultat mixed object or string

__call() public méthode

If the resolved callback is a string we assume it's in the controller.
public __call ( string $name, array $arguments )
$name string
$arguments array

__construct() public méthode

public __construct ( ComponentCollection $collection, $settings = [] )
$collection ComponentCollection

_modelizePost() protected méthode

Prepares REST data for cake interaction
protected _modelizePost ( &$data ) :
$data
Résultat

abort() public méthode

Could be called by e.g. ->redirect to dump an error & stop further execution.
public abort ( $params = [], $data = [] )
$params
$data

beforeRedirect() public méthode

public beforeRedirect ( Controller $Controller, $url, $status = null, $exit = true )
$Controller Controller

beforeRender() public méthode

Collects viewVars, reformats, and makes them available as viewVar: response for use in REST serialization
public beforeRender ( Controller $Controller ) :
$Controller Controller
Résultat

controllers() public méthode

Returns a list of Controllers where Rest component has been activated uses Cache::read & Cache::write by default to tackle performance issues.
public controllers ( boolean $cached = true ) : array
$cached boolean
Résultat array

credentials() public méthode

Have your client set a header like: Authorization: TRUEREST username=john&password=xxx&apikey=247b5a2f72df375279573f2746686daa< http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTAuthentication.html credentials(true) sets credentials credentials() returns full array credentials('username') returns username
public credentials ( $set = false ) :
Résultat

debug() public méthode

public debug ( $format, $arg1 = null, $arg2 = null )

error() public méthode

public error ( $format, $arg1 = null, $arg2 = null )

getFeedBack() public méthode

Returns (optionally) formatted feedback.
public getFeedBack ( boolean $format = false ) : array
$format boolean
Résultat array

headers() public méthode

Set content-type headers based on extension
public headers ( $ext = null ) :
$ext
Résultat

info() public méthode

public info ( $format, $arg1 = null, $arg2 = null )

initialize() public méthode

public initialize ( Controller $Controller )
$Controller Controller

inject() public méthode

Reformats data according to Xpaths in $take
public inject ( array $take, array $viewVars ) : array
$take array
$viewVars array
Résultat array

isActive() public méthode

public isActive ( )

log() public méthode

log(true) writes log to disk. otherwise stores key-value pairs in memory for later saving. Can also work recursively by giving an array as the key
public log ( mixed $key, mixed $val = null, $scope = null ) : boolean
$key mixed
$val mixed
Résultat boolean

numeric() public méthode

Determines is an array is numerically indexed
public numeric ( array $array = [] ) : boolean
$array array
Résultat boolean

ratelimit() public méthode

Works together with Logging to ratelimit incomming requests by identfield
public ratelimit ( $time, $max ) :
Résultat

response() public méthode

Get an array of everything that needs to go into the Xml / Json
public response ( array $data = [] ) : array
$data array optional. Data collected by cake
Résultat array

shutdown() public méthode

Write the accumulated logentry
public shutdown ( Controller $Controller )
$Controller Controller

startup() public méthode

Controls layout & view files
public startup ( Controller $Controller ) :
$Controller Controller
Résultat

validate() public méthode

public validate ( $format, $arg1 = null, $arg2 = null )

warning() public méthode

public warning ( $format, $arg1 = null, $arg2 = null )

Property Details

$Controller public_oe property

public $Controller

$_RestLog protected_oe property

protected $_RestLog

$_View protected_oe property

protected $_View

$_aborting protected_oe property

protected $_aborting

$_credentials protected_oe property

protected $_credentials

$_feedback protected_oe property

protected $_feedback

$_logData protected_oe property

protected $_logData

$codes public_oe property

public $codes

$isActive public_oe property

Should the rest plugin be active?
public string $isActive
Résultat string

$postData public_oe property

public $postData

$settings public_oe property

public $settings