# La classe FilesystemIterator

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

## Introduction

L'itérateur FilesystemIterator.

## Synopsis de la classe

class FilesystemIterator extends DirectoryIterator {
/* Constantes */
public const int CURRENT_MODE_MASK;
public const int CURRENT_AS_PATHNAME;
public const int CURRENT_AS_FILEINFO;
public const int CURRENT_AS_SELF;
public const int KEY_MODE_MASK;
public const int KEY_AS_PATHNAME;
public const int FOLLOW_SYMLINKS;
public const int KEY_AS_FILENAME;
public const int NEW_CURRENT_AND_KEY;
public const int OTHER_MODE_MASK;
public const int SKIP_DOTS;
public const int UNIX_PATHS;
/* Méthodes */
public function __construct(string `$directory`, int `$flags` = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS)
public function current(): string|SplFileInfo|FilesystemIterator
public function getFlags(): int
public function key(): string
public function next(): void
public function rewind(): void
public function setFlags(int `$flags`): void
/* Méthodes héritées */
public function DirectoryIterator::current(): mixed
public function DirectoryIterator::getBasename(string `$suffix` = ""): string
public function DirectoryIterator::getExtension(): string
public function DirectoryIterator::getFilename(): string
public function DirectoryIterator::isDot(): bool
public function DirectoryIterator::key(): mixed
public function DirectoryIterator::next(): void
public function DirectoryIterator::rewind(): void
public function DirectoryIterator::seek(int `$offset`): void
public function DirectoryIterator::__toString(): string
public function DirectoryIterator::valid(): bool
public function SplFileInfo::getATime(): int|false
public function SplFileInfo::getBasename(string `$suffix` = ""): string
public function SplFileInfo::getCTime(): int|false
public function SplFileInfo::getExtension(): string
public function SplFileInfo::getFileInfo(?string `$class` = `null`): SplFileInfo
public function SplFileInfo::getFilename(): string
public function SplFileInfo::getGroup(): int|false
public function SplFileInfo::getInode(): int|false
public function SplFileInfo::getLinkTarget(): string|false
public function SplFileInfo::getMTime(): int|false
public function SplFileInfo::getOwner(): int|false
public function SplFileInfo::getPath(): string
public function SplFileInfo::getPathInfo(?string `$class` = `null`): ?SplFileInfo
public function SplFileInfo::getPathname(): string
public function SplFileInfo::getPerms(): int|false
public function SplFileInfo::getRealPath(): string|false
public function SplFileInfo::getSize(): int|false
public function SplFileInfo::getType(): string|false
public function SplFileInfo::isDir(): bool
public function SplFileInfo::isExecutable(): bool
public function SplFileInfo::isFile(): bool
public function SplFileInfo::isLink(): bool
public function SplFileInfo::isReadable(): bool
public function SplFileInfo::isWritable(): bool
public function SplFileInfo::openFile(string `$mode` = "r", bool `$useIncludePath` = `false`, ?resource `$context` = `null`): SplFileObject
public function SplFileInfo::setFileClass(string `$class` = `SplFileObject::class`): void
public function SplFileInfo::setInfoClass(string `$class` = `SplFileInfo::class`): void
public function SplFileInfo::__toString(): string
}

## Constantes pré-définies

`FilesystemIterator::CURRENT_AS_PATHNAME`

  FilesystemIterator::current() retourne le nom du chemin.

`FilesystemIterator::CURRENT_AS_FILEINFO`

  FilesystemIterator::current() retourne un objet SplFileInfo.

`FilesystemIterator::CURRENT_AS_SELF`

  FilesystemIterator::current() retourne `$this` (le FilesystemIterator).

`FilesystemIterator::CURRENT_MODE_MASK`

  Masque FilesystemIterator::current().

`FilesystemIterator::KEY_AS_PATHNAME`

  FilesystemIterator::key() retourne le nom de chemin.

`FilesystemIterator::KEY_AS_FILENAME`

  FilesystemIterator::key() retourne le nom du fichier.

`FilesystemIterator::FOLLOW_SYMLINKS`

  Fait suivre les liens symboliques à RecursiveDirectoryIterator::hasChildren().

`FilesystemIterator::KEY_MODE_MASK`

  Masque FilesystemIterator::key().

`FilesystemIterator::NEW_CURRENT_AND_KEY`

  Identique à `FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::CURRENT_AS_FILEINFO`.

`FilesystemIterator::OTHER_MODE_MASK`

  Masque utilisé pour FilesystemIterator::getFlags() et FilesystemIterator::setFlags().

`FilesystemIterator::SKIP_DOTS`

  Ignore les fichiers points (`.` et `..`).

`FilesystemIterator::UNIX_PATHS`

  Les chemins utilisent le séparateur de dossier de type Unix, soit le slash, indépendamment du système de fonctionnement. Il est à noter que le `chemin` qui est passé au constructeur n'est pas modifié.

## Sommaire

- FilesystemIterator::__construct — Construit un objet FilesystemIterator
- FilesystemIterator::current — Lit le fichier courant
- FilesystemIterator::getFlags — Lit les options activées
- FilesystemIterator::key — Lit le nom du fichier
- FilesystemIterator::next — Passe au fichier suivant
- FilesystemIterator::rewind — Recommence à lire le dossier
- FilesystemIterator::setFlags — Configure les options

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open