ILIAS  release_8 Revision v8.24
ResourceCollection.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
33{
34 public const NO_SPECIFIC_OWNER = -1;
35 private array $resource_identifications = [];
39 private string $title = 'default';
41 private int $owner;
42
43 public function __construct(
45 int $owner,
46 string $title // currently unused
47 ) {
48 $this->identification = $identification;
49 $this->owner = $owner;
50 }
51
53 {
55 }
56
57 public function hasSpecificOwner(): bool
58 {
59 return $this->owner !== self::NO_SPECIFIC_OWNER;
60 }
61
62 public function getOwner(): int
63 {
64 return $this->owner;
65 }
66
67 public function getTitle(): string
68 {
69 return $this->title;
70 }
71
73 {
74 $this->resource_identifications[] = $identification;
75 }
76
77 public function remove(ResourceIdentification $identification): void
78 {
79 $this->resource_identifications = array_filter(
80 $this->resource_identifications,
81 fn (ResourceIdentification $i): bool => $i->serialize() !== $identification->serialize()
82 );
83 }
84
86 {
87 foreach ($this->resource_identifications as $i) {
88 if ($i->serialize() === $identification->serialize()) {
89 return true;
90 }
91 }
92 return false;
93 }
94
98 public function getResourceIdentifications(): array
99 {
101 }
102
103 public function count(): int
104 {
105 return count($this->resource_identifications);
106 }
107
108 public function clear(): void
109 {
110 $this->resource_identifications = [];
111 }
112}
add(ResourceIdentification $identification)
__construct(ResourceCollectionIdentification $identification, int $owner, string $title)
isIn(ResourceIdentification $identification)
$i
Definition: metadata.php:41