4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Reflection;
15 * A fake ReflectionParameter but for language construct parameters.
17 * It stubs out all the important bits and returns whatever was passed in $opts.
19 class ReflectionLanguageConstructParameter extends \ReflectionParameter
25 public function __construct($function, $parameter, array $opts)
27 $this->function = $function;
28 $this->parameter = $parameter;
35 public function getClass()
41 * Is the param an array?
45 public function isArray()
47 return \array_key_exists('isArray', $this->opts) && $this->opts['isArray'];
51 * Get param default value.
55 public function getDefaultValue()
57 if ($this->isDefaultValueAvailable()) {
58 return $this->opts['defaultValue'];
67 public function getName()
69 return $this->parameter;
73 * Is the param optional?
77 public function isOptional()
79 return \array_key_exists('isOptional', $this->opts) && $this->opts['isOptional'];
83 * Does the param have a default value?
87 public function isDefaultValueAvailable()
89 return \array_key_exists('defaultValue', $this->opts);
93 * Is the param passed by reference?
95 * (I don't think this is true for anything we need to fake a param for)
99 public function isPassedByReference()
101 return \array_key_exists('isPassedByReference', $this->opts) && $this->opts['isPassedByReference'];