ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Metadata.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
32final class Metadata
33{
34 private string $type;
35
51 public function __construct(private string $path, string $type)
52 {
54 throw new \InvalidArgumentException("The metadata type must be FILE or DIRECTORY but \"$type\" was given.");
55 }
56 $this->type = $type;
57 }
58
63 public function getPath(): string
64 {
65 return $this->path;
66 }
67
77 public function getType(): string
78 {
79 return $this->type;
80 }
81
86 public function isDir(): bool
87 {
88 return (strcmp($this->getType(), MetadataType::DIRECTORY) === 0);
89 }
90
95 public function isFile(): bool
96 {
97 return (strcmp($this->getType(), MetadataType::FILE) === 0);
98 }
99}
This class holds all default metadata send by the filesystem adapters.
Definition: Metadata.php:33
getPath()
The path to the file or directory.
Definition: Metadata.php:63
__construct(private string $path, string $type)
Metadata constructor.
Definition: Metadata.php:51
isFile()
The path is a file.
Definition: Metadata.php:95
isDir()
The path is a directory.
Definition: Metadata.php:86
getType()
The type of the subject which can be FILE or DIRECTORY.
Definition: Metadata.php:77
The possible metadata types of the filesystem metadata.
const FILE
The subject is file.
const DIRECTORY
The subject is a directory.
$path
Definition: ltiservices.php:30