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

ArrayOrTraversableGuardTrait.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 1.23 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\Stdlib\Guard;
11   
12  use Traversable;
13   
14  /**
15   * Provide a guard method for array or Traversable data
16   */
17  trait ArrayOrTraversableGuardTrait
18  {
19      /**
20       * Verifies that the data is an array or Traversable
21       *
22       * @param  mixed  $data           the data to verify
23       * @param  string $dataName       the data name
24       * @param  string $exceptionClass FQCN for the exception
25       * @throws \Exception
26       */
27      protected function guardForArrayOrTraversable(
28          $data,
29          $dataName = 'Argument',
30          $exceptionClass = 'Zend\Stdlib\Exception\InvalidArgumentException'
31      ) {
32          if (!is_array($data) && !($data instanceof Traversable)) {
33              $message = sprintf(
34                  "%s must be an array or Traversable, [%s] given",
35                  $dataName,
36                  is_object($data) ? get_class($data) : gettype($data)
37              );
38              throw new $exceptionClass($message);
39          }
40      }
41  }
42