ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
Metadata.php
Go to the documentation of this file.
1
<?
php
2
declare(strict_types=1);
3
4
namespace
ILIAS\Filesystem\DTO
;
5
6
use
ILIAS\Filesystem\MetadataType
;
7
18
final
class
Metadata
19
{
20
24
private
$path
;
28
private
$type
;
29
30
46
public
function
__construct
(
string
$path
,
string
$type
)
47
{
48
if
($type !==
MetadataType::FILE
&& $type !==
MetadataType::DIRECTORY
) {
49
throw
new \InvalidArgumentException(
"The metadata type must be FILE or DIRECTORY but \"$type\" was given."
);
50
}
51
52
$this->path =
$path
;
53
$this->type =
$type
;
54
}
55
62
public
function
getPath
() : string
63
{
64
return
$this->path
;
65
}
66
67
80
public
function
getType
() : string
81
{
82
return
$this->type
;
83
}
84
85
92
public
function
isDir
() : bool
93
{
94
return
(strcmp($this->
getType
(),
MetadataType::DIRECTORY
) === 0);
95
}
96
97
104
public
function
isFile
() : bool
105
{
106
return
(strcmp($this->
getType
(),
MetadataType::FILE
) === 0);
107
}
108
}
ILIAS\Filesystem\DTO\Metadata\getType
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition:
Metadata.php:80
ILIAS\Filesystem\DTO\Metadata\__construct
__construct(string $path, string $type)
Metadata constructor.
Definition:
Metadata.php:46
ILIAS\Filesystem\DTO\Metadata\$path
$path
Definition:
Metadata.php:24
ILIAS\Filesystem\DTO\Metadata\getPath
getPath()
The path to the file or directory.
Definition:
Metadata.php:62
ILIAS\Filesystem\MetadataType\FILE
const FILE
The subject is file.
Definition:
MetadataType.php:23
ILIAS\Filesystem\DTO\Metadata\$type
$type
Definition:
Metadata.php:28
ILIAS\Filesystem\DTO\Metadata\isDir
isDir()
The path is a directory.
Definition:
Metadata.php:92
ILIAS\Filesystem\DTO\Metadata
Class Metadata.
Definition:
Metadata.php:18
ILIAS\Filesystem\DTO\Metadata\isFile
isFile()
The path is a file.
Definition:
Metadata.php:104
ILIAS\Filesystem\MetadataType\DIRECTORY
const DIRECTORY
The subject is a directory.
Definition:
MetadataType.php:27
ILIAS\Filesystem\DTO
Definition:
Metadata.php:4
php
MetadataType
src
Filesystem
DTO
Metadata.php
Generated on Thu Feb 27 2025 19:01:32 for ILIAS by
1.8.13 (using
Doxyfile
)