original_string: public function readlink($path, $canonicalize = false)
      {
          if (!$canonicalize && !is_link($path)) {
              return;
          }
  
          if ($canonicalize) {
              if (!$this->exists($path)) {
                  return;
              }
  
              if ('\\' === \DIRECTORY_SEPARATOR) {
                  $path = readlink($path);
              }
  
              return realpath($path);
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              return realpath($path);
          }
  
          return readlink($path);
      }
code: public function readlink($path, $canonicalize = false)
      {
          if (!$canonicalize && !is_link($path)) {
              return;
          }
  
          if ($canonicalize) {
              if (!$this->exists($path)) {
                  return;
              }
  
              if ('\\' === \DIRECTORY_SEPARATOR) {
                  $path = readlink($path);
              }
  
              return realpath($path);
          }
  
          if ('\\' === \DIRECTORY_SEPARATOR) {
              return realpath($path);
          }
  
          return readlink($path);
      }
code_tokens: public function readlink ( $ path , $ canonicalize = false ) { if ( ! $ canonicalize && ! is_link ( $ path ) ) { return ; } if ( $ canonicalize ) { if ( ! $ this -> exists ( $ path ) ) { return ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { $ path = readlink ( $ path ) ; } return realpath ( $ path ) ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { return realpath ( $ path ) ; } return readlink ( $ path ) ; }
docstring: Resolves links in paths.
  
  With $canonicalize = false (default)
  - if $path does not exist or is not a link, returns null
  - if $path is a link, returns the next direct target of the link without considering the existence of the target
  
  With $canonicalize = true
  - if $path does not exist, returns null
  - if $path exists, returns its absolute fully resolved final version
  
  @param string $path         A filesystem path
  @param bool   $canonicalize Whether or not to return a canonicalized path
  
  @return string|null
docstring_tokens: Resolves links in paths .