ILIAS  trunk Revision v11.0_alpha-2406-g7062992332c
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Filesystem\DTO\Metadata Class Reference

This class holds all default metadata send by the filesystem adapters. More...

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

Public Member Functions

 __construct (private 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 $type
 

Detailed Description

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
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 31 of file Metadata.php.

Constructor & Destructor Documentation

◆ __construct()

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

Metadata constructor.

Creates a new instance of the Metadata.

Parameters
string$pathThe path to the parent of the file or directory.
string$typeThe file type which can be -> file or directory. Please note that only constants defined in the MetadataType interface are considered as valid.
Exceptions

Definition at line 50 of file Metadata.php.

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

51  {
53  throw new \InvalidArgumentException("The metadata type must be FILE or DIRECTORY but \"$type\" was given.");
54  }
55  $this->type = $type;
56  }
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.

Definition at line 62 of file Metadata.php.

References $path.

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

62  : string
63  {
64  return $this->path;
65  }
$path
Definition: ltiservices.php:29
+ 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

Definition at line 76 of file Metadata.php.

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

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

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

◆ isDir()

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

The path is a directory.

Definition at line 85 of file Metadata.php.

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

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

85  : bool
86  {
87  return (strcmp($this->getType(), MetadataType::DIRECTORY) === 0);
88  }
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition: Metadata.php:76
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.

Definition at line 94 of file Metadata.php.

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

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

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

Field Documentation

◆ $type

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

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