PHP Class Pop\Auth\Role

Author: Nick Sagona, III ([email protected])
Mostrar archivo Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$children array Role children
$name string Role name
$parent Role Role parent
$permissions array Role permissions

Public Methods

Method Description
__construct ( string $name ) : Role Constructor
__toString ( ) : string Method to return the string value of the name of the role
addChild ( mixed $role ) : Role Method to add a child role
addPermission ( string $name ) : Role Method to add a permission to the role
factory ( string $name ) : Role Static method to instantiate the role object and return itself to facilitate chaining methods together.
getName ( ) : string Method to get the role name
getParent ( ) : Role Method to get the role parent
hasParent ( ) : Role Method to see if the role has a parent
hasPermission ( string $name ) : boolean Method to check if a role has a permission
setParent ( Role $parent ) : Role Method to set the role parent

Method Details

__construct() public method

Instantiate the role object
public __construct ( string $name ) : Role
$name string
return Role

__toString() public method

Method to return the string value of the name of the role
public __toString ( ) : string
return string

addChild() public method

Method to add a child role
public addChild ( mixed $role ) : Role
$role mixed
return Role

addPermission() public method

Method to add a permission to the role
public addPermission ( string $name ) : Role
$name string
return Role

factory() public static method

Static method to instantiate the role object and return itself to facilitate chaining methods together.
public static factory ( string $name ) : Role
$name string
return Role

getName() public method

Method to get the role name
public getName ( ) : string
return string

getParent() public method

Method to get the role parent
public getParent ( ) : Role
return Role

hasParent() public method

Method to see if the role has a parent
public hasParent ( ) : Role
return Role

hasPermission() public method

Method to check if a role has a permission
public hasPermission ( string $name ) : boolean
$name string
return boolean

setParent() public method

Method to set the role parent
public setParent ( Role $parent ) : Role
$parent Role
return Role

Property Details

$children protected_oe property

Role children
protected array $children
return array

$name protected_oe property

Role name
protected string $name
return string

$parent protected_oe property

Role parent
protected Role,Pop\Auth $parent
return Role

$permissions protected_oe property

Role permissions
protected array $permissions
return array