PHP Класс Scalr\Api\Rest\Controller\ApiController

С версии: 5.4.0 (12.02.2015)
Автор: Vitaliy Demidov ([email protected])
Наследование: extends Scalr\Api\Rest\Controller\AbstractController
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$app Scalr\Api\Rest\ApiApplication Application instance

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

Метод Описание
__call ( $method, $args )
adapter ( string $name, string $scope = null, string $version = null ) : ApiEntityAdapter Gets a new Instance of the adapter
auditLog ( string $event, variadic $extra ) : boolean AuditLogger wrapper
checkPermissions ( $args ) Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
checkScopedPermissions ( string $resourceMnemonic, string $permissionMnemonic = null ) Checks whether the authenticated user either is authorized has permission to ACL Role
getApplication ( ) : ApiApplication Gets Application
getBareId ( object $object, string $item = null ) : mixed Gets bare id from request object
getCommonQueryParams ( ) : array Gets common query parameters
getEnvironment ( ) : Environment Gets Environment from the current request
getMaxResults ( ) : integer Gets the maximum records per page
getPageNum ( ) : integer Gets the number of the page
getPageOffset ( ) : integer Gets the page offset
getPagination ( integer $foundRows ) : Scalr\Api\DataType\Pagination Gets pagination object
getScope ( ) : string Gets current API request scope
getScopeCriteria ( string $scope = null, $strictToScope = false ) : array Gets criteria corresponding current API request scope
getUser ( ) : User Gets authenticated user
hasPermissions ( ) : boolean Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
params ( string $name = null, string $default = null ) : string | array Gets GET request parameter
result ( mixed $data ) : Scalr\Api\DataType\ResultEnvelope Gets result envelope for the response
resultList ( mixed $data, string | null $foundRows = null ) : Scalr\Api\DataType\ListResultEnvelope Gets the list result envelope for the response
setApplication ( ApiApplication $app ) : ApiController Sets API Application instance

Приватные методы

Метод Описание
generateLink ( array &$params, boolean $sort = false ) : string Generates link using specified query params
processCommonQueryParameters ( ) Processes and validates common query parameters from the request

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

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

public __call ( $method, $args )

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

Gets a new Instance of the adapter
public adapter ( string $name, string $scope = null, string $version = null ) : ApiEntityAdapter
$name string The name of the adapter
$scope string optional The scope of the adapter
$version string optional The version of the adapter
Результат Scalr\Api\DataType\ApiEntityAdapter Returns the instance of the specified adapter

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

AuditLogger wrapper
public auditLog ( string $event, variadic $extra ) : boolean
$event string Event name, aka tag
$extra variadic optional Array of additionally provided information
Результат boolean Whether operation was successful

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

checkPermissions(object $obj, bool $modify = false, $errorMessage='') checkPermissions(int $roleId, string $permissionId = null, $errorMessage='')
public checkPermissions ( $args )

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

Checks whether the authenticated user either is authorized has permission to ACL Role
public checkScopedPermissions ( string $resourceMnemonic, string $permissionMnemonic = null )
$resourceMnemonic string ACL resource name
$permissionMnemonic string optional ACL permission name

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

Gets Application
public getApplication ( ) : ApiApplication
Результат Scalr\Api\Rest\ApiApplication

getBareId() публичный статический Метод

Gets bare id from request object
public static getBareId ( object $object, string $item = null ) : mixed
$object object Request object
$item string optional Item name (image, role) or null, if object is target
Результат mixed

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

Gets common query parameters
public getCommonQueryParams ( ) : array
Результат array Returns array of common query parameters looks like [name => value]

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

Gets Environment from the current request
public getEnvironment ( ) : Environment
Результат Scalr\Model\Entity\Account\Environment

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

Gets the maximum records per page
public getMaxResults ( ) : integer
Результат integer Returns maximum records per page

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

Gets the number of the page
public getPageNum ( ) : integer
Результат integer Returns the number of the page

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

Gets the page offset
public getPageOffset ( ) : integer
Результат integer Returns page offset

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

Gets pagination object
public getPagination ( integer $foundRows ) : Scalr\Api\DataType\Pagination
$foundRows integer The number of records found
Результат Scalr\Api\DataType\Pagination Returns pagination object

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

Gets current API request scope
public getScope ( ) : string
Результат string Returns scope

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

Gets criteria corresponding current API request scope
public getScopeCriteria ( string $scope = null, $strictToScope = false ) : array
$scope string optional Scope override
Результат array Returns criteria

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

Gets authenticated user
public getUser ( ) : User
Результат Scalr\Model\Entity\Account\User

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

hasPermissions(object $obj, bool $modify = false) hasPermissions(int $roleId, string $permissionId = null)
public hasPermissions ( ) : boolean
Результат boolean Returns TRUE if the authenticated user has access or FALSE otherwise

params() закрытый публичный Метод

If common query parameter is used
final public params ( string $name = null, string $default = null ) : string | array
$name string The name of the parameter
$default string optional The default value of the parameter
Результат string | array Returns the value of the param. If the name is not specified it returns all query params

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

Gets result envelope for the response
public result ( mixed $data ) : Scalr\Api\DataType\ResultEnvelope
$data mixed The response data
Результат Scalr\Api\DataType\ResultEnvelope Returns result envelope object depends on specified data

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

Gets the list result envelope for the response
public resultList ( mixed $data, string | null $foundRows = null ) : Scalr\Api\DataType\ListResultEnvelope
$data mixed The list of the objects which should be responded with
$foundRows string | null optional The number of the found rows to inject Pagination into envelope
Результат Scalr\Api\DataType\ListResultEnvelope Returns list result

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

Sets API Application instance
public setApplication ( ApiApplication $app ) : ApiController
$app Scalr\Api\Rest\ApiApplication API Application instance
Результат ApiController

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

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

Application instance
protected ApiApplication,Scalr\Api\Rest $app
Результат Scalr\Api\Rest\ApiApplication