Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Filesystem.php

function Filesystem::readlink

Same name in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/Internal/Filesystem/Service/Filesystem.php \PhpTuf\ComposerStager\Internal\Filesystem\Service\Filesystem::readLink()

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
1 call to Filesystem::readlink()
Filesystem::dumpFile in vendor/symfony/filesystem/Filesystem.php
Atomically dumps content into a file.

File

vendor/symfony/filesystem/Filesystem.php, line 416

Class

Filesystem
Provides basic utility to manipulate the file system.

Namespace

Symfony\Component\Filesystem

Code

public function readlink(string $path, bool $canonicalize = false) : ?string {
    if (!$canonicalize && !is_link($path)) {
        return null;
    }
    if ($canonicalize) {
        if (!$this->exists($path)) {
            return null;
        }
        return realpath($path);
    }
    return readlink($path);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal