PHP 클래스 Authority\RuleRepository

상속: implements Countabl\Countable, implements ArrayAcces\ArrayAccess, implements IteratorAggregat\IteratorAggregate
파일 보기 프로젝트 열기: machuga/authority 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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

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