ILIAS  release_8 Revision v8.23
ILIAS\Filesystem\DTO\Metadata Class Reference

Class Metadata. More...

+ Collaboration diagram for ILIAS\Filesystem\DTO\Metadata:

Public Member Functions

 __construct (string $path, string $type)
 Metadata constructor. More...
 
 getPath ()
 The path to the file or directory. More...
 
 getType ()
 The type of the subject which can be FILE or DIRECTORY. More...
 
 isDir ()
 The path is a directory. More...
 
 isFile ()
 The path is a file. More...
 

Private Attributes

string $path
 
string $type
 

Detailed Description

Class Metadata.

This class holds all default metadata send by the filesystem adapters. Metadata instances are immutable.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.0

Definition at line 19 of file Metadata.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Filesystem\DTO\Metadata::__construct ( string  $path,
string  $type 
)

Metadata constructor.

Creates a new instance of the Metadata.

Definition at line 40 of file Metadata.php.

References ILIAS\Filesystem\DTO\Metadata\$path, ILIAS\Filesystem\DTO\Metadata\$type, ILIAS\Filesystem\MetadataType\DIRECTORY, and ILIAS\Filesystem\MetadataType\FILE.

41  {
43  throw new \InvalidArgumentException("The metadata type must be FILE or DIRECTORY but \"$type\" was given.");
44  }
45 
46  $this->path = $path;
47  $this->type = $type;
48  }
const FILE
The subject is file.
const DIRECTORY
The subject is a directory.

Member Function Documentation

◆ getPath()

ILIAS\Filesystem\DTO\Metadata::getPath ( )

The path to the file or directory.

Returns
string
Since
5.3

Definition at line 56 of file Metadata.php.

References ILIAS\Filesystem\DTO\Metadata\$path.

Referenced by ILIAS\Filesystem\Finder\Iterator\SortableIterator\__construct(), ILIAS\Filesystem\Finder\Iterator\RecursiveDirectoryIterator\rewind(), and ilFileSystemCleanTempDirCron\run().

56  : string
57  {
58  return $this->path;
59  }
+ Here is the caller graph for this function:

◆ getType()

ILIAS\Filesystem\DTO\Metadata::getType ( )

The type of the subject which can be FILE or DIRECTORY.

Use isDir or isFile in consumer-code and do not compare yourself against MetadataType::DIRECTORY or MetadataType::FILE

Returns
string
Since
5.3

Definition at line 74 of file Metadata.php.

References ILIAS\Filesystem\DTO\Metadata\$type.

Referenced by ILIAS\Filesystem\DTO\Metadata\isDir(), and ILIAS\Filesystem\DTO\Metadata\isFile().

74  : string
75  {
76  return $this->type;
77  }
+ Here is the caller graph for this function:

◆ isDir()

ILIAS\Filesystem\DTO\Metadata::isDir ( )

The path is a directory.

Returns
bool
Since
5.3

Definition at line 86 of file Metadata.php.

References ILIAS\Filesystem\MetadataType\DIRECTORY, and ILIAS\Filesystem\DTO\Metadata\getType().

Referenced by ILIAS\Filesystem\Finder\Iterator\SortableIterator\__construct().

86  : bool
87  {
88  return (strcmp($this->getType(), MetadataType::DIRECTORY) === 0);
89  }
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition: Metadata.php:74
const DIRECTORY
The subject is a directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFile()

ILIAS\Filesystem\DTO\Metadata::isFile ( )

The path is a file.

Returns
bool
Since
5.3

Definition at line 98 of file Metadata.php.

References ILIAS\Filesystem\MetadataType\FILE, and ILIAS\Filesystem\DTO\Metadata\getType().

Referenced by ILIAS\Filesystem\Finder\Iterator\SortableIterator\__construct().

98  : bool
99  {
100  return (strcmp($this->getType(), MetadataType::FILE) === 0);
101  }
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition: Metadata.php:74
const FILE
The subject is file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $path

string ILIAS\Filesystem\DTO\Metadata::$path
private

◆ $type

string ILIAS\Filesystem\DTO\Metadata::$type
private

The documentation for this class was generated from the following file: