PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.6
Kubio AI Page Builder v2.8.6
2.9.0 2.8.6 2.8.5 2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / vendor / symfony / var-dumper / Caster / ArgsStub.php
kubio / vendor / symfony / var-dumper / Caster Last commit date
AmqpCaster.php 1 year ago ArgsStub.php 1 year ago Caster.php 1 year ago ClassStub.php 1 year ago ConstStub.php 4 years ago CutArrayStub.php 4 years ago CutStub.php 4 years ago DOMCaster.php 1 year ago DateCaster.php 1 year ago DoctrineCaster.php 1 year ago DsCaster.php 1 year ago DsPairStub.php 4 years ago EnumStub.php 4 years ago ExceptionCaster.php 1 year ago FiberCaster.php 1 year ago FrameStub.php 4 years ago GmpCaster.php 1 year ago ImagineCaster.php 4 years ago ImgStub.php 1 year ago IntlCaster.php 1 year ago LinkStub.php 1 year ago MemcachedCaster.php 1 year ago MysqliCaster.php 1 year ago PdoCaster.php 1 year ago PgSqlCaster.php 1 year ago ProxyManagerCaster.php 1 year ago RdKafkaCaster.php 1 year ago RedisCaster.php 1 year ago ReflectionCaster.php 1 year ago ResourceCaster.php 1 year ago SplCaster.php 1 year ago StubCaster.php 1 year ago SymfonyCaster.php 1 year ago TraceStub.php 1 year ago UuidCaster.php 4 years ago XmlReaderCaster.php 1 year ago XmlResourceCaster.php 1 year ago
ArgsStub.php
81 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\VarDumper\Caster;
13
14 use Symfony\Component\VarDumper\Cloner\Stub;
15
16 /**
17 * Represents a list of function arguments.
18 *
19 * @author Nicolas Grekas <p@tchwork.com>
20 */
21 class ArgsStub extends EnumStub
22 {
23 private static $parameters = [];
24
25 public function __construct(array $args, string $function, ?string $class)
26 {
27 [$variadic, $params] = self::getParameters($function, $class);
28
29 $values = [];
30 foreach ($args as $k => $v) {
31 $values[$k] = !\is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
32 }
33 if (null === $params) {
34 parent::__construct($values, false);
35
36 return;
37 }
38 if (\count($values) < \count($params)) {
39 $params = \array_slice($params, 0, \count($values));
40 } elseif (\count($values) > \count($params)) {
41 $values[] = new EnumStub(array_splice($values, \count($params)), false);
42 $params[] = $variadic;
43 }
44 if (['...'] === $params) {
45 $this->dumpKeys = false;
46 $this->value = $values[0]->value;
47 } else {
48 $this->value = array_combine($params, $values);
49 }
50 }
51
52 private static function getParameters(string $function, ?string $class): array
53 {
54 if (isset(self::$parameters[$k = $class.'::'.$function])) {
55 return self::$parameters[$k];
56 }
57
58 try {
59 $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
60 } catch (\ReflectionException $e) {
61 return [null, null];
62 }
63
64 $variadic = '...';
65 $params = [];
66 foreach ($r->getParameters() as $v) {
67 $k = '$'.$v->name;
68 if ($v->isPassedByReference()) {
69 $k = '&'.$k;
70 }
71 if ($v->isVariadic()) {
72 $variadic .= $k;
73 } else {
74 $params[] = $k;
75 }
76 }
77
78 return self::$parameters[$k] = [$variadic, $params];
79 }
80 }
81