You are here

public function ScaffoldFilePath::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::__construct()

ScaffoldFilePath constructor.

Parameters

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

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

string $rel_path: The relative path to the file.

string $full_path: The full path to the file.

File

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

Class

ScaffoldFilePath
Manage the path to a file to scaffold.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public function __construct($path_type, $package_name, $rel_path, $full_path) {
  $this->type = $path_type;
  $this->packageName = $package_name;
  $this->relativePath = $rel_path;
  $this->fullPath = $full_path;

  // 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;
  }
}