src/Policy.php
private function check($matchType, $type, $name, $args)
    {
        $value = array_shift($args);

        if (!isset($args[0])) {
          $args[0] = ['rule' => Policy::ANY];
        }

        // see what other options we've been given
        if (is_string($args[0]) && ($args[0] === Policy::ANY || $args[0] === Policy::ALL) ) {
          $args['rule'] = $args[0];
          unset($args[0]);
        } elseif (is_array($args[0])) {
          $args = $args[0];
        }

        $this->checks[$type][] = new Check($matchType, $value, $args);
    }
private function check($matchType, $type, $name, $args)
    {
        $value = array_shift($args);

        if (!isset($args[0])) {
          $args[0] = ['rule' => Policy::ANY];
        }

        // see what other options we've been given
        if (is_string($args[0]) && ($args[0] === Policy::ANY || $args[0] === Policy::ALL) ) {
          $args['rule'] = $args[0];
          unset($args[0]);
        } elseif (is_array($args[0])) {
          $args = $args[0];
        }

        $this->checks[$type][] = new Check($matchType, $value, $args);
    }
private function check ( $ matchType , $ type , $ name , $ args ) { $ value = array_shift ( $ args ) ; if ( ! isset ( $ args [ 0 ] ) ) { $ args [ 0 ] = [ 'rule' => Policy :: ANY ] ; } // see what other options we've been given if ( is_string ( $ args [ 0 ] ) && ( $ args [ 0 ] === Policy :: ANY || $ args [ 0 ] === Policy :: ALL ) ) { $ args [ 'rule' ] = $ args [ 0 ] ; unset ( $ args [ 0 ] ) ; } elseif ( is_array ( $ args [ 0 ] ) ) { $ args = $ args [ 0 ] ; } $ this -> checks [ $ type ] [ ] = new Check ( $ matchType , $ value , $ args ) ; }
Add a new check to the current set for the policy

@param string $matchType Match type
@param string $type Type of check
@param string $name Name for the check
@param array $args Additional arguments for the check
Add a new check to the current set for the policy