Symfony\Component\Finder\Finder::sortByModifiedTime PHP Method

sortByModifiedTime() public method

This is the last time the actual contents of the file were last modified. This can be slow as all the matching files and directories must be retrieved for comparison.
See also: SortableIterator
public sortByModifiedTime ( ) : Finder | Symfony\Component\Finder\SplFileInfo[]
return Finder | Symfony\Component\Finder\SplFileInfo[] The current Finder instance
    public function sortByModifiedTime()
    {
        $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;

        return $this;
    }

Usage Example

コード例 #1
2
ファイル: FileFinderBuilder.php プロジェクト: suralc/pvra
 /**
  * @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;
 }
All Usage Examples Of Symfony\Component\Finder\Finder::sortByModifiedTime