本文整理匯總了PHP中Symfony\Component\Finder\Finder::sortByAccessedTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Finder::sortByAccessedTime方法的具體用法?PHP Finder::sortByAccessedTime怎麽用?PHP Finder::sortByAccessedTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Finder\Finder
的用法示例。
在下文中一共展示了Finder::sortByAccessedTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sortBy
/**
* @param string|callable $by
* @return $this
*/
public function sortBy($by = self::SORT_BY_NAME)
{
if (is_callable($by)) {
$this->finder->sort($by);
return $this;
}
switch (strtolower($by)) {
case self::SORT_BY_NAME:
case 'name':
$this->finder->sortByName();
break;
case self::SORT_BY_CHANGED_TIME:
case 'ctime':
$this->finder->sortByChangedTime();
break;
case self::SORT_BY_ACCESSED_TIME:
case 'atime':
$this->finder->sortByAccessedTime();
break;
case self::SORT_BY_TYPE:
case 'type':
$this->finder->sortByType();
break;
case self::SORT_BY_MODIFIED_TIME:
case 'mtime':
$this->finder->sortByModifiedTime();
break;
default:
throw new \InvalidArgumentException($by . ' is not a supported argument for sorting.');
}
return $this;
}
示例2: find
/**
*
* @param SpritePackageInterface[]|Package[] $packages
* @return SpriteImage
*/
public function find($packages)
{
// Get icons
$sprites = [];
foreach ($packages as $package) {
foreach ($package->getPaths() as $path) {
$finder = new Finder();
$finder->sortByChangedTime();
$finder->sortByAccessedTime();
$finder->name('/\\.(png|jpg|gif)$/');
foreach ($finder->in($path) as $fileInfo) {
$sprite = new SpriteImage($path, $fileInfo);
if (!array_key_exists($sprite->hash, $sprites)) {
// Add new sprite to set if hash does not exists
$sprites[$sprite->hash] = $sprite;
}
// Sprite with selected hash exists, just add package
if (!in_array($package, $sprites[$sprite->hash]->packages)) {
$sprites[$sprite->hash]->packages[] = $package;
}
}
}
}
return $sprites;
}
示例3: sortByAccessedTime
/**
* @return Finder
*/
public function sortByAccessedTime()
{
return parent::sortByAccessedTime();
}