original_string: public function getDir($directory)
      {
          $directory = str_replace('/', DS, $directory);
          if (strpos($directory, $this->getBaseDir()) === false || !file_exists($directory)) {
              $directory = $this->getBaseDir() . DS . ltrim($directory, DS);
          }
          return $directory;
      }
code: public function getDir($directory)
      {
          $directory = str_replace('/', DS, $directory);
          if (strpos($directory, $this->getBaseDir()) === false || !file_exists($directory)) {
              $directory = $this->getBaseDir() . DS . ltrim($directory, DS);
          }
          return $directory;
      }
code_tokens: public function getDir ( $ directory ) { $ directory = str_replace ( '/' , DS , $ directory ) ; if ( strpos ( $ directory , $ this -> getBaseDir ( ) ) === false || ! file_exists ( $ directory ) ) { $ directory = $ this -> getBaseDir ( ) . DS . ltrim ( $ directory , DS ) ; } return $ directory ; }
docstring: Return dir based on the base dir.
  
  @param string $directory
  
  @return string
docstring_tokens: Return dir based on the base dir .