original_string: public function add(string $dir): self
      {
          $dir = rtrim(\BearFramework\Internal\Utilities::normalizePath($dir), '/') . '/';
          if (!isset($this->dirs[$dir])) {
              $this->dirs[$dir] = strlen($dir);
              arsort($this->dirs);
              $indexFilename = $dir . 'index.php';
              if (is_file($indexFilename)) {
                  ob_start();
                  try {
                      (static function($__filename) {
                          include $__filename;
                      })($indexFilename);
                      ob_end_clean();
                  } catch (\Exception $e) {
                      ob_end_clean();
                      throw $e;
                  }
              } else {
                  throw new \Exception('Cannot find index.php file in the dir specified (' . $dir . ')!');
              }
          }
          return $this;
      }
code: public function add(string $dir): self
      {
          $dir = rtrim(\BearFramework\Internal\Utilities::normalizePath($dir), '/') . '/';
          if (!isset($this->dirs[$dir])) {
              $this->dirs[$dir] = strlen($dir);
              arsort($this->dirs);
              $indexFilename = $dir . 'index.php';
              if (is_file($indexFilename)) {
                  ob_start();
                  try {
                      (static function($__filename) {
                          include $__filename;
                      })($indexFilename);
                      ob_end_clean();
                  } catch (\Exception $e) {
                      ob_end_clean();
                      throw $e;
                  }
              } else {
                  throw new \Exception('Cannot find index.php file in the dir specified (' . $dir . ')!');
              }
          }
          return $this;
      }
code_tokens: public function add ( string $ dir ) : self { $ dir = rtrim ( \ BearFramework \ Internal \ Utilities :: normalizePath ( $ dir ) , '/' ) . '/' ; if ( ! isset ( $ this -> dirs [ $ dir ] ) ) { $ this -> dirs [ $ dir ] = strlen ( $ dir ) ; arsort ( $ this -> dirs ) ; $ indexFilename = $ dir . 'index.php' ; if ( is_file ( $ indexFilename ) ) { ob_start ( ) ; try { ( static function ( $ __filename ) { include $ __filename ; } ) ( $ indexFilename ) ; ob_end_clean ( ) ; } catch ( \ Exception $ e ) { ob_end_clean ( ) ; throw $ e ; } } else { throw new \ Exception ( 'Cannot find index.php file in the dir specified (' . $ dir . ')!' ) ; } } return $ this ; }
docstring: Registers a new context.
  
  @param string $dir The context dir.
  @throws \Exception
  @return self Returns a reference to itself.
docstring_tokens: Registers a new context .