op example


  public function process(IOInterface $io, ScaffoldOptions $options) {
    return $this->op()->process($this->destination, $io$options);
  }

  /** * Returns TRUE if the target does not exist or has changed. * * @return bool */
  final public function hasChanged() {
    $path = $this->destination()->fullPath();
    if (!file_exists($path)) {
      return TRUE;
    }
// Build the list of ScaffoldFileInfo objects by project.     foreach ($file_mappings as $package_name => $package_file_mappings) {
      foreach ($package_file_mappings as $destination_rel_path => $op) {
        $destination = ScaffoldFilePath::destinationPath($package_name$destination_rel_path$location_replacements);

        // If there was already a scaffolding operation happening at this path,         // allow the new operation to decide how to handle the override.         // Usually, the new operation will replace whatever was there before.         if (isset($scaffoldFiles[$destination_rel_path])) {
          $previous_scaffold_file = $scaffoldFiles[$destination_rel_path];
          $op = $op->scaffoldOverExistingTarget($previous_scaffold_file->op());

          // Remove the previous op so we only touch the destination once.           $message = " - Skip <info>[dest-rel-path]</info>: overridden in <comment>{$package_name}</comment>";
          $this->scaffoldFilesByProject[$previous_scaffold_file->packageName()][$destination_rel_path] = new ScaffoldFileInfo($destinationnew SkipOp($message));
        }
        // If there is NOT already a scaffolding operation happening at this         // path, notify the scaffold operation of this fact.         else {
          $op = $op->scaffoldAtNewLocation($destination);
        }

        
// Confirm that the keys of the output are the same as the keys of the     // input.     $this->assertEquals(array_keys($scaffold_file_fixtures)array_keys($resolved_file_mappings));
    // '[web-root]/robots.txt' is now a SkipOp, as it is now part of an     // append operation.     $this->assertEquals([
      '[web-root]/index.php',
      '[web-root]/.htaccess',
      '[web-root]/robots.txt',
      '[web-root]/sites/default/default.services.yml',
    ]array_keys($resolved_file_mappings['fixtures/drupal-assets-fixture']));
    $this->assertInstanceOf(SkipOp::class$resolved_file_mappings['fixtures/drupal-assets-fixture']['[web-root]/robots.txt']->op());

    $this->assertEquals([
      '[web-root]/sites/default/default.services.yml',
    ]array_keys($resolved_file_mappings['fixtures/drupal-profile']));

    $this->assertEquals([
      '[web-root]/.htaccess',
      '[web-root]/robots.txt',
    ]array_keys($resolved_file_mappings['fixtures/drupal-drupal']));

    // Test that .htaccess is skipped.
Home | Imprint | This part of the site doesn't use cookies.