ILIAS
release_8 Revision v8.23
◀ ilDoc Overview
Metadata.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
ILIAS\Filesystem\DTO
;
6
7
use
ILIAS\Filesystem\MetadataType
;
8
19
final
class
Metadata
20
{
21
private
string
$path
;
22
private
string
$type
;
23
24
40
public
function
__construct
(
string
$path,
string
$type)
41
{
42
if
($type !==
MetadataType::FILE
&& $type !==
MetadataType::DIRECTORY
) {
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
}
49
56
public
function
getPath
(): string
57
{
58
return
$this->path
;
59
}
60
61
74
public
function
getType
(): string
75
{
76
return
$this->type
;
77
}
78
79
86
public
function
isDir
(): bool
87
{
88
return
(strcmp($this->
getType
(),
MetadataType::DIRECTORY
) === 0);
89
}
90
91
98
public
function
isFile
(): bool
99
{
100
return
(strcmp($this->
getType
(),
MetadataType::FILE
) === 0);
101
}
102
}
ILIAS\Filesystem\DTO\Metadata\getType
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition:
Metadata.php:74
ILIAS\Filesystem\DTO\Metadata\__construct
__construct(string $path, string $type)
Metadata constructor.
Definition:
Metadata.php:40
ILIAS\Filesystem\DTO\Metadata\$path
string $path
Definition:
Metadata.php:21
ILIAS\Filesystem\DTO\Metadata\getPath
getPath()
The path to the file or directory.
Definition:
Metadata.php:56
ILIAS\Filesystem\MetadataType\FILE
const FILE
The subject is file.
Definition:
MetadataType.php:23
ILIAS\Filesystem\DTO\Metadata\$type
string $type
Definition:
Metadata.php:22
ILIAS\Filesystem\DTO\Metadata\isDir
isDir()
The path is a directory.
Definition:
Metadata.php:86
ILIAS\Filesystem\DTO\Metadata
Class Metadata.
Definition:
Metadata.php:19
ILIAS\Filesystem\DTO\Metadata\isFile
isFile()
The path is a file.
Definition:
Metadata.php:98
ILIAS\Filesystem\MetadataType\DIRECTORY
const DIRECTORY
The subject is a directory.
Definition:
MetadataType.php:27
ILIAS\Filesystem\DTO
Definition:
Metadata.php:5
MetadataType
src
Filesystem
DTO
Metadata.php
Generated on Sun Aug 31 2025 22:02:44 for ILIAS by
1.8.13 (using
Doxyfile
)