Scalr\Acl\Role\RoleObject::__construct PHP Method

__construct() public method

Constructor
public __construct ( integer $roleId, string $name )
$roleId integer The ID of the ACL role
$name string The name of the ACL role
    public function __construct($roleId, $name)
    {
        $this->roleId = $roleId;
        $this->name = $name;
        $this->resources = new \ArrayObject(array());
    }

Usage Example

 /**
  * Constructor
  *
  * @param   RoleObject $baseRole        The base role object
  * @param   int        $accountId       The ID of the account
  * @param   string     $accountRoleId   optional The ID of the ACL role of account level
  * @param   string     $accountRoleName optional The name of the ACL role of account level
  * @param   int        $color           optional The color that is associated with the object
  * @param   bool       $isAutomatic     optional Wheter this role is created automatically during initialization
  */
 public function __construct(RoleObject $baseRole, $accountId, $accountRoleId = null, $accountRoleName = null, $color = null, $isAutomatic = false)
 {
     $this->baseRole = $baseRole;
     $this->accountId = $accountId;
     $this->color = (int) $color;
     $this->isAutomatic = (bool) $isAutomatic;
     parent::__construct($accountRoleId, $accountRoleName);
 }