PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.12.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.12.1
5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / var-dumper / Caster / AmqpCaster.php
matomo / app / vendor / prefixed / symfony / var-dumper / Caster Last commit date
AmqpCaster.php 2 years ago ArgsStub.php 1 year ago Caster.php 1 year ago ClassStub.php 1 year ago ConstStub.php 2 years ago CutArrayStub.php 2 years ago CutStub.php 1 year ago DOMCaster.php 1 year ago DateCaster.php 2 years ago DoctrineCaster.php 2 years ago DsCaster.php 2 years ago DsPairStub.php 2 years ago EnumStub.php 1 year ago ExceptionCaster.php 1 year ago FiberCaster.php 2 years ago FrameStub.php 1 year ago GmpCaster.php 2 years ago ImagineCaster.php 2 years ago ImgStub.php 2 years ago IntlCaster.php 2 years ago LinkStub.php 1 year ago MemcachedCaster.php 2 years ago MysqliCaster.php 2 years ago PdoCaster.php 2 years ago PgSqlCaster.php 1 year ago ProxyManagerCaster.php 2 years ago RdKafkaCaster.php 1 year ago RedisCaster.php 2 years ago ReflectionCaster.php 1 year ago ResourceCaster.php 1 year ago SplCaster.php 1 year ago StubCaster.php 2 years ago SymfonyCaster.php 2 years ago TraceStub.php 1 year ago UuidCaster.php 2 years ago XmlReaderCaster.php 1 year ago XmlResourceCaster.php 2 years ago
AmqpCaster.php
106 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 namespace Matomo\Dependencies\Symfony\Component\VarDumper\Caster;
12
13 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\Stub;
14 /**
15 * Casts Amqp related classes to array representation.
16 *
17 * @author Grégoire Pineau <lyrixx@lyrixx.info>
18 *
19 * @final
20 */
21 class AmqpCaster
22 {
23 private const FLAGS = [\AMQP_DURABLE => 'AMQP_DURABLE', \AMQP_PASSIVE => 'AMQP_PASSIVE', \AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE', \AMQP_AUTODELETE => 'AMQP_AUTODELETE', \AMQP_INTERNAL => 'AMQP_INTERNAL', \AMQP_NOLOCAL => 'AMQP_NOLOCAL', \AMQP_AUTOACK => 'AMQP_AUTOACK', \AMQP_IFEMPTY => 'AMQP_IFEMPTY', \AMQP_IFUNUSED => 'AMQP_IFUNUSED', \AMQP_MANDATORY => 'AMQP_MANDATORY', \AMQP_IMMEDIATE => 'AMQP_IMMEDIATE', \AMQP_MULTIPLE => 'AMQP_MULTIPLE', \AMQP_NOWAIT => 'AMQP_NOWAIT', \AMQP_REQUEUE => 'AMQP_REQUEUE'];
24 private const EXCHANGE_TYPES = [\AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT', \AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT', \AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC', \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS'];
25 public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested)
26 {
27 $prefix = Caster::PREFIX_VIRTUAL;
28 $a += [$prefix . 'is_connected' => $c->isConnected()];
29 // Recent version of the extension already expose private properties
30 if (isset($a["\x00AMQPConnection\x00login"])) {
31 return $a;
32 }
33 // BC layer in the amqp lib
34 if (method_exists($c, 'getReadTimeout')) {
35 $timeout = $c->getReadTimeout();
36 } else {
37 $timeout = $c->getTimeout();
38 }
39 $a += [$prefix . 'is_connected' => $c->isConnected(), $prefix . 'login' => $c->getLogin(), $prefix . 'password' => $c->getPassword(), $prefix . 'host' => $c->getHost(), $prefix . 'vhost' => $c->getVhost(), $prefix . 'port' => $c->getPort(), $prefix . 'read_timeout' => $timeout];
40 return $a;
41 }
42 public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested)
43 {
44 $prefix = Caster::PREFIX_VIRTUAL;
45 $a += [$prefix . 'is_connected' => $c->isConnected(), $prefix . 'channel_id' => $c->getChannelId()];
46 // Recent version of the extension already expose private properties
47 if (isset($a["\x00AMQPChannel\x00connection"])) {
48 return $a;
49 }
50 $a += [$prefix . 'connection' => $c->getConnection(), $prefix . 'prefetch_size' => $c->getPrefetchSize(), $prefix . 'prefetch_count' => $c->getPrefetchCount()];
51 return $a;
52 }
53 public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested)
54 {
55 $prefix = Caster::PREFIX_VIRTUAL;
56 $a += [$prefix . 'flags' => self::extractFlags($c->getFlags())];
57 // Recent version of the extension already expose private properties
58 if (isset($a["\x00AMQPQueue\x00name"])) {
59 return $a;
60 }
61 $a += [$prefix . 'connection' => $c->getConnection(), $prefix . 'channel' => $c->getChannel(), $prefix . 'name' => $c->getName(), $prefix . 'arguments' => $c->getArguments()];
62 return $a;
63 }
64 public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested)
65 {
66 $prefix = Caster::PREFIX_VIRTUAL;
67 $a += [$prefix . 'flags' => self::extractFlags($c->getFlags())];
68 $type = isset(self::EXCHANGE_TYPES[$c->getType()]) ? new ConstStub(self::EXCHANGE_TYPES[$c->getType()], $c->getType()) : $c->getType();
69 // Recent version of the extension already expose private properties
70 if (isset($a["\x00AMQPExchange\x00name"])) {
71 $a["\x00AMQPExchange\x00type"] = $type;
72 return $a;
73 }
74 $a += [$prefix . 'connection' => $c->getConnection(), $prefix . 'channel' => $c->getChannel(), $prefix . 'name' => $c->getName(), $prefix . 'type' => $type, $prefix . 'arguments' => $c->getArguments()];
75 return $a;
76 }
77 public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
78 {
79 $prefix = Caster::PREFIX_VIRTUAL;
80 $deliveryMode = new ConstStub($c->getDeliveryMode() . (2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
81 // Recent version of the extension already expose private properties
82 if (isset($a["\x00AMQPEnvelope\x00body"])) {
83 $a["\x00AMQPEnvelope\x00delivery_mode"] = $deliveryMode;
84 return $a;
85 }
86 if (!($filter & Caster::EXCLUDE_VERBOSE)) {
87 $a += [$prefix . 'body' => $c->getBody()];
88 }
89 $a += [$prefix . 'delivery_tag' => $c->getDeliveryTag(), $prefix . 'is_redelivery' => $c->isRedelivery(), $prefix . 'exchange_name' => $c->getExchangeName(), $prefix . 'routing_key' => $c->getRoutingKey(), $prefix . 'content_type' => $c->getContentType(), $prefix . 'content_encoding' => $c->getContentEncoding(), $prefix . 'headers' => $c->getHeaders(), $prefix . 'delivery_mode' => $deliveryMode, $prefix . 'priority' => $c->getPriority(), $prefix . 'correlation_id' => $c->getCorrelationId(), $prefix . 'reply_to' => $c->getReplyTo(), $prefix . 'expiration' => $c->getExpiration(), $prefix . 'message_id' => $c->getMessageId(), $prefix . 'timestamp' => $c->getTimeStamp(), $prefix . 'type' => $c->getType(), $prefix . 'user_id' => $c->getUserId(), $prefix . 'app_id' => $c->getAppId()];
90 return $a;
91 }
92 private static function extractFlags(int $flags) : ConstStub
93 {
94 $flagsArray = [];
95 foreach (self::FLAGS as $value => $name) {
96 if ($flags & $value) {
97 $flagsArray[] = $name;
98 }
99 }
100 if (!$flagsArray) {
101 $flagsArray = ['AMQP_NOPARAM'];
102 }
103 return new ConstStub(implode('|', $flagsArray), $flags);
104 }
105 }
106