Platformsh\Cli\Local\Toolstack\ToolstackBase::processSpecialDestinations PHP Метод

processSpecialDestinations() защищенный Метод

Process the defined special destinations.
    protected function processSpecialDestinations()
    {
        foreach ($this->specialDestinations as $sourcePattern => $relDestination) {
            $matched = glob($this->appRoot . '/' . $sourcePattern, GLOB_NOSORT);
            if (!$matched) {
                continue;
            }
            if ($relDestination === '{webroot}' && $this->buildInPlace) {
                continue;
            }
            // On Platform.sh these replacements would be a bit different.
            $absDestination = str_replace(['{webroot}', '{approot}'], [$this->getWebRoot(), $this->buildDir], $relDestination);
            foreach ($matched as $source) {
                // Ignore the source if it's in ignoredFiles.
                $relSource = str_replace($this->appRoot . '/', '', $source);
                if (in_array($relSource, $this->ignoredFiles)) {
                    continue;
                }
                $destination = $absDestination;
                // Do not overwrite directories with files.
                if (!is_dir($source) && is_dir($destination)) {
                    $destination = $destination . '/' . basename($source);
                }
                // Ignore if source and destination are the same.
                if ($destination === $source) {
                    continue;
                }
                if ($this->copy) {
                    $this->output->writeln("Copying {$relSource} to {$relDestination}");
                } else {
                    $this->output->writeln("Symlinking {$relSource} to {$relDestination}");
                }
                // Delete existing files, emitting a warning.
                if (file_exists($destination)) {
                    $this->output->writeln(sprintf("Overriding existing path '%s' in destination", str_replace($this->buildDir . '/', '', $destination)));
                    $this->fsHelper->remove($destination);
                }
                if ($this->copy) {
                    $this->fsHelper->copy($source, $destination);
                } else {
                    $this->fsHelper->symlink($source, $destination);
                }
            }
        }
    }