PHP Класс RestComponent, cakephp-rest-plugin

Наследование: extends Object
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$Controller
$codes
$isActive string Should the rest plugin be active?
$postData
$settings

Защищенные свойства (Protected)

Свойство Тип Описание
$_RestLog
$_View
$_aborting
$_credentials
$_feedback
$_logData

Открытые методы

Метод Описание
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 )

Защищенные методы

Метод Описание
_modelizePost ( &$data ) : Prepares REST data for cake interaction

Описание методов

RestLog() публичный Метод

Return an instance of the log model
public RestLog ( ) : object
Результат object

View() публичный Метод

Returns either string or reference to active View object
public View ( boolean $object = true, string $ext = null ) : mixed
$object boolean
$ext string
Результат mixed object or string

__call() публичный Метод

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 __construct ( ComponentCollection $collection, $settings = [] )
$collection ComponentCollection

_modelizePost() защищенный Метод

Prepares REST data for cake interaction
protected _modelizePost ( &$data ) :
$data
Результат

abort() публичный Метод

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

beforeRedirect() публичный Метод

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

beforeRender() публичный Метод

Collects viewVars, reformats, and makes them available as viewVar: response for use in REST serialization
public beforeRender ( Controller $Controller ) :
$Controller Controller
Результат

controllers() публичный Метод

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
Результат array

credentials() публичный Метод

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 ) :
Результат

debug() публичный Метод

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

error() публичный Метод

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

getFeedBack() публичный Метод

Returns (optionally) formatted feedback.
public getFeedBack ( boolean $format = false ) : array
$format boolean
Результат array

headers() публичный Метод

Set content-type headers based on extension
public headers ( $ext = null ) :
$ext
Результат

info() публичный Метод

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

initialize() публичный Метод

public initialize ( Controller $Controller )
$Controller Controller

inject() публичный Метод

Reformats data according to Xpaths in $take
public inject ( array $take, array $viewVars ) : array
$take array
$viewVars array
Результат array

isActive() публичный Метод

public isActive ( )

log() публичный Метод

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
Результат boolean

numeric() публичный Метод

Determines is an array is numerically indexed
public numeric ( array $array = [] ) : boolean
$array array
Результат boolean

ratelimit() публичный Метод

Works together with Logging to ratelimit incomming requests by identfield
public ratelimit ( $time, $max ) :
Результат

response() публичный Метод

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
Результат array

shutdown() публичный Метод

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

startup() публичный Метод

Controls layout & view files
public startup ( Controller $Controller ) :
$Controller Controller
Результат

validate() публичный Метод

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

warning() публичный Метод

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

Описание свойств

$Controller публичное свойство

public $Controller

$_RestLog защищенное свойство

protected $_RestLog

$_View защищенное свойство

protected $_View

$_aborting защищенное свойство

protected $_aborting

$_credentials защищенное свойство

protected $_credentials

$_feedback защищенное свойство

protected $_feedback

$_logData защищенное свойство

protected $_logData

$codes публичное свойство

public $codes

$isActive публичное свойство

Should the rest plugin be active?
public string $isActive
Результат string

$postData публичное свойство

public $postData

$settings публичное свойство

public $settings