original_string: protected function dirname($path)
      {
          if (is_file($path)) {
              return dirname($path);
          }
  
          if (is_dir($path)) {
              return rtrim($path, '/');
          }
  
          // no known file/dir, start making assumptions
  
          // ends in / = dir
          if (mb_substr($path, -1) === '/') {
              return rtrim($path, '/');
          }
  
          // has a dot in the name, likely a file
          if (preg_match('/.*\..*$/', basename($path)) !== 0) {
              return dirname($path);
          }
  
          // you're on your own here!
          return $path;
      }
code: protected function dirname($path)
      {
          if (is_file($path)) {
              return dirname($path);
          }
  
          if (is_dir($path)) {
              return rtrim($path, '/');
          }
  
          // no known file/dir, start making assumptions
  
          // ends in / = dir
          if (mb_substr($path, -1) === '/') {
              return rtrim($path, '/');
          }
  
          // has a dot in the name, likely a file
          if (preg_match('/.*\..*$/', basename($path)) !== 0) {
              return dirname($path);
          }
  
          // you're on your own here!
          return $path;
      }
code_tokens: protected function dirname ( $ path ) { if ( is_file ( $ path ) ) { return dirname ( $ path ) ; } if ( is_dir ( $ path ) ) { return rtrim ( $ path , '/' ) ; } // no known file/dir, start making assumptions // ends in / = dir if ( mb_substr ( $ path , - 1 ) === '/' ) { return rtrim ( $ path , '/' ) ; } // has a dot in the name, likely a file if ( preg_match ( '/.*\..*$/' , basename ( $ path ) ) !== 0 ) { return dirname ( $ path ) ; } // you're on your own here! return $ path ; }
docstring: Attempt to get the directory name from a path.
  
  @param string $path
  
  @return string
docstring_tokens: Attempt to get the directory name from a path .