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

Breadcrumb

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

function Perforce::getFilePath

1 call to Perforce::getFilePath()
Perforce::getFileContent in vendor/composer/composer/src/Composer/Util/Perforce.php

File

vendor/composer/composer/src/Composer/Util/Perforce.php, line 472

Class

Perforce
@author Matt Whittom <Matt.Whittom@veteransunited.com>

Namespace

Composer\Util

Code

public function getFilePath(string $file, string $identifier) : ?string {
    $index = strpos($identifier, '@');
    if ($index === false) {
        return $identifier . '/' . $file;
    }
    $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
    $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
    $this->executeCommand($command);
    $result = $this->commandResult;
    $index2 = strpos($result, 'no such file(s).');
    if ($index2 === false) {
        $index3 = strpos($result, 'change');
        if ($index3 !== false) {
            $phrase = trim(substr($result, $index3));
            $fields = explode(' ', $phrase);
            return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
        }
    }
    return null;
}

API Navigation

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