class Revoke extends Credential (View source)

Constants

RETURN_COUNT

These are the valid return types for commands

RETURN_BEFORE

RETURN_AFTER

Properties

protected $ridValidator from Command
protected $escapeValidator from Command
protected $formatter from Command
protected $formatters from Command
protected $tokens from Command

Methods

__construct(string $permission)

Creates a new statement, setting the $permission.

getSchema()

No description

andWhere(string $condition, string $value = null)

Sets a where token using the AND operator.

from Command
from(array $target, boolean $append = true)

Sets the token for the from clause. You can $append your values.

from Command
string
getRaw()

Returns the raw SQL query incapsulated by the current object.

from Command
array
getTokens()

Analyzing the command's SCHEMA, this method returns all the tokens allocable in the command.

from Command
array
getTokenValue(string $token)

Returns the value of a token.

from Command
orWhere(string $condition, string $value = null)

Sets a where token using the OR operator.

from Command
true
resetWhere()

Deletes all the WHERE conditions in the current command.

from Command
setFormatter(QueryInterface $formatter)

Sets the internal query formatter object.

from Command
where(string $condition, mixed $value = null, boolean $append = false, string $clause = "WHERE")

Adds a WHERE conditions into the current query.

from Command
boolean
canHydrate()

Returns whether this query, when executed, should have the collection hydrated.

from Command
returns($returns)

Sets the Returns token

from Command
array()
getValidReturnTypes()

Returns the array of valid params for the Return clause.

from Command
appendToken(string $token, mixed $values, boolean $first = false)

Appends a token to the query, without deleting existing values for the given $token.

from Command
appendTokenAsString(string $token, string $key, mixed $value)

Appends $value to the query $token, using $key to identify the $value in the token array.

from Command
appendTokenAsInteger(string $token, string $key, mixed $value)

Appends $value to the query $token.

from Command
mixed
checkToken(string $token)

Checks if a token is set, returning it if it is.

from Command
clearToken(string $token)

Clears the value of a token.

from Command
getFormatter()

Returns a brand new instance of a Formatter in order to format query tokens.

from Command
Array
getTokenFormatters()

Returns the formatters for this query's tokens.

Array
getTokenFormatter(string $token)

Returns the formatter for a particular token.

from Command
array
getTokenReplaces()

Returns the values to replace command's schema tokens.

from Command
string
getValidStatement()

Build the command replacing schema tokens with actual values and cleaning the command synthax.

from Command
string
formatWhereConditionWithMultipleTokens($condition, array $values, Escaper $validator)

Substitutes multiple tokens ($values) in the WHERE $condition.

from Command
string
replaceTokens(string $statement)

Replaces the tokens in the command's schema with their actual values in the current object.

from Command
true
setToken(string $token, string $tokenValue, boolean $append = false, boolean $first = false)

Sets a single value for a token,

from Command
true
setTokenValues($token, array $tokenValues, $append = true, $first = false)

Sets the values of a token, and can be appended with the given $append.

from Command
unsetToken(string $token)

Deletes a token.

from Command
string
tokenize(string $token)

Tokenizes a string.

from Command
permission(string $permission)

Sets a permission for the query.

on(string $resource)

Sets the $resource on which the credential is given.

to(string $role)

Sets the $role having the credential on a resource.

Details

__construct(string $permission)

Creates a new statement, setting the $permission.

Parameters

string $permission

protected getSchema()

Command andWhere(string $condition, string $value = null)

Sets a where token using the AND operator.

If the $condition contains a "?", it will be replaced by the $value.

Parameters

string $condition
string $value

Return Value

Command

Command from(array $target, boolean $append = true)

Sets the token for the from clause. You can $append your values.

Parameters

array $target
boolean $append

Return Value

Command

string getRaw()

Returns the raw SQL query incapsulated by the current object.

Return Value

string

array getTokens()

Analyzing the command's SCHEMA, this method returns all the tokens allocable in the command.

Return Value

array

array getTokenValue(string $token)

Returns the value of a token.

Parameters

string $token

Return Value

array

Command orWhere(string $condition, string $value = null)

Sets a where token using the OR operator.

If the $condition contains a "?", it will be replaced by the $value.

Parameters

string $condition
string $value

Return Value

Command

true resetWhere()

Deletes all the WHERE conditions in the current command.

Return Value

true

setFormatter(QueryInterface $formatter)

Sets the internal query formatter object.

Parameters

QueryInterface $formatter

where(string $condition, mixed $value = null, boolean $append = false, string $clause = "WHERE")

Adds a WHERE conditions into the current query.

Parameters

string $condition
mixed $value
boolean $append
string $clause

boolean canHydrate()

Returns whether this query, when executed, should have the collection hydrated.

The default is true

Return Value

boolean

returns($returns)

Sets the Returns token

Parameters

$returns

array() getValidReturnTypes()

Returns the array of valid params for the Return clause.

Use this function to support the Return clause by overriding and returing a list in the subclass

Return Value

array()

protected appendToken(string $token, mixed $values, boolean $first = false)

Appends a token to the query, without deleting existing values for the given $token.

Parameters

string $token
mixed $values
boolean $first

protected appendTokenAsString(string $token, string $key, mixed $value)

Appends $value to the query $token, using $key to identify the $value in the token array.

With this method you set a token value and can retrieve it by its key.

Parameters

string $token
string $key
mixed $value

protected appendTokenAsInteger(string $token, string $key, mixed $value)

Appends $value to the query $token.

Parameters

string $token
string $key
mixed $value

protected mixed checkToken(string $token)

Checks if a token is set, returning it if it is.

Parameters

string $token

Return Value

mixed

Exceptions

TokenNotFoundException

protected clearToken(string $token)

Clears the value of a token.

Parameters

string $token

protected QueryInterface getFormatter()

Returns a brand new instance of a Formatter in order to format query tokens.

Return Value

QueryInterface

protected Array getTokenFormatters()

Returns the formatters for this query's tokens.

Return Value

Array

protected Array getTokenFormatter(string $token)

Returns the formatter for a particular token.

Parameters

string $token

Return Value

Array

Exceptions

string

protected array getTokenReplaces()

Returns the values to replace command's schema tokens.

Return Value

array

protected string getValidStatement()

Build the command replacing schema tokens with actual values and cleaning the command synthax.

Return Value

string

protected string formatWhereConditionWithMultipleTokens($condition, array $values, Escaper $validator)

Substitutes multiple tokens ($values) in the WHERE $condition.

Parameters

$condition
array $values
Escaper $validator

Return Value

string

Exceptions

LogicException

protected string replaceTokens(string $statement)

Replaces the tokens in the command's schema with their actual values in the current object.

Parameters

string $statement

Return Value

string

true setToken(string $token, string $tokenValue, boolean $append = false, boolean $first = false)

Sets a single value for a token,

Parameters

string $token
string $tokenValue
boolean $append
boolean $first

Return Value

true

protected true setTokenValues($token, array $tokenValues, $append = true, $first = false)

Sets the values of a token, and can be appended with the given $append.

Parameters

$token
array $tokenValues
$append
$first

Return Value

true

protected unsetToken(string $token)

Deletes a token.

Parameters

string $token

protected string tokenize(string $token)

Tokenizes a string.

Parameters

string $token

Return Value

string

Credential permission(string $permission)

Sets a permission for the query.

Parameters

string $permission

Return Value

Credential

Credential on(string $resource)

Sets the $resource on which the credential is given.

Parameters

string $resource

Return Value

Credential

Credential to(string $role)

Sets the $role having the credential on a resource.

Parameters

string $role

Return Value

Credential