# La classe DirectoryIterator

(PHP 5, PHP 7, PHP 8)

## Introduction

La classe DirectoryIterator fournit une interface simple pour lire le contenu d'un système de fichiers.

## Synopsis de la classe

class DirectoryIterator extends SplFileInfo implements SeekableIterator {
/* Méthodes */
public __construct(string `$directory`)
public current(): mixed
public getBasename(string `$suffix` = ""): string
public getExtension(): string
public getFilename(): string
public isDot(): bool
public key(): mixed
public next(): void
public rewind(): void
public seek(int `$offset`): void
public __toString(): string
public valid(): bool
/* Méthodes héritées */
public SplFileInfo::getATime(): int|false
public SplFileInfo::getBasename(string `$suffix` = ""): string
public SplFileInfo::getCTime(): int|false
public SplFileInfo::getExtension(): string
public SplFileInfo::getFileInfo(?string `$class` = `null`): SplFileInfo
public SplFileInfo::getFilename(): string
public SplFileInfo::getGroup(): int|false
public SplFileInfo::getInode(): int|false
public SplFileInfo::getLinkTarget(): string|false
public SplFileInfo::getMTime(): int|false
public SplFileInfo::getOwner(): int|false
public SplFileInfo::getPath(): string
public SplFileInfo::getPathInfo(?string `$class` = `null`): ?SplFileInfo
public SplFileInfo::getPathname(): string
public SplFileInfo::getPerms(): int|false
public SplFileInfo::getRealPath(): string|false
public SplFileInfo::getSize(): int|false
public SplFileInfo::getType(): string|false
public SplFileInfo::isDir(): bool
public SplFileInfo::isExecutable(): bool
public SplFileInfo::isFile(): bool
public SplFileInfo::isLink(): bool
public SplFileInfo::isReadable(): bool
public SplFileInfo::isWritable(): bool
public SplFileInfo::openFile(string `$mode` = "r", bool `$useIncludePath` = `false`, ?resource `$context` = `null`): SplFileObject
public SplFileInfo::setFileClass(string `$class` = SplFileObject::class): void
public SplFileInfo::setInfoClass(string `$class` = SplFileInfo::class): void
public SplFileInfo::__toString(): string
}

## Sommaire

- DirectoryIterator::__construct — Construit un nouvel itérateur de dossier à partir d'un chemin
- DirectoryIterator::current — Retourne l'élément courant du DirectoryIterator
- DirectoryIterator::getBasename — Lit le nom de dossier de l'élément DirectoryIterator
- DirectoryIterator::getExtension — Récupère l'extension du fichier
- DirectoryIterator::getFilename — Retourne le nom de l'entrée courante du dossier
- DirectoryIterator::isDot — Retourne true si l'entrée courante est '.' ou '..'
- DirectoryIterator::key — Retourne l'entrée courante du dossier
- DirectoryIterator::next — Se déplace vers la prochaine entrée
- DirectoryIterator::rewind — Revient au début du dossier
- DirectoryIterator::seek — Déplace le pointeur dans un itérateur DirectoryIterator
- DirectoryIterator::__toString — Lit le nom du fichier
- DirectoryIterator::valid — Vérifie si le répertoire contient encore des entrées