ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
StaticRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
27 protected array $activities = [];
28
32 public function __construct(
33 array $activities
34 ) {
35 foreach ($activities as $activity) {
36 if (!($activity instanceof Activity)) {
37 throw new \InvalidArgumentException(
38 "Expected `Activity`, got: " . get_class($activity)
39 );
40 }
41 $this->activities[(string) $activity->getName()] = $activity;
42 }
43 }
44
45 public function getActivitiesByName(string $name_matcher, ?ActivityType $type = null, ?Range $range = null): \Iterator
46 {
47 foreach ($this->activities as $name => $activity) {
48 if (preg_match($name_matcher, $name)) {
49 yield $name => $activity;
50 }
51 }
52 }
53}
getActivitiesByName(string $name_matcher, ?ActivityType $type=null, ?Range $range=null)
Get all activities where the name matches the provided regexp.
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
An Activity is an action on the domain layer action of a component.
Definition: Activity.php:41