Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Copies file
<?php copy(string $from, string $to, ?resource $context = null): bool
<?php $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
}
return copy($source, $this->root . $file);
}
return false;
<?php $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
return copy($this->root . $file, $target);
}
}
<?php if ($backupTarget) {
@copy($localFilename, $backupTarget);
}
try {
<?php if (Platform::isWindows()) {
copy($newFilename, $localFilename);
@unlink($newFilename);
} else {
rename($newFilename, $localFilename);
<?php public function copy($source, $target)
{
if (!is_dir($source)) {
return copy($source, $target);
}
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
<?php if ($file->isDir()) {
$this->ensureDirectoryExists($targetPath);
} else {
$result = $result && copy($file->getPathname(), $targetPath);
}
}
<?php if ($file->isDir()) {
$fs->ensureDirectoryExists($targetPath);
} else {
copy($file->getPathname(), $targetPath);
}
}
<?php public function testAddRepository()
{
$config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config);
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
$jsonConfigSource->addRepository('example_tld', array('type' => 'git', 'url' => 'example.tld'));
<?php public function testAddRepositoryWithOptions()
{
$config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config);
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
$jsonConfigSource->addRepository('example_tld', array(
'type' => 'composer',
<?php public function testRemoveRepository()
{
$config = $this->workingDir.'/composer.json';
copy($this->fixturePath('config/config-with-exampletld-repository.json'), $config);
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
$jsonConfigSource->removeRepository('example_tld');
<?php public function testAddPackagistRepositoryWithFalseValue()
{
$config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config);
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
$jsonConfigSource->addRepository('packagist', false);
<?php public function testRemovePackagist()
{
$config = $this->workingDir.'/composer.json';
copy($this->fixturePath('config/config-with-packagist-false.json'), $config);
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
$jsonConfigSource->removeRepository('packagist');
<?php public function testAddLink($sourceFile, $type, $name, $value, $compareAgainst)
{
$composerJson = $this->workingDir.'/composer.json';
copy($sourceFile, $composerJson);
$jsonConfigSource = new JsonConfigSource(new JsonFile($composerJson));
$jsonConfigSource->addLink($type, $name, $value);
<?php public function testRemoveLink($sourceFile, $type, $name, $compareAgainst)
{
$composerJson = $this->workingDir.'/composer.json';
copy($sourceFile, $composerJson);
$jsonConfigSource = new JsonConfigSource(new JsonFile($composerJson));
$jsonConfigSource->removeLink($type, $name);