forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjectId.php
53 lines (43 loc) · 839 Bytes
/
ObjectId.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php namespace ILIAS\Data;
use ilObject2;
/**
* Class ObjectId
*
* @package ILIAS\Data
*
* @author Fabian Schmid <[email protected]>
*/
class ObjectId
{
/**
* @var string
*/
private $object_id;
/**
* ReferenceId constructor.
*
* @param int $object_id
*/
public function __construct(int $object_id)
{
$this->object_id = $object_id;
}
/**
* @return int
*/
public function toInt() : int
{
return (int) $this->object_id;
}
/**
* @return ReferenceId[]
*/
public function toReferenceIds() : array
{
$ref_ids = [];
foreach (ilObject2::_getAllReferences($this->object_id) as $reference) {
$ref_ids[] = new ReferenceId((int) $reference);
}
return $ref_ids;
}
}