Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Sets access and modification time of file
<?php touch(string $filename, ?int $mtime = null, ?int $atime = null): bool
<?php $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
try {
touch($this->root . $file, (int) filemtime($this->root . $file), time());
} catch (\ErrorException $e) {
<?php if ($input->getOption('global') && !$this->configFile->exists()) {
touch($this->configFile->getPath());
$this->configFile->write(array('config' => new \ArrayObject));
Silencer::call('chmod', $this->configFile->getPath(), 0600);
}
<?php Silencer::call('chmod', $this->configFile->getPath(), 0600);
}
if ($input->getOption('global') && !$this->authConfigFile->exists()) {
touch($this->authConfigFile->getPath());
$this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject));
Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
}
<?php if (is_dir($vendorDir)) {
@touch($vendorDir);
}
}
<?php $method->setAccessible(true);
$dlFile = $method->invoke($downloader, $packageMock, $path);
mkdir(dirname($dlFile), 0777, true);
touch($dlFile);
try {
$loop = new Loop($this->httpDownloader);
<?php $method->setAccessible(true);
$dlFile = $method->invoke($downloader, $newPackage, $path);
mkdir(dirname($dlFile), 0777, true);
touch($dlFile);
$loop = new Loop($this->httpDownloader);
$promise = $downloader->download($newPackage, $path, $oldPackage);
<?php $file = $this->workingDir . '/.fslckout';
if (!file_exists($file)) {
touch($file);
}
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
<?php {
$file = $this->workingDir . '/.fslckout';
touch($file);
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
<?php public function touch($files, int $time = null, int $atime = null)
{
foreach ($this->toIterable($files) as $file) {
$touch = $time ? @touch($file, $time, $atime) : @touch($file);
if (true !== $touch) {
throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
}
<?php $exec('git config user.email composertest@example.org');
$exec('git config user.name ComposerTest');
$exec('git config commit.gpgsign false');
touch('foo');
$exec('git add foo');
$exec('git commit -m init');
<?php $basepath = $this->workingDir;
$symlinked = $basepath . "/linked";
@mkdir($basepath . "/real", 0777, true);
touch($basepath . "/real/FILE");
$result = @symlink($basepath . "/real", $symlinked);
<?php public function testRemoveSymlinkedDirectoryWithTrailingSlash()
{
@mkdir($this->workingDir . "/real", 0777, true);
touch($this->workingDir . "/real/FILE");
$symlinked = $this->workingDir . "/linked";
$symlinkedTrailingSlash = $symlinked . "/";