src/ministruts/ActionMapping.php
public function setRoles($roles) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $name = $this->name ? ' name="'.$this->name.'"':'';
        $path = $this->path ? ' path="'.$this->path.'"':'';

        //static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*(,!?[A-Za-z_][A-Za-z0-9_]*)*$/';
        static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*$/';
        if (!strlen($roles) || !preg_match($pattern, $roles)) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');

        // check for invalid id combinations, e.g. "Member,!Member"
        $tokens = explode(',', $roles);
        $keys = \array_flip($tokens);

        foreach ($tokens as $role) {
            if (isset($keys['!'.$role])) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');
        }

        // remove duplicates
        $this->roles = join(',', \array_flip($keys));
        return $this;
    }
public function setRoles($roles) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $name = $this->name ? ' name="'.$this->name.'"':'';
        $path = $this->path ? ' path="'.$this->path.'"':'';

        //static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*(,!?[A-Za-z_][A-Za-z0-9_]*)*$/';
        static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*$/';
        if (!strlen($roles) || !preg_match($pattern, $roles)) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');

        // check for invalid id combinations, e.g. "Member,!Member"
        $tokens = explode(',', $roles);
        $keys = \array_flip($tokens);

        foreach ($tokens as $role) {
            if (isset($keys['!'.$role])) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');
        }

        // remove duplicates
        $this->roles = join(',', \array_flip($keys));
        return $this;
    }
public function setRoles ( $ roles ) { if ( $ this -> configured ) throw new IllegalStateException ( 'Configuration is frozen' ) ; $ name = $ this -> name ? ' name="' . $ this -> name . '"' : '' ; $ path = $ this -> path ? ' path="' . $ this -> path . '"' : '' ; //static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*(,!?[A-Za-z_][A-Za-z0-9_]*)*$/'; static $ pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*$/' ; if ( ! strlen ( $ roles ) || ! preg_match ( $ pattern , $ roles ) ) throw new StrutsConfigException ( '<mapping' . $ name . $ path . ' roles="' . $ roles . '": Invalid roles expression.' ) ; // check for invalid id combinations, e.g. "Member,!Member" $ tokens = explode ( ',' , $ roles ) ; $ keys = \ array_flip ( $ tokens ) ; foreach ( $ tokens as $ role ) { if ( isset ( $ keys [ '!' . $ role ] ) ) throw new StrutsConfigException ( '<mapping' . $ name . $ path . ' roles="' . $ roles . '": Invalid roles expression.' ) ; } // remove duplicates $ this -> roles = join ( ',' , \ array_flip ( $ keys ) ) ; return $ this ; }
Set the mapping's role restrictions.

@param  string $roles - role expression

@return $this

@throws StrutsConfigException on configuration errors
Set the mapping s role restrictions .