ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
Context.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\File\Capabilities
;
22
26
class
Context
implements
\Stringable
27
{
28
public
const
CONTEXT_REPO
= 1;
29
public
const
CONTEXT_WORKSPACE
= 2;
30
public
const
CONTEXT_SEARCH
= 6;
31
32
public
function
__construct
(
33
private
int
$object_id,
34
private
int
$calling_id,
35
private
int
$context
36
) {
37
// $context mut be one of the constants
38
if
($context !== self::CONTEXT_REPO && $context !== self::CONTEXT_WORKSPACE && $context !== self::CONTEXT_SEARCH) {
39
throw
new \InvalidArgumentException(
'Invalid context'
);
40
}
41
}
42
43
public
function
getObjectId
():
int
44
{
45
return
$this->object_id;
46
}
47
48
public
function
getCallingId
():
int
49
{
50
return
$this->calling_id;
51
}
52
53
public
function
getContext
():
int
54
{
55
return
$this->context
;
56
}
57
58
public
function
getNode
(): string
59
{
60
return
$this->
getContext
() .
'_'
. $this->
getCallingId
();
61
}
62
63
public
function
withCallingId
(
int
$calling_id): self
64
{
65
$clone = clone $this;
66
$clone->calling_id = $calling_id;
67
return
$clone;
68
}
69
70
public
function
withObjectId
(
int
$object_id): self
71
{
72
$clone = clone $this;
73
$clone->object_id = $object_id;
74
return
$clone;
75
}
76
77
public
function
__toString
(): string
78
{
79
return
(
string
) $this->
getCallingId
();
80
}
81
82
}
$context
$context
Definition:
webdav.php:31
ILIAS\File\Capabilities\Context\__toString
__toString()
Definition:
Context.php:77
ILIAS\File\Capabilities\Context\CONTEXT_REPO
const CONTEXT_REPO
Definition:
Context.php:28
ILIAS\File\Capabilities\Context\withObjectId
withObjectId(int $object_id)
Definition:
Context.php:70
ILIAS\File\Capabilities\Context\getNode
getNode()
Definition:
Context.php:58
ILIAS\File\Capabilities\Context\getCallingId
getCallingId()
Definition:
Context.php:48
ILIAS\File\Capabilities\Context\CONTEXT_WORKSPACE
const CONTEXT_WORKSPACE
Definition:
Context.php:29
ILIAS\File\Capabilities\Context\getContext
getContext()
Definition:
Context.php:53
ILIAS\File\Capabilities\Context\withCallingId
withCallingId(int $calling_id)
Definition:
Context.php:63
ILIAS\File\Capabilities
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
Capabilities.php:22
ILIAS\File\Capabilities\Context\CONTEXT_SEARCH
const CONTEXT_SEARCH
Definition:
Context.php:30
ILIAS\File\Capabilities\Context\__construct
__construct(private int $object_id, private int $calling_id, private int $context)
Definition:
Context.php:32
ILIAS\File\Capabilities\Context\getObjectId
getObjectId()
Definition:
Context.php:43
ILIAS\File\Capabilities\Context
Definition:
Context.php:26
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
Stringable
components
ILIAS
File
classes
Capabilities
Context.php
Generated on Sun Aug 31 2025 23:02:39 for ILIAS by
1.8.13 (using
Doxyfile
)