Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp
<?php time(): int
<?php namespace League\Flysystem\InMemory {
function time() {
if ( ! is_mocked('time')) {
return \time();
}
return return_mocked_value('time');
<?php $this->assertInstanceOf(FileAttributes::class, $attributes);
$this->assertIsInt($attributes->lastModified());
$this->assertTrue($attributes->lastModified() > time() - 30);
$this->assertTrue($attributes->lastModified() < time() + 30);
});
}
<?php $this->assertInstanceOf(FileAttributes::class, $attributes);
$this->assertIsInt($attributes->lastModified());
$this->assertTrue($attributes->lastModified() > time() - 30);
$this->assertTrue($attributes->lastModified() < time() + 30);
});
}
<?php return;
}
$firstTryAt = \time();
$lastTryAt = $firstTryAt + 60;
while (time() <= $lastTryAt) {
<?php $firstTryAt = \time();
$lastTryAt = $firstTryAt + 60;
while (time() <= $lastTryAt) {
try {
$scenario();
<?php public function exposing_last_modified(): void
{
$attrs = new DirectoryAttributes('some/path', null, $timestamp = time());
$this->assertEquals($timestamp, $attrs->lastModified());
}
<?php public function exposing_all_values(): void
{
$attrs = new FileAttributes('path.txt', 1234, Visibility::PRIVATE, $now = time(), 'plain/text', ['key' => 'value']);
$this->assertEquals('path.txt', $attrs->path());
$this->assertEquals(StorageAttributes::TYPE_FILE, $attrs->type());
$this->assertEquals(Visibility::PRIVATE, $attrs->visibility());
<?php public function implements_array_access(): void
{
$attrs = new FileAttributes('path.txt', 1234, Visibility::PRIVATE, $now = time(), 'plain/text', ['key' => 'value']);
$this->assertEquals('path.txt', $attrs['path']);
$this->assertTrue(isset($attrs['path']));
$this->assertEquals(StorageAttributes::TYPE_FILE, $attrs['type']);
<?php public function data_provider_for_json_transformation(): Generator
{
yield [new FileAttributes('path.txt', 1234, Visibility::PRIVATE, $now = time(), 'plain/text', ['key' => 'value'])];
yield [new FileAttributes('another.txt')];
}
}
<?php $lastModified = $this->filesystem->lastModified('path.txt');
$this->assertIsInt($lastModified);
$this->assertTrue($lastModified > time() - 30);
$this->assertTrue($lastModified < time() + 30);
}
<?php $this->assertIsInt($lastModified);
$this->assertTrue($lastModified > time() - 30);
$this->assertTrue($lastModified < time() + 30);
}
<?php public function updateContents(string $contents): void
{
$this->contents = $contents;
$this->lastModified = time();
}
public function lastModified(): int
<?php {
$adapter = new LocalFilesystemAdapter(static::ROOT);
$adapter->write('first.txt', 'contents', new Config());
mock_function('filemtime', $now = time());
$lastModified = $adapter->lastModified('first.txt')->lastModified();
$this->assertEquals($now, $lastModified);
}
<?php public function retrieving_metadata(): void
{
$now = time();
$this->firstFilesystem->write('location.txt', 'contents');
$lastModified = $this->mountManager->lastModified('first://location.txt');
<?php ]);
$provider = new FtpConnectionProvider();
$start = time();
$connected = false;
while(time() - $start < 60) {