code: function add(?array $path, $methods, callable $callback) : self {
          unset($this->_pSet);
          $this->_toClosure($callback);
          if (!is_array($methods))
              $methods = [$methods];
          $siblings = [];
          foreach ($methods as $method) {
              if (!isset($this->_tree[$method]))
                  $this->_tree[$method] = [];
              $this->_pSet = &$this->_tree[$method];
              if (!isset($path)) {
                  if (!isset($this->_pSet[self::_404]))
                      $this->_pSet[self::_404] = [];
                  $this->_pSet = &$this->_pSet[self::_404];
              } else foreach ($path as $value) {
                  if (strpos($value, '/') === 0) {
                      if (!isset($this->_pSet[self::_PARAMETER]))
                          $this->_pSet[self::_PARAMETER] = [];
                      $this->_pSet = &$this->_pSet[self::_PARAMETER];
                      if (isset($this->_pSet[self::_NAME]) && $this->_pSet[self::_NAME] != substr($value, 1))
                          Console::fatal("Failed to register route. Conflict in Parameter name \"$value\".");
                      $this->_pSet[self::_NAME] = substr($value, 1);
                  } else {
                      if (!isset($this->_pSet[$value]))
                          $this->_pSet[$value] = [];
                      $this->_pSet = &$this->_pSet[$value];
                  }
              }
              if (isset($this->_pSet[self::_CALLBACK]))
                  Console::fatal("Conflict detected. Failed to register route.");
              $this->_pSet[self::_CALLBACK] = $callback;
              $this->_pSet[self::_MIDDLEWARE] = [];
              $this->_pSet[self::_CONTROLLER] = [];
              $siblings[] = &$this->_pSet;
          }
          foreach ($siblings as &$sibling)
              $sibling[self::_SIBLINGS] = &$siblings;
          return $this;
      }
docs: 注册路由
  
  @param array|null $path
  @param $methods
  @param callable $callback
  @return Router