Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf12b316

Browse files
committed
[VarDumper] Improve dump of AMQP* Object
The release ofhttps://github.com/pdezwart/php-amqp/ 1.7.0alpha1changed internally the handlings of AMQP* object. So now when dumpingusing var_dump(), many information are availables. So many informationare displayed twice. This commit fix this issue and keep displaying basicinformation for older version of the lib.Reference:*https://pecl.php.net/package-info.php?package=amqp&version=1.7.0alpha1*php-amqp/php-amqp@314afbc (and next commits)
1 parentc346f2a commitf12b316

File tree

1 file changed

+59
-34
lines changed

1 file changed

+59
-34
lines changed

‎src/Symfony/Component/VarDumper/Caster/AmqpCaster.php‎

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ class AmqpCaster
4646

4747
publicstaticfunctioncastConnection(\AMQPConnection$c,array$a,Stub$stub,$isNested)
4848
{
49-
$prefix = Caster::PREFIX_VIRTUAL;
49+
if (isset($a["\x00AMQPConnection\x00login"])) {
50+
$prefix ="\0AMQPConnection\0";
51+
}else {
52+
$prefix = Caster::PREFIX_VIRTUAL;
53+
}
5054

5155
// BC layer in the amqp lib
5256
if (method_exists($c,'getReadTimeout')) {
@@ -56,92 +60,113 @@ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub,
5660
}
5761

5862
$a +=array(
59-
$prefix.'isConnected' =>$c->isConnected(),
6063
$prefix.'login' =>$c->getLogin(),
6164
$prefix.'password' =>$c->getPassword(),
6265
$prefix.'host' =>$c->getHost(),
63-
$prefix.'port' =>$c->getPort(),
6466
$prefix.'vhost' =>$c->getVhost(),
65-
$prefix.'readTimeout' =>$timeout,
67+
$prefix.'port' =>$c->getPort(),
68+
$prefix.'read_timeout' =>$timeout,
69+
Caster::PREFIX_VIRTUAL.'isConnected' =>$c->isConnected(),
6670
);
6771

6872
return$a;
6973
}
7074

7175
publicstaticfunctioncastChannel(\AMQPChannel$c,array$a,Stub$stub,$isNested)
7276
{
73-
$prefix = Caster::PREFIX_VIRTUAL;
77+
if (isset($a["\x00AMQPChannel\x00connection"])) {
78+
$prefix ="\0AMQPChannel\0";
79+
}else {
80+
$prefix = Caster::PREFIX_VIRTUAL;
81+
}
7482

7583
$a +=array(
76-
$prefix.'isConnected' =>$c->isConnected(),
77-
$prefix.'channelId' =>$c->getChannelId(),
78-
$prefix.'prefetchSize' =>$c->getPrefetchSize(),
79-
$prefix.'prefetchCount' =>$c->getPrefetchCount(),
8084
$prefix.'connection' =>$c->getConnection(),
85+
$prefix.'prefetch_size' =>$c->getPrefetchSize(),
86+
$prefix.'prefetch_count' =>$c->getPrefetchCount(),
87+
Caster::PREFIX_VIRTUAL.'isConnected' =>$c->isConnected(),
88+
Caster::PREFIX_VIRTUAL.'channelId' =>$c->getChannelId(),
8189
);
8290

8391
return$a;
8492
}
8593

8694
publicstaticfunctioncastQueue(\AMQPQueue$c,array$a,Stub$stub,$isNested)
8795
{
88-
$prefix = Caster::PREFIX_VIRTUAL;
96+
if (isset($a["\x00AMQPQueue\x00name"])) {
97+
$prefix ="\0AMQPQueue\0";
98+
}else {
99+
$prefix = Caster::PREFIX_VIRTUAL;
100+
}
89101

90102
$a +=array(
91-
$prefix.'name' =>$c->getName(),
92-
$prefix.'flags' =>self::extractFlags($c->getFlags()),
93-
$prefix.'arguments' =>$c->getArguments(),
94103
$prefix.'connection' =>$c->getConnection(),
95104
$prefix.'channel' =>$c->getChannel(),
105+
$prefix.'name' =>$c->getName(),
106+
$prefix.'arguments' =>$c->getArguments(),
107+
Caster::PREFIX_VIRTUAL.'flags' =>self::extractFlags($c->getFlags()),
96108
);
97109

98110
return$a;
99111
}
100112

101113
publicstaticfunctioncastExchange(\AMQPExchange$c,array$a,Stub$stub,$isNested)
102114
{
103-
$prefix = Caster::PREFIX_VIRTUAL;
115+
if (isset($a["\x00AMQPExchange\x00name"])) {
116+
$prefix ="\0AMQPExchange\0";
117+
}else {
118+
$prefix = Caster::PREFIX_VIRTUAL;
119+
}
104120

105121
$a +=array(
122+
$prefix.'connection' =>$c->getConnection(),
123+
$prefix.'channel' =>$c->getChannel(),
106124
$prefix.'name' =>$c->getName(),
107-
$prefix.'flags' =>self::extractFlags($c->getFlags()),
108-
$prefix.'type' =>isset(self::$exchangeTypes[$c->getType()]) ?newConstStub(self::$exchangeTypes[$c->getType()],$c->getType()) :$c->getType(),
125+
$prefix.'type' =>null,
126+
$prefix.'flags' =>null,
109127
$prefix.'arguments' =>$c->getArguments(),
110-
$prefix.'channel' =>$c->getChannel(),
111-
$prefix.'connection' =>$c->getConnection(),
112128
);
113129

130+
$a[$prefix.'type'] =isset(self::$exchangeTypes[$c->getType()]) ?newConstStub(self::$exchangeTypes[$c->getType()],$c->getType()) :$c->getType();
131+
$a[$prefix.'flags'] =self::extractFlags($c->getFlags());
132+
114133
return$a;
115134
}
116135

117136
publicstaticfunctioncastEnvelope(\AMQPEnvelope$c,array$a,Stub$stub,$isNested,$filter =0)
118137
{
119-
$prefix = Caster::PREFIX_VIRTUAL;
138+
if (isset($a["\x00AMQPEnvelope\x00body"])) {
139+
$prefix ="\0AMQPEnvelope\0";
140+
}else {
141+
$prefix = Caster::PREFIX_VIRTUAL;
142+
}
120143

121144
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
122145
$a +=array($prefix.'body' =>$c->getBody());
123146
}
124147

125148
$a +=array(
126-
$prefix.'routingKey' =>$c->getRoutingKey(),
127-
$prefix.'deliveryTag' =>$c->getDeliveryTag(),
128-
$prefix.'deliveryMode' =>newConstStub($c->getDeliveryMode().(2 ===$c->getDeliveryMode() ?' (persistent)' :' (non-persistent)'),$c->getDeliveryMode()),
129-
$prefix.'exchangeName' =>$c->getExchangeName(),
130-
$prefix.'isRedelivery' =>$c->isRedelivery(),
131-
$prefix.'contentType' =>$c->getContentType(),
132-
$prefix.'contentEncoding' =>$c->getContentEncoding(),
133-
$prefix.'type' =>$c->getType(),
134-
$prefix.'timestamp' =>$c->getTimeStamp(),
149+
$prefix.'delivery_tag' =>$c->getDeliveryTag(),
150+
$prefix.'is_redelivery' =>$c->isRedelivery(),
151+
$prefix.'exchange_name' =>$c->getExchangeName(),
152+
$prefix.'routing_key' =>$c->getRoutingKey(),
153+
$prefix.'content_type' =>$c->getContentType(),
154+
$prefix.'content_encoding' =>$c->getContentEncoding(),
155+
$prefix.'headers' =>$c->getHeaders(),
156+
$prefix.'delivery_mode' =>null,
135157
$prefix.'priority' =>$c->getPriority(),
158+
$prefix.'correlation_id' =>$c->getCorrelationId(),
159+
$prefix.'reply_to' =>$c->getReplyTo(),
136160
$prefix.'expiration' =>$c->getExpiration(),
137-
$prefix.'userId' =>$c->getUserId(),
138-
$prefix.'appId' =>$c->getAppId(),
139-
$prefix.'messageId' =>$c->getMessageId(),
140-
$prefix.'replyTo' =>$c->getReplyTo(),
141-
$prefix.'correlationId' =>$c->getCorrelationId(),
142-
$prefix.'headers' =>$c->getHeaders(),
161+
$prefix.'message_id' =>$c->getMessageId(),
162+
$prefix.'timestamp' =>$c->getTimeStamp(),
163+
$prefix.'type' =>$c->getType(),
164+
$prefix.'user_id' =>$c->getUserId(),
165+
$prefix.'app_id' =>$c->getAppId(),
143166
);
144167

168+
$a[$prefix.'delivery_mode'] =newConstStub($c->getDeliveryMode().(2 ===$c->getDeliveryMode() ?' (persistent)' :' (non-persistent)'),$c->getDeliveryMode());
169+
145170
return$a;
146171
}
147172

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp