ILIAS  release_7 Revision v7.30-3-g800a261c036
Readable.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Modules\Test;
22
23use Closure;
25use ilObject;
26
28{
30 private $container;
34 private $incident;
35
36 public function __construct(
38 $references_of = [ilObject::class, '_getAllReferences'],
39 Incident $incident = null
40 ) {
41 $this->container = $container;
42 $this->references_of = Closure::fromCallable($references_of);
43 $this->incident = $incident ?? new Incident();
44 }
45
49 public function references(array $references): bool
50 {
51 return $this->incident->any(function (int $ref_id): bool {
52 return $this->container->access()->checkAccess('read', '', $ref_id);
53 }, $references);
54 }
55
56 public function objectId(int $obj_id): bool
57 {
58 return $this->references(array_map('intval', ($this->references_of)($obj_id)));
59 }
60}
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:19
__construct(Container $container, $references_of=[ilObject::class, '_getAllReferences'], Incident $incident=null)
Definition: Readable.php:36
references(array $references)
Definition: Readable.php:49
Class ilObject Basic functions for all objects.