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

Breadcrumb

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

function PhpFileParser::isReadable

Cross-platform safe version of is_readable()

This will also check for readability by reading the file as is_readable can not be trusted on network-mounts and \\wsl$ paths. See https://github.com/composer/composer/issues/8231 and https://bugs.php.net/bug.php?id=68926

Parameters

string $path:

Return value

bool

See also

Composer\Util\Filesystem::isReadable

1 call to PhpFileParser::isReadable()
PhpFileParser::findClasses in vendor/composer/class-map-generator/src/PhpFileParser.php
Extract the classes in the given file

File

vendor/composer/class-map-generator/src/PhpFileParser.php, line 143

Class

PhpFileParser
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\ClassMapGenerator

Code

private static function isReadable(string $path) {
    if (is_readable($path)) {
        return true;
    }
    if (is_file($path)) {
        return false !== @file_get_contents($path, false, null, 0, 1);
    }
    // assume false otherwise
    return false;
}

API Navigation

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