original_string: protected function getMiddleware($instance, $action)
      {
          $results = array();
          $middleware = (array) $instance->getOption('middleware');
          foreach ($middleware as $class => $options) {
              if ((!isset($options['only']) || in_array($action, (array) $options['only'])) &&
                  (!isset($options['except']) || !in_array($action, (array) $options['except']))
              ) {
                  $results[$class] = $options;
              }
          }
  
          return $results;
      }
code: protected function getMiddleware($instance, $action)
      {
          $results = array();
          $middleware = (array) $instance->getOption('middleware');
          foreach ($middleware as $class => $options) {
              if ((!isset($options['only']) || in_array($action, (array) $options['only'])) &&
                  (!isset($options['except']) || !in_array($action, (array) $options['except']))
              ) {
                  $results[$class] = $options;
              }
          }
  
          return $results;
      }
code_tokens: protected function getMiddleware ( $ instance , $ action ) { $ results = array ( ) ; $ middleware = ( array ) $ instance -> getOption ( 'middleware' ) ; foreach ( $ middleware as $ class => $ options ) { if ( ( ! isset ( $ options [ 'only' ] ) || in_array ( $ action , ( array ) $ options [ 'only' ] ) ) && ( ! isset ( $ options [ 'except' ] ) || ! in_array ( $ action , ( array ) $ options [ 'except' ] ) ) ) { $ results [ $ class ] = $ options ; } } return $ results ; }
docstring: Returns middleware for specified action
  
  @param \Wei\BaseController $instance
  @param string $action
  @return array
docstring_tokens: Returns middleware for specified action