ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Modules\Test\AccessQuestionImage Class Reference
+ Inheritance diagram for ILIAS\Modules\Test\AccessQuestionImage:
+ Collaboration diagram for ILIAS\Modules\Test\AccessQuestionImage:

Public Member Functions

 __construct (Readable $readable)
 
 isPermitted (string $path)
 
 isPermitted (string $path)
 

Private Member Functions

 objectId (string $path)
 

Private Attributes

 $readable
 

Detailed Description

Definition at line 29 of file AccessQuestionImage.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Modules\Test\AccessQuestionImage::__construct ( Readable  $readable)

Member Function Documentation

◆ isPermitted()

ILIAS\Modules\Test\AccessQuestionImage::isPermitted ( string  $path)
Returns
Result<bool>

Implements ILIAS\Modules\Test\SimpleAccess.

Definition at line 39 of file AccessQuestionImage.php.

39 : Result
40 {
41 $object_id = $this->objectId($path);
42 if (!$object_id) {
43 return new Error('Not a question image path of test questions.');
44 }
45
46 return new Ok($this->readable->objectId($object_id));
47 }

References ILIAS\Modules\Test\AccessQuestionImage\objectId().

+ Here is the call graph for this function:

◆ objectId()

ILIAS\Modules\Test\AccessQuestionImage::objectId ( string  $path)
private

Definition at line 49 of file AccessQuestionImage.php.

49 : ?int
50 {
51 $results = [];
52 if (!preg_match(':/assessment/(\d+)/(\d+)/images/([^/]+)$:', $path, $results)) {
53 return null;
54 }
55
56 return (int) $results[1];
57 }
$results

References $results.

Referenced by ILIAS\Modules\Test\AccessQuestionImage\isPermitted().

+ Here is the caller graph for this function:

Field Documentation

◆ $readable

ILIAS\Modules\Test\AccessQuestionImage::$readable
private

The documentation for this class was generated from the following file: