Subversion Repositories oidplus

Rev

Rev 1086 | Rev 1119 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1086 Rev 1116
Line 24... Line 24...
24
// phpcs:enable PSR1.Files.SideEffects
24
// phpcs:enable PSR1.Files.SideEffects
25
 
25
 
26
class OIDplusOid extends OIDplusObject {
26
class OIDplusOid extends OIDplusObject {
27
        private $oid;
27
        private $oid;
28
 
28
 
-
 
29
        /**
-
 
30
         * @param $oid
-
 
31
         * @throws OIDplusException
-
 
32
         */
29
        public function __construct($oid) {
33
        public function __construct($oid) {
30
                $bak_oid = $oid;
34
                $bak_oid = $oid;
31
 
35
 
32
                $oid = sanitizeOID($oid, 'auto');
36
                $oid = sanitizeOID($oid, 'auto');
33
                if ($oid === false) {
37
                if ($oid === false) {
Line 40... Line 44...
40
                }
44
                }
41
 
45
 
42
                $this->oid = $oid;
46
                $this->oid = $oid;
43
        }
47
        }
44
 
48
 
-
 
49
        /**
-
 
50
         * @param string $node_id
-
 
51
         * @return OIDplusOid|null
-
 
52
         */
45
        public static function parse($node_id) {
53
        public static function parse(string $node_id)/*: ?OIDplusOid*/ {
46
                @list($namespace, $oid) = explode(':', $node_id, 2);
54
                @list($namespace, $oid) = explode(':', $node_id, 2);
47
                if ($namespace !== self::ns()) return false;
55
                if ($namespace !== self::ns()) return null;
48
                return new self($oid);
56
                return new self($oid);
49
        }
57
        }
50
 
58
 
-
 
59
        /**
-
 
60
         * @return string
-
 
61
         */
51
        public static function objectTypeTitle() {
62
        public static function objectTypeTitle(): string {
52
                return _L('Object Identifier (OID)');
63
                return _L('Object Identifier (OID)');
53
        }
64
        }
54
 
65
 
-
 
66
        /**
-
 
67
         * @return string
-
 
68
         */
55
        public static function objectTypeTitleShort() {
69
        public static function objectTypeTitleShort(): string {
56
                return _L('OID');
70
                return _L('OID');
57
        }
71
        }
58
 
72
 
-
 
73
        /**
-
 
74
         * @return string
-
 
75
         */
59
        public static function ns() {
76
        public static function ns(): string {
60
                return 'oid';
77
                return 'oid';
61
        }
78
        }
62
 
79
 
-
 
80
        /**
-
 
81
         * @return string
-
 
82
         */
63
        public static function root() {
83
        public static function root(): string {
64
                return self::ns().':';
84
                return self::ns().':';
65
        }
85
        }
66
 
86
 
-
 
87
        /**
-
 
88
         * @return bool
-
 
89
         */
67
        public function isRoot() {
90
        public function isRoot(): bool {
68
                return $this->oid == '';
91
                return $this->oid == '';
69
        }
92
        }
70
 
93
 
-
 
94
        /**
-
 
95
         * @param bool $with_ns
-
 
96
         * @return string
-
 
97
         */
71
        public function nodeId($with_ns=true) {
98
        public function nodeId(bool $with_ns=true): string {
72
                return $with_ns ? self::root().$this->oid : $this->oid;
99
                return $with_ns ? self::root().$this->oid : $this->oid;
73
        }
100
        }
74
 
101
 
-
 
102
        /**
-
 
103
         * @param string $str
-
 
104
         * @return string
-
 
105
         * @throws OIDplusException
-
 
106
         */
75
        public function addString($str) {
107
        public function addString(string $str): string {
76
                if (!$this->isRoot()) {
108
                if (!$this->isRoot()) {
77
                        if (strpos($str,'.') !== false) throw new OIDplusException(_L('Please only submit one arc (not an absolute OID or multiple arcs).'));
109
                        if (strpos($str,'.') !== false) throw new OIDplusException(_L('Please only submit one arc (not an absolute OID or multiple arcs).'));
78
                }
110
                }
79
 
111
 
80
                return $this->appendArcs($str)->nodeId();
112
                return $this->appendArcs($str)->nodeId();
81
        }
113
        }
82
 
114
 
-
 
115
        /**
-
 
116
         * @param OIDplusObject $parent
-
 
117
         * @return string
-
 
118
         */
83
        public function crudShowId(OIDplusObject $parent) {
119
        public function crudShowId(OIDplusObject $parent): string {
84
                if ($parent instanceof OIDplusOid) {
120
                if ($parent instanceof OIDplusOid) {
85
                        return $this->deltaDotNotation($parent);
121
                        return $this->deltaDotNotation($parent);
-
 
122
                } else {
-
 
123
                        return '';
86
                }
124
                }
87
        }
125
        }
88
 
126
 
-
 
127
        /**
-
 
128
         * @param OIDplusObject|null $parent
-
 
129
         * @return string
-
 
130
         */
89
        public function jsTreeNodeName(OIDplusObject $parent = null) {
131
        public function jsTreeNodeName(OIDplusObject $parent = null): string {
90
                if ($parent == null) return $this->objectTypeTitle();
132
                if ($parent == null) return $this->objectTypeTitle();
91
                if ($parent instanceof OIDplusOid) {
133
                if ($parent instanceof OIDplusOid) {
92
                        return $this->viewGetArcAsn1s($parent);
134
                        return $this->viewGetArcAsn1s($parent);
93
                } else {
135
                } else {
94
                        return '';
136
                        return '';
95
                }
137
                }
96
        }
138
        }
97
 
139
 
-
 
140
        /**
-
 
141
         * @return string
-
 
142
         */
98
        public function defaultTitle() {
143
        public function defaultTitle(): string {
99
                return _L('OID %1',$this->oid);
144
                return _L('OID %1',$this->oid);
100
        }
145
        }
101
 
146
 
-
 
147
        /**
-
 
148
         * @return bool
-
 
149
         */
102
        public function isLeafNode() {
150
        public function isLeafNode(): bool {
103
                return false;
151
                return false;
104
        }
152
        }
105
 
153
 
-
 
154
        /**
-
 
155
         * @return array
-
 
156
         */
106
        private function getTechInfo() {
157
        private function getTechInfo(): array {
107
                $tech_info = array();
158
                $tech_info = array();
108
 
159
 
109
                $tmp = _L('Dot notation');
160
                $tmp = _L('Dot notation');
110
                $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://oid-rep.orange-labs.fr/faq.htm#14" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp);
161
                $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://oid-rep.orange-labs.fr/faq.htm#14" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp);
111
                $tech_info[$tmp] = $this->getDotNotation();
162
                $tech_info[$tmp] = $this->getDotNotation();
Line 127... Line 178...
127
                $tech_info[$tmp] = str_replace(' ', ':', \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false))));
178
                $tech_info[$tmp] = str_replace(' ', ':', \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false))));
128
 
179
 
129
                return $tech_info;
180
                return $tech_info;
130
        }
181
        }
131
 
182
 
-
 
183
        /**
-
 
184
         * @return bool
-
 
185
         */
132
        protected function isClassCWeid() {
186
        protected function isClassCWeid(): bool {
133
                $dist = oid_distance($this->oid, '1.3.6.1.4.1.37553.8');
187
                $dist = oid_distance($this->oid, '1.3.6.1.4.1.37553.8');
134
                if ($dist === false) return false;
188
                if ($dist === false) return false;
135
                return $dist >= 0;
189
                return $dist >= 0;
136
        }
190
        }
137
 
191
 
-
 
192
        /**
-
 
193
         * @param string $title
-
 
194
         * @param string $content
-
 
195
         * @param string $icon
-
 
196
         * @return void
-
 
197
         * @throws OIDplusException
-
 
198
         */
138
        public function getContentPage(&$title, &$content, &$icon) {
199
        public function getContentPage(string &$title, string &$content, string &$icon) {
139
                if ($this->isClassCWeid()) {
200
                if ($this->isClassCWeid()) {
140
                        // TODO: Also change treeview menu mini-icon?
201
                        // TODO: Also change treeview menu mini-icon?
141
                        $icon = file_exists(__DIR__.'/img/weid_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/weid_icon.png' : '';
202
                        $icon = file_exists(__DIR__.'/img/weid_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/weid_icon.png' : '';
142
                } else {
203
                } else {
143
                        $icon = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
204
                        $icon = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
Line 191... Line 252...
191
                }
252
                }
192
        }
253
        }
193
 
254
 
194
        # ---
255
        # ---
195
 
256
 
-
 
257
        /**
196
        // Gets the last arc of an WEID
258
         * Gets the last arc of an WEID
-
 
259
         * @return false|string
-
 
260
         */
197
        public function weidArc() {
261
        public function weidArc() {
198
                // Dirty hack: We prepend '0.' in front of the OID to enforce the
262
                // Dirty hack: We prepend '0.' in front of the OID to enforce the
199
                //             creation of a Class A weid (weid:root:) . Otherwise we could not
263
                //             creation of a Class A weid (weid:root:) . Otherwise we could not
200
                //             get the hidden arc value "8" from "weid:4" (which is actually "weid:pen:SZ5-8-?"
264
                //             get the hidden arc value "8" from "weid:4" (which is actually "weid:pen:SZ5-8-?"
201
                $weid = \Frdl\Weid\WeidOidConverter::oid2weid('0.'.$this->getDotNotation());
265
                $weid = \Frdl\Weid\WeidOidConverter::oid2weid('0.'.$this->getDotNotation());
Line 205... Line 269...
205
                $x = explode('-', $weid);
269
                $x = explode('-', $weid);
206
                if (count($x) < 2) return ''; // WEID root arc. Has no name
270
                if (count($x) < 2) return ''; // WEID root arc. Has no name
207
                return $x[count($x)-2];
271
                return $x[count($x)-2];
208
        }
272
        }
209
 
273
 
-
 
274
        /**
-
 
275
         * @param bool $withAbbr
-
 
276
         * @return string
-
 
277
         */
210
        public function getWeidNotation($withAbbr=true) {
278
        public function getWeidNotation(bool $withAbbr=true): string {
211
                $weid = \Frdl\Weid\WeidOidConverter::oid2weid($this->getDotNotation());
279
                $weid = \Frdl\Weid\WeidOidConverter::oid2weid($this->getDotNotation());
212
                if ($withAbbr) {
280
                if ($withAbbr) {
213
                        $ary = explode(':', $weid);
281
                        $ary = explode(':', $weid);
214
                        $weid = array_pop($ary); // remove namespace and sub-namespace if existing
282
                        $weid = array_pop($ary); // remove namespace and sub-namespace if existing
215
                        $ns = implode(':', $ary).':';
283
                        $ns = implode(':', $ary).':';
Line 234... Line 302...
234
                        $weid = '<abbr title="'._L('Base OID').': '.$base_arc.'">' . rtrim($ns,':') . '</abbr>:' . implode('-',$weid_arcs);
302
                        $weid = '<abbr title="'._L('Base OID').': '.$base_arc.'">' . rtrim($ns,':') . '</abbr>:' . implode('-',$weid_arcs);
235
                }
303
                }
236
                return $weid;
304
                return $weid;
237
        }
305
        }
238
 
306
 
-
 
307
        /**
-
 
308
         * @param string|int $arcs
-
 
309
         * @return OIDplusOid
-
 
310
         * @throws OIDplusException
-
 
311
         */
239
        public function appendArcs(String $arcs) {
312
        public function appendArcs($arcs): OIDplusOid {
240
                $out = new self($this->oid);
313
                $out = new self($this->oid);
241
 
314
 
242
                if ($out->isRoot()) {
315
                if ($out->isRoot()) {
243
                        $out->oid .= $arcs;
316
                        $out->oid .= $arcs;
244
                } else {
317
                } else {
Line 268... Line 341...
268
                }
341
                }
269
 
342
 
270
                return $out;
343
                return $out;
271
        }
344
        }
272
 
345
 
-
 
346
        /**
-
 
347
         * @param OIDplusOid $parent
-
 
348
         * @return false|string
-
 
349
         */
273
        public function deltaDotNotation(OIDplusOid $parent) {
350
        public function deltaDotNotation(OIDplusOid $parent) {
274
                if (!$parent->isRoot()) {
351
                if (!$parent->isRoot()) {
275
                        if (substr($this->oid, 0, strlen($parent->oid)+1) == $parent->oid.'.') {
352
                        if (substr($this->oid, 0, strlen($parent->oid)+1) == $parent->oid.'.') {
276
                                return substr($this->oid, strlen($parent->oid)+1);
353
                                return substr($this->oid, strlen($parent->oid)+1);
277
                        } else {
354
                        } else {
Line 280... Line 357...
280
                } else {
357
                } else {
281
                        return $this->oid;
358
                        return $this->oid;
282
                }
359
                }
283
        }
360
        }
284
 
361
 
-
 
362
        /**
-
 
363
         * @return array
-
 
364
         * @throws OIDplusException
-
 
365
         */
285
        public function getAsn1Ids() {
366
        public function getAsn1Ids(): array {
286
                $asn_ids = array();
367
                $asn_ids = array();
287
                $res_asn = OIDplus::db()->query("select * from ###asn1id where oid = ? order by lfd", array("oid:".$this->oid));
368
                $res_asn = OIDplus::db()->query("select * from ###asn1id where oid = ? order by lfd", array("oid:".$this->oid));
288
                while ($row_asn = $res_asn->fetch_array()) {
369
                while ($row_asn = $res_asn->fetch_array()) {
289
                        $name = $row_asn['name'];
370
                        $name = $row_asn['name'];
290
                        $standardized = $row_asn['standardized'];
371
                        $standardized = $row_asn['standardized'];
Line 292... Line 373...
292
                        $asn_ids[] = new OIDplusOidAsn1Id($name, $standardized, $well_known);
373
                        $asn_ids[] = new OIDplusOidAsn1Id($name, $standardized, $well_known);
293
                }
374
                }
294
                return $asn_ids;
375
                return $asn_ids;
295
        }
376
        }
296
 
377
 
-
 
378
        /**
-
 
379
         * @return array
-
 
380
         * @throws OIDplusException
-
 
381
         */
297
        public function getIris() {
382
        public function getIris(): array {
298
                $iri_ids = array();
383
                $iri_ids = array();
299
                $res_iri = OIDplus::db()->query("select * from ###iri where oid = ? order by lfd", array("oid:".$this->oid));
384
                $res_iri = OIDplus::db()->query("select * from ###iri where oid = ? order by lfd", array("oid:".$this->oid));
300
                while ($row_iri = $res_iri->fetch_array()) {
385
                while ($row_iri = $res_iri->fetch_array()) {
301
                        $name = $row_iri['name'];
386
                        $name = $row_iri['name'];
302
                        $longarc = $row_iri['longarc'];
387
                        $longarc = $row_iri['longarc'];
Line 304... Line 389...
304
                        $iri_ids[] = new OIDplusOidIri($name, $longarc, $well_known);
389
                        $iri_ids[] = new OIDplusOidIri($name, $longarc, $well_known);
305
                }
390
                }
306
                return $iri_ids;
391
                return $iri_ids;
307
        }
392
        }
308
 
393
 
-
 
394
        /**
-
 
395
         * @param OIDplusOid|null $parent
-
 
396
         * @param $separator
-
 
397
         * @return string
-
 
398
         * @throws OIDplusException
-
 
399
         */
309
        public function viewGetArcAsn1s(OIDplusOid $parent=null, $separator = ' | ') {
400
        public function viewGetArcAsn1s(OIDplusOid $parent=null, $separator = ' | '): string {
310
                $asn_ids = array();
401
                $asn_ids = array();
311
 
402
 
312
                if (is_null($parent)) $parent = OIDplusOid::parse(self::root());
403
                if (is_null($parent)) $parent = OIDplusOid::parse(self::root());
313
 
404
 
314
                $part = $this->deltaDotNotation($parent);
405
                $part = $this->deltaDotNotation($parent);
Line 322... Line 413...
322
 
413
 
323
                if (count($asn_ids) == 0) $asn_ids = array($part);
414
                if (count($asn_ids) == 0) $asn_ids = array($part);
324
                return implode($separator, $asn_ids);
415
                return implode($separator, $asn_ids);
325
        }
416
        }
326
 
417
 
-
 
418
        /**
-
 
419
         * @param bool $withAbbr
-
 
420
         * @return string
-
 
421
         * @throws OIDplusException
-
 
422
         */
327
        public function getAsn1Notation($withAbbr=true) {
423
        public function getAsn1Notation(bool $withAbbr=true): string {
328
                $asn1_notation = '';
424
                $asn1_notation = '';
329
                $arcs = explode('.', $this->oid);
425
                $arcs = explode('.', $this->oid);
330
 
426
 
331
                foreach ($arcs as $arc) {
427
                foreach ($arcs as $arc) {
332
                        $res = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ? order by lfd", array(self::root().implode('.',$arcs)));
428
                        $res = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ? order by lfd", array(self::root().implode('.',$arcs)));
Line 356... Line 452...
356
                }
452
                }
357
 
453
 
358
                return "{ ".trim($asn1_notation)." }";
454
                return "{ ".trim($asn1_notation)." }";
359
        }
455
        }
360
 
456
 
-
 
457
        /**
-
 
458
         * @param bool $withAbbr
-
 
459
         * @return string
-
 
460
         * @throws OIDplusException
-
 
461
         */
361
        public function getIriNotation($withAbbr=true) {
462
        public function getIriNotation(bool $withAbbr=true): string {
362
                $iri_notation = '';
463
                $iri_notation = '';
363
                $arcs = explode('.', $this->oid);
464
                $arcs = explode('.', $this->oid);
364
 
465
 
365
                foreach ($arcs as $arc) {
466
                foreach ($arcs as $arc) {
366
                        $res = OIDplus::db()->query("select name, longarc from ###iri where oid = ? order by lfd", array(self::root().implode('.',$arcs)));
467
                        $res = OIDplus::db()->query("select name, longarc from ###iri where oid = ? order by lfd", array(self::root().implode('.',$arcs)));
Line 395... Line 496...
395
                $iri_notation = '/' . substr($iri_notation, 0, strlen($iri_notation)-1);
496
                $iri_notation = '/' . substr($iri_notation, 0, strlen($iri_notation)-1);
396
 
497
 
397
                return $iri_notation;
498
                return $iri_notation;
398
        }
499
        }
399
 
500
 
-
 
501
        /**
-
 
502
         * @return string
-
 
503
         */
400
        public function getDotNotation() {
504
        public function getDotNotation(): string {
401
                return $this->oid;
505
                return $this->oid;
402
        }
506
        }
403
 
507
 
-
 
508
        /**
-
 
509
         * @return bool
-
 
510
         * @throws OIDplusException
-
 
511
         */
404
        public function isWellKnown() {
512
        public function isWellKnown(): bool {
405
                $res = OIDplus::db()->query("select oid from ###asn1id where oid = ? and well_known = ?", array("oid:".$this->oid,true));
513
                $res = OIDplus::db()->query("select oid from ###asn1id where oid = ? and well_known = ?", array("oid:".$this->oid,true));
406
                if ($res->any()) return true;
514
                if ($res->any()) return true;
407
 
515
 
408
                $res = OIDplus::db()->query("select oid from ###iri where oid = ? and well_known = ?", array("oid:".$this->oid,true));
516
                $res = OIDplus::db()->query("select oid from ###iri where oid = ? and well_known = ?", array("oid:".$this->oid,true));
409
                if ($res->any()) return true;
517
                if ($res->any()) return true;
410
 
518
 
411
                return false;
519
                return false;
412
        }
520
        }
413
 
521
 
-
 
522
        /**
-
 
523
         * @param array $demandedASN1s
-
 
524
         * @param bool $simulate
-
 
525
         * @return void
-
 
526
         * @throws OIDplusException
-
 
527
         */
414
        public function replaceAsn1Ids($demandedASN1s=array(), $simulate=false) {
528
        public function replaceAsn1Ids(array $demandedASN1s=array(), bool $simulate=false) {
415
                if ($this->isWellKnown()) {
529
                if ($this->isWellKnown()) {
416
                        throw new OIDplusException(_L('OID "%1" is a "well-known" OID. Its identifiers cannot be changed.',$this->oid));
530
                        throw new OIDplusException(_L('OID "%1" is a "well-known" OID. Its identifiers cannot be changed.',$this->oid));
417
                }
531
                }
418
 
532
 
419
                // First do a few checks
533
                // First do a few checks
Line 448... Line 562...
448
                                OIDplus::db()->query("insert into ###asn1id (oid, name) values (?, ?)", array("oid:".$this->oid, $asn1));
562
                                OIDplus::db()->query("insert into ###asn1id (oid, name) values (?, ?)", array("oid:".$this->oid, $asn1));
449
                        }
563
                        }
450
                }
564
                }
451
        }
565
        }
452
 
566
 
-
 
567
        /**
-
 
568
         * @param array $demandedIris
-
 
569
         * @param bool $simulate
-
 
570
         * @return void
-
 
571
         * @throws OIDplusException
-
 
572
         */
453
        public function replaceIris($demandedIris=array(), $simulate=false) {
573
        public function replaceIris(array $demandedIris=array(), bool $simulate=false) {
454
                if ($this->isWellKnown()) {
574
                if ($this->isWellKnown()) {
455
                        throw new OIDplusException(_L('OID "%1" is a "well-known" OID. Its identifiers cannot be changed.',$this->oid));
575
                        throw new OIDplusException(_L('OID "%1" is a "well-known" OID. Its identifiers cannot be changed.',$this->oid));
456
                }
576
                }
457
 
577
 
458
                // First do a few checks
578
                // First do a few checks
Line 486... Line 606...
486
                                OIDplus::db()->query("insert into ###iri (oid, name) values (?, ?)", array("oid:".$this->oid, $iri));
606
                                OIDplus::db()->query("insert into ###iri (oid, name) values (?, ?)", array("oid:".$this->oid, $iri));
487
                        }
607
                        }
488
                }
608
                }
489
        }
609
        }
490
 
610
 
-
 
611
        /**
-
 
612
         * @return OIDplusOid|null
-
 
613
         */
491
        public function one_up() {
614
        public function one_up()/*: ?OIDplusOid*/ {
492
                return self::parse(self::ns().':'.oid_up($this->oid));
615
                return self::parse(self::ns().':'.oid_up($this->oid));
493
        }
616
        }
494
 
617
 
-
 
618
        /**
-
 
619
         * @param $to
-
 
620
         * @return int|null
-
 
621
         */
495
        public function distance($to) {
622
        public function distance($to) {
496
                if (!is_object($to)) $to = OIDplusObject::parse($to);
623
                if (!is_object($to)) $to = OIDplusObject::parse($to);
497
                if (!($to instanceof $this)) return false;
624
                if (!($to instanceof $this)) return null;
498
                return oid_distance($to->oid, $this->oid);
625
                $res = oid_distance($to->oid, $this->oid);
-
 
626
                return $res !== false ? $res : null;
499
        }
627
        }
500
 
628
 
-
 
629
        /**
-
 
630
         * @return array|OIDplusAltId[]
-
 
631
         * @throws OIDplusException
-
 
632
         */
501
        public function getAltIds() {
633
        public function getAltIds(): array {
502
                if ($this->isRoot()) return array();
634
                if ($this->isRoot()) return array();
503
                $ids = parent::getAltIds();
635
                $ids = parent::getAltIds();
504
 
636
 
505
                if ($uuid = oid_to_uuid($this->oid)) {
637
                if ($uuid = oid_to_uuid($this->oid)) {
506
                        // UUID-OIDs are representation of an UUID
638
                        // UUID-OIDs are representation of an UUID
Line 620... Line 752...
620
                }
752
                }
621
 
753
 
622
                return $ids;
754
                return $ids;
623
        }
755
        }
624
 
756
 
-
 
757
        /**
-
 
758
         * @return string
-
 
759
         */
625
        public function getDirectoryName() {
760
        public function getDirectoryName(): string {
626
                if ($this->isRoot()) return $this->ns();
761
                if ($this->isRoot()) return $this->ns();
627
                $oid = $this->nodeId(false);
762
                $oid = $this->nodeId(false);
628
                return $this->ns().'_'.str_replace('.', '_', $oid);
763
                return $this->ns().'_'.str_replace('.', '_', $oid);
629
        }
764
        }
630
 
765
 
-
 
766
        /**
-
 
767
         * @param string $mode
-
 
768
         * @return string
-
 
769
         */
631
        public static function treeIconFilename($mode) {
770
        public static function treeIconFilename(string $mode): string {
632
                return 'img/'.$mode.'_icon16.png';
771
                return 'img/'.$mode.'_icon16.png';
633
        }
772
        }
634
}
773
}