original_string: public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
      {
          if (!is_array($middleware)) {
              $middleware = [$middleware];
          }
  
          foreach ($middleware as $mw) {
              $this->stack[$priority][] = [$condition, $mw];
          }
  
          return $this;
      }
code: public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
      {
          if (!is_array($middleware)) {
              $middleware = [$middleware];
          }
  
          foreach ($middleware as $mw) {
              $this->stack[$priority][] = [$condition, $mw];
          }
  
          return $this;
      }
code_tokens: public function appendOnCondition ( $ middleware , callable $ condition , $ priority = 0 ) : Server { if ( ! is_array ( $ middleware ) ) { $ middleware = [ $ middleware ] ; } foreach ( $ middleware as $ mw ) { $ this -> stack [ $ priority ] [ ] = [ $ condition , $ mw ] ; } return $ this ; }
docstring: Adds a middleware to the stack only if the condition returns true.
  
  The `$condition` parameter must be a callable and it will be called with the
  `ServerRequestInterface` object as argument.
  
  @param MiddlewareInterface|callable|array $middleware
  @param callable                           $condition
  @param int                                $priority
  @return $this
docstring_tokens: Adds a middleware to the stack only if the condition returns true .