function ScaffoldFilePath::__construct

Same name and namespace in other branches
  1. 10 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::__construct()
  2. 11.x composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::__construct()
  3. 9 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::__construct()
  4. 8.9.x composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::__construct()

ScaffoldFilePath constructor.

Parameters

string $type: The type of scaffold file this is,'autoload', 'dest' or 'src'.

string $packageName: The name of the package containing the file.

string $relativePath: The relative path to the file.

string $fullPath: The full path to the file.

File

composer/Plugin/Scaffold/ScaffoldFilePath.php, line 35

Class

ScaffoldFilePath
Manage the path to a file to scaffold.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public function __construct(protected $type, protected $packageName, protected $relativePath, protected $fullPath) {
  // Ensure that the full path really is a full path. We do not use
  // 'realpath' here because the file specified by the full path might
  // not exist yet.
  $fs = new Filesystem();
  if (!$fs->isAbsolutePath($this->fullPath)) {
    $this->fullPath = getcwd() . '/' . $this->fullPath;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.