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

NumberOfParameterFilter.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 1.36 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\Hydrator\Filter;
11   
12  use ReflectionException;
13  use ReflectionMethod;
14  use Zend\Stdlib\Exception\InvalidArgumentException;
15   
16  class NumberOfParameterFilter implements FilterInterface
17  {
18      /**
19       * The number of parameters beeing accepted
20       * @var int
21       */
22      protected $numberOfParameters = null;
23   
24      /**
25       * @param int $numberOfParameters Number of accepted parameters
26       */
27      public function __construct($numberOfParameters = 0)
28      {
29          $this->numberOfParameters = (int) $numberOfParameters;
30      }
31   
32      /**
33       * @param string $property the name of the property
34       * @return bool
35       * @throws InvalidArgumentException
36       */
37      public function filter($property)
38      {
39          try {
40              $reflectionMethod = new ReflectionMethod($property);
41          } catch (ReflectionException $exception) {
42              throw new InvalidArgumentException(
43                  "Method $property doesn't exist"
44              );
45          }
46   
47          return $reflectionMethod->getNumberOfParameters() === $this->numberOfParameters;
48      }
49  }
50