PHP Класс Authority\RuleRepository

Наследование: implements Countabl\Countable, implements ArrayAcces\ArrayAccess, implements IteratorAggregat\IteratorAggregate
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$rules Internal container for the rules

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

Метод Описание
__construct ( array $rules = [] ) RuleRepository constructor
add ( Rule $rule ) : void Add a rule to the collection
all ( ) : array Return a raw array of all rules
count ( ) : integer Returns the number of rules
first ( ) : Rule | null Return the first element in the array or null if empty
getIterator ( ) : ArrayIterator Returns an iterator for the internal array
getRelevantRules ( string $action, string $resource ) : RuleRepository Get all rules only relevant to the given action and resource
isEmpty ( ) : boolean Determine if empty
last ( ) : Rule | null Return the last element in the array or null if empty
offsetExists ( $key ) : boolean Determine if the rule exists by key
offsetGet ( $key ) : Rule Returns the requested Rule
offsetSet ( $key, $value ) : void Sets the rule at the given key
offsetUnset ( $key ) : void Unsets the rule at the given key
reduce ( Closure $callback, mixed $initialValue = [] ) : RuleRepository Runs a reduce callback on the collection

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

__construct() публичный метод

RuleRepository constructor
public __construct ( array $rules = [] )
$rules array Initial list of rules for the collection

add() публичный метод

Add a rule to the collection
public add ( Rule $rule ) : void
$rule Rule
Результат void

all() публичный метод

Return a raw array of all rules
public all ( ) : array
Результат array

count() публичный метод

Returns the number of rules
public count ( ) : integer
Результат integer

first() публичный метод

Return the first element in the array or null if empty
public first ( ) : Rule | null
Результат Rule | null

getIterator() публичный метод

Returns an iterator for the internal array
public getIterator ( ) : ArrayIterator
Результат ArrayIterator

getRelevantRules() публичный метод

Get all rules only relevant to the given action and resource
public getRelevantRules ( string $action, string $resource ) : RuleRepository
$action string Action to check against
$resource string Resource to check against
Результат RuleRepository

isEmpty() публичный метод

Determine if empty
public isEmpty ( ) : boolean
Результат boolean

last() публичный метод

Return the last element in the array or null if empty
public last ( ) : Rule | null
Результат Rule | null

offsetExists() публичный метод

Determine if the rule exists by key
public offsetExists ( $key ) : boolean
Результат boolean

offsetGet() публичный метод

Returns the requested Rule
public offsetGet ( $key ) : Rule
Результат Rule

offsetSet() публичный метод

Sets the rule at the given key
public offsetSet ( $key, $value ) : void
Результат void

offsetUnset() публичный метод

Unsets the rule at the given key
public offsetUnset ( $key ) : void
Результат void

reduce() публичный метод

Runs a reduce callback on the collection
public reduce ( Closure $callback, mixed $initialValue = [] ) : RuleRepository
$callback Closure Callback to use for the reduce algorithm
$initialValue mixed Initial value for the reduce set
Результат RuleRepository

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

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

Internal container for the rules
protected $rules