Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Util.php
01 <?php
02 /**
03 * Zend Framework (http://framework.zend.com/)
04 *
05 * @link http://github.com/zendframework/zf2 for the canonical source repository
06 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
07 * @license http://framework.zend.com/license/new-bsd New BSD License
08 */
09
10 namespace Zend\Code\Scanner;
11
12 use stdClass;
13 use Zend\Code\Exception;
14
15 use function array_key_exists;
16 use function is_object;
17 use function ltrim;
18 use function property_exists;
19 use function sprintf;
20 use function strlen;
21 use function strpos;
22 use function substr;
23 use function substr_replace;
24
25 /**
26 * Shared utility methods used by scanners
27 */
28 class Util
29 {
30 /**
31 * Resolve imports
32 *
33 * @param string $value
34 * @param null|string $key
35 * @param \stdClass $data
36 * @return void
37 * @throws Exception\InvalidArgumentException
38 */
39 public static function resolveImports(&$value, $key = null, stdClass $data = null)
40 {
41 if (! is_object($data)
42 || ! property_exists($data, 'uses')
43 || ! property_exists($data, 'namespace')
44 ) {
45 throw new Exception\InvalidArgumentException(sprintf(
46 '%s expects a data object containing "uses" and "namespace" properties; on or both missing',
47 __METHOD__
48 ));
49 }
50
51 if ($data->namespace && ! $data->uses && strlen($value) > 0 && $value[0] != '\\') {
52 $value = $data->namespace . '\\' . $value;
53
54 return;
55 }
56
57 if (! $data->uses || strlen($value) <= 0 || $value[0] == '\\') {
58 $value = ltrim($value, '\\');
59
60 return;
61 }
62
63 if ($data->namespace || $data->uses) {
64 $firstPart = $value;
65 if (($firstPartEnd = strpos($firstPart, '\\')) !== false) {
66 $firstPart = substr($firstPart, 0, $firstPartEnd);
67 } else {
68 $firstPartEnd = strlen($firstPart);
69 }
70
71 if (array_key_exists($firstPart, $data->uses)) {
72 $value = substr_replace($value, $data->uses[$firstPart], 0, $firstPartEnd);
73
74 return;
75 }
76
77 if ($data->namespace) {
78 $value = $data->namespace . '\\' . $value;
79
80 return;
81 }
82 }
83 }
84 }
85