public function getMask(array $permissions)
    {
        $maskBuilder = new MaskBuilder();

        foreach ($permissions as $permission) {
            try {
                $maskBuilder->add($permission);
            } catch (InvalidArgumentException $e) {
                throw new InvalidPermissionException('Invalid permission mask: '.$permission, $permission, $e);
            }
        }

        return $maskBuilder->get();
    }
public function getMask(array $permissions)
    {
        $maskBuilder = new MaskBuilder();

        foreach ($permissions as $permission) {
            try {
                $maskBuilder->add($permission);
            } catch (InvalidArgumentException $e) {
                throw new InvalidPermissionException('Invalid permission mask: '.$permission, $permission, $e);
            }
        }

        return $maskBuilder->get();
    }
public function getMask ( array $ permissions ) { $ maskBuilder = new MaskBuilder ( ) ; foreach ( $ permissions as $ permission ) { try { $ maskBuilder -> add ( $ permission ) ; } catch ( InvalidArgumentException $ e ) { throw new InvalidPermissionException ( 'Invalid permission mask: ' . $ permission , $ permission , $ e ) ; } } return $ maskBuilder -> get ( ) ; }
Calculate mask for a list of permissions.

['view', 'edit'] => (int) 5

@param array $permissions

@return int
Calculate mask for a list of permissions .