Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Util.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.04 KiB


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-2015 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  /**
16   * Shared utility methods used by scanners
17   */
18  class Util
19  {
20      /**
21       * Resolve imports
22       *
23       * @param  string $value
24       * @param  null|string $key
25       * @param  \stdClass $data
26       * @return void
27       * @throws Exception\InvalidArgumentException
28       */
29      public static function resolveImports(&$value, $key = null, stdClass $data = null)
30      {
31          if (!is_object($data)
32              || !property_exists($data, 'uses')
33              || !property_exists($data, 'namespace')
34          ) {
35              throw new Exception\InvalidArgumentException(sprintf(
36                  '%s expects a data object containing "uses" and "namespace" properties; on or both missing',
37                  __METHOD__
38              ));
39          }
40   
41          if ($data->namespace && !$data->uses && strlen($value) > 0 && $value{0} != '\\') {
42              $value = $data->namespace . '\\' . $value;
43   
44              return;
45          }
46   
47          if (!$data->uses || strlen($value) <= 0 || $value{0} == '\\') {
48              $value = ltrim($value, '\\');
49   
50              return;
51          }
52   
53          if ($data->namespace || $data->uses) {
54              $firstPart = $value;
55              if (($firstPartEnd = strpos($firstPart, '\\')) !== false) {
56                  $firstPart = substr($firstPart, 0, $firstPartEnd);
57              } else {
58                  $firstPartEnd = strlen($firstPart);
59              }
60   
61              if (array_key_exists($firstPart, $data->uses)) {
62                  $value = substr_replace($value, $data->uses[$firstPart], 0, $firstPartEnd);
63   
64                  return;
65              }
66   
67              if ($data->namespace) {
68                  $value = $data->namespace . '\\' . $value;
69   
70                  return;
71              }
72          }
73      }
74  }
75