original_string: public function add($pattern, $callback): self
      {
          if (is_string($pattern)) {
              if (!isset($pattern{0})) {
                  throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
              }
              $pattern = [$pattern];
          } elseif (is_array($pattern)) {
              if (empty($pattern)) {
                  throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
              }
              foreach ($pattern as $_pattern) {
                  if (!is_string($_pattern)) {
                      throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
                  }
                  if (!isset($_pattern{0})) {
                      throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
                  }
              }
          } else {
              throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
          }
          if (is_callable($callback)) {
              $callback = [$callback];
          } elseif (is_array($callback)) {
              if (empty($callback)) {
                  throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
              }
              foreach ($callback as $_callback) {
                  if (!is_callable($_callback)) {
                      throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
                  }
              }
          } else {
              throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
          }
          $this->data[] = [$pattern, $callback];
          return $this;
      }
code: public function add($pattern, $callback): self
      {
          if (is_string($pattern)) {
              if (!isset($pattern{0})) {
                  throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
              }
              $pattern = [$pattern];
          } elseif (is_array($pattern)) {
              if (empty($pattern)) {
                  throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
              }
              foreach ($pattern as $_pattern) {
                  if (!is_string($_pattern)) {
                      throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
                  }
                  if (!isset($_pattern{0})) {
                      throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
                  }
              }
          } else {
              throw new \InvalidArgumentException('The pattern argument must be a not empty string or array of not empty strings');
          }
          if (is_callable($callback)) {
              $callback = [$callback];
          } elseif (is_array($callback)) {
              if (empty($callback)) {
                  throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
              }
              foreach ($callback as $_callback) {
                  if (!is_callable($_callback)) {
                      throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
                  }
              }
          } else {
              throw new \InvalidArgumentException('The callback argument must be a valid callable or array of valid callables');
          }
          $this->data[] = [$pattern, $callback];
          return $this;
      }
code_tokens: public function add ( $ pattern , $ callback ) : self { if ( is_string ( $ pattern ) ) { if ( ! isset ( $ pattern { 0 } ) ) { throw new \ InvalidArgumentException ( 'The pattern argument must be a not empty string or array of not empty strings' ) ; } $ pattern = [ $ pattern ] ; } elseif ( is_array ( $ pattern ) ) { if ( empty ( $ pattern ) ) { throw new \ InvalidArgumentException ( 'The pattern argument must be a not empty string or array of not empty strings' ) ; } foreach ( $ pattern as $ _pattern ) { if ( ! is_string ( $ _pattern ) ) { throw new \ InvalidArgumentException ( 'The pattern argument must be a not empty string or array of not empty strings' ) ; } if ( ! isset ( $ _pattern { 0 } ) ) { throw new \ InvalidArgumentException ( 'The pattern argument must be a not empty string or array of not empty strings' ) ; } } } else { throw new \ InvalidArgumentException ( 'The pattern argument must be a not empty string or array of not empty strings' ) ; } if ( is_callable ( $ callback ) ) { $ callback = [ $ callback ] ; } elseif ( is_array ( $ callback ) ) { if ( empty ( $ callback ) ) { throw new \ InvalidArgumentException ( 'The callback argument must be a valid callable or array of valid callables' ) ; } foreach ( $ callback as $ _callback ) { if ( ! is_callable ( $ _callback ) ) { throw new \ InvalidArgumentException ( 'The callback argument must be a valid callable or array of valid callables' ) ; } } } else { throw new \ InvalidArgumentException ( 'The callback argument must be a valid callable or array of valid callables' ) ; } $ this -> data [ ] = [ $ pattern , $ callback ] ; return $ this ; }
docstring: Registers a request handler.
  
  @param string|string[] $pattern Path pattern or array of patterns. Can contain "?" (path segment) and "*" (matches everything). Can start with method name (GET, HEAD, POST, DELETE, PUT, PATCH, OPTIONS) or list of method names (GET|HEAD|POST).
  @param callable|callable[] $callback Function that is expected to return object of type \BearFramework\App\Response.
  @throws \InvalidArgumentException
  @return self Returns a reference to itself.
docstring_tokens: Registers a request handler .