本文整理汇总了PHP中SplFileInfo::getATime方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::getATime方法的具体用法?PHP SplFileInfo::getATime怎么用?PHP SplFileInfo::getATime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplFileInfo
的用法示例。
在下文中一共展示了SplFileInfo::getATime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getATime
public function getATime()
{
return $this->file->getATime();
}
示例2: testDecoratedMethods
public function testDecoratedMethods()
{
$decorated = $this->getMockBuilder('hanneskod\\classtools\\Tests\\MockSplFileInfo')->setConstructorArgs([''])->getMock();
$decorated->expects($this->once())->method('getRelativePath');
$decorated->expects($this->once())->method('getRelativePathname');
$decorated->expects($this->once())->method('getContents');
$decorated->expects($this->once())->method('getATime');
$decorated->expects($this->once())->method('getBasename');
$decorated->expects($this->once())->method('getCTime');
$decorated->expects($this->once())->method('getExtension');
$decorated->expects($this->once())->method('getFileInfo');
$decorated->expects($this->once())->method('getFilename');
$decorated->expects($this->once())->method('getGroup');
$decorated->expects($this->once())->method('getInode');
$decorated->expects($this->once())->method('getLinkTarget');
$decorated->expects($this->once())->method('getMTime');
$decorated->expects($this->once())->method('getOwner');
$decorated->expects($this->once())->method('getPath');
$decorated->expects($this->once())->method('getPathInfo');
$decorated->expects($this->once())->method('getPathname');
$decorated->expects($this->once())->method('getPerms');
$decorated->expects($this->once())->method('getRealPath');
$decorated->expects($this->once())->method('getSize');
$decorated->expects($this->once())->method('getType');
$decorated->expects($this->once())->method('isDir');
$decorated->expects($this->once())->method('isExecutable');
$decorated->expects($this->once())->method('isFile');
$decorated->expects($this->once())->method('isLink');
$decorated->expects($this->once())->method('isReadable');
$decorated->expects($this->once())->method('isWritable');
$decorated->expects($this->once())->method('openFile');
$decorated->expects($this->once())->method('setFileClass');
$decorated->expects($this->once())->method('setInfoClass');
$decorated->expects($this->once())->method('__toString')->will($this->returnValue(''));
$fileInfo = new SplFileInfo($decorated);
$fileInfo->getRelativePath();
$fileInfo->getRelativePathname();
$fileInfo->getContents();
$fileInfo->getATime();
$fileInfo->getBasename();
$fileInfo->getCTime();
$fileInfo->getExtension();
$fileInfo->getFileInfo();
$fileInfo->getFilename();
$fileInfo->getGroup();
$fileInfo->getInode();
$fileInfo->getLinkTarget();
$fileInfo->getMTime();
$fileInfo->getOwner();
$fileInfo->getPath();
$fileInfo->getPathInfo();
$fileInfo->getPathname();
$fileInfo->getPerms();
$fileInfo->getRealPath();
$fileInfo->getSize();
$fileInfo->getType();
$fileInfo->isDir();
$fileInfo->isExecutable();
$fileInfo->isFile();
$fileInfo->isLink();
$fileInfo->isReadable();
$fileInfo->isWritable();
$fileInfo->openFile();
$fileInfo->setFileClass();
$fileInfo->setInfoClass();
(string) $fileInfo;
}
示例3: getATime
public function getATime($format = false)
{
if ($format) {
return date($format, parent::getATime());
}
return parent::getATime();
}
示例4: spy
/**
* Returns basic information about created file/object
* @param string $entityName name of class
* @param mixed $entityId id of entity
* @return null|array basic information
*/
public function spy($entityName, $entityId)
{
$file = sprintf('%s/%s/%s.json', $this->config->dir, $entityName, $entityId);
if (file_exists($file)) {
$file = new \SplFileInfo($file);
$result = array();
$result['last_modified_time'] = $file->getATime();
$result['size'] = $file->getSize();
return $result;
} else {
return null;
}
}
示例5: inRange
<?php
function inRange($x, $a, $b)
{
return $x >= $a && $x <= $b ? "YES" : "NO";
}
$file = tempnam(sys_get_temp_dir(), 'touch_date');
// No args
$now = time();
touch($file);
$fileInfo = new SplFileInfo($file);
print inRange($fileInfo->getMTime(), $now, $now + 10) . "\n";
print inRange($fileInfo->getATime(), $now, $now + 10) . "\n";
// Mofification time only
touch($file, strtotime("@100200300"));
$fileInfo = new SplFileInfo($file);
print $fileInfo->getMTime() . "\n";
print $fileInfo->getATime() . "\n";
// Modification and access time
touch($file, strtotime("@100200300"), strtotime("@100400500"));
$fileInfo = new SplFileInfo($file);
print $fileInfo->getMTime() . "\n";
print $fileInfo->getATime() . "\n";
示例6: testLastAccessed
/**
* @depends testExist
* @return void
*/
public function testLastAccessed()
{
$filePath = __DIR__ . '/example.txt';
$fileObject = new File($filePath);
$this->assertGreaterThanOrEqual(0, $fileObject->getATime());
$this->assertInstanceOf('DateTime', $fileObject->lastAccessed());
$fileObject = new \SplFileInfo($filePath);
$this->assertGreaterThanOrEqual(0, $fileObject->getATime());
}
示例7: getFileDetailsRawStatistic
protected function getFileDetailsRawStatistic(\SplFileInfo $info, $fileGiven)
{
return ['File is Dir' => $info->isDir(), 'File is Executable' => $info->isExecutable(), 'File is File' => $info->isFile(), 'File is Link' => $info->isLink(), 'File is Readable' => $info->isReadable(), 'File is Writable' => $info->isWritable(), 'File Permissions' => $this->explainPerms($info->getPerms()), 'Size' => $info->getSize(), 'Sha1' => sha1_file($fileGiven), 'Timestamp Accessed' => $this->getFileTimes($info->getATime()), 'Timestamp Changed' => $this->getFileTimes($info->getCTime()), 'Timestamp Modified' => $this->getFileTimes($info->getMTime())];
}
示例8: testSpy
public function testSpy()
{
$genClass = $this->container['config']->get('id_gen_strategy_class');
$entity = new \stdClass();
$entity->id = $genClass::generate();
$entity->foo = "bar";
$this->container['em']->persist($entity);
$foundEntity = $this->container['em']->find('stdClass', $entity->id);
$file = new \SplFileInfo(sprintf('%s/%s/%s.json', $this->container['config']->get('dir'), get_class($entity), $entity->id));
$currentCheck = array();
$currentCheck['last_modified_time'] = $file->getATime();
$currentCheck['size'] = $file->getSize();
$this->assertEquals($currentCheck, $this->container['em']->spy('stdClass', $entity->id));
$this->assertNull($this->container['em']->spy('stdClass', uniqid()));
}
示例9: isCollectibleFile
/**
* Checks if the given file can be removed.
*
* @param \SplFileInfo $file
* @return boolean
*/
private function isCollectibleFile(\SplFileInfo $file)
{
if (false === $file->isFile()) {
return false;
}
$time = $file->getATime();
if ($time > $this->minTime) {
return false;
}
$time = $file->getMTime();
if ($time > $this->minTime) {
return false;
}
return true;
}