Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Annotation
  • AnnotationsParser
  • ClassType
  • Extension
  • GlobalFunction
  • Helpers
  • Method
  • Parameter
  • Property

Interfaces

  • IAnnotation
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Reflection;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Reports information about a method's parameter.
15:  * @property-read ClassType $class
16:  * @property-read string $className
17:  * @property-read ClassType $declaringClass
18:  * @property-read Method $declaringFunction
19:  * @property-read string $name
20:  * @property-read bool $passedByReference
21:  * @property-read bool $array
22:  * @property-read int $position
23:  * @property-read bool $optional
24:  * @property-read bool $defaultValueAvailable
25:  * @property-read mixed $defaultValue
26:  */
27: class Parameter extends \ReflectionParameter
28: {
29:     use Nette\SmartObject;
30: 
31:     /** @var mixed */
32:     private $function;
33: 
34: 
35:     public function __construct($function, $parameter)
36:     {
37:         parent::__construct($this->function = $function, $parameter);
38:     }
39: 
40: 
41:     /**
42:      * @return ClassType
43:      */
44:     public function getClass()
45:     {
46:         return ($ref = parent::getClass()) ? new ClassType($ref->getName()) : null;
47:     }
48: 
49: 
50:     /**
51:      * @return string
52:      */
53:     public function getClassName()
54:     {
55:         try {
56:             return ($ref = parent::getClass()) ? $ref->getName() : null;
57:         } catch (\ReflectionException $e) {
58:             if (preg_match('#Class (.+) does not exist#', $e->getMessage(), $m)) {
59:                 return $m[1];
60:             }
61:             throw $e;
62:         }
63:     }
64: 
65: 
66:     /**
67:      * @return ClassType
68:      */
69:     public function getDeclaringClass()
70:     {
71:         return ($ref = parent::getDeclaringClass()) ? new ClassType($ref->getName()) : null;
72:     }
73: 
74: 
75:     /**
76:      * @return Method|GlobalFunction
77:      */
78:     public function getDeclaringFunction()
79:     {
80:         return is_array($this->function)
81:             ? new Method($this->function[0], $this->function[1])
82:             : new GlobalFunction($this->function);
83:     }
84: 
85: 
86:     public function __toString()
87:     {
88:         return '$' . parent::getName() . ' in ' . $this->getDeclaringFunction();
89:     }
90: }
91: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0