comparison vendor/symfony/var-dumper/Cloner/AbstractCloner.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children c2387f117808
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
107 'MongoCursorInterface' => array('Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'), 107 'MongoCursorInterface' => array('Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'),
108 108
109 'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'), 109 'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'),
110 'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'), 110 'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'),
111 111
112 'DateTimeInterface' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'),
113 'DateInterval' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'),
114 'DateTimeZone' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'),
115 'DatePeriod' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'),
116
112 ':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'), 117 ':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'),
113 ':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'), 118 ':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
114 ':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'), 119 ':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
115 ':gd' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'), 120 ':gd' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'),
116 ':mysql link' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'), 121 ':mysql link' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'),
125 ':xml' => array('Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'), 130 ':xml' => array('Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'),
126 ); 131 );
127 132
128 protected $maxItems = 2500; 133 protected $maxItems = 2500;
129 protected $maxString = -1; 134 protected $maxString = -1;
135 protected $minDepth = 1;
130 protected $useExt; 136 protected $useExt;
131 137
132 private $casters = array(); 138 private $casters = array();
133 private $prevErrorHandler; 139 private $prevErrorHandler;
134 private $classInfo = array(); 140 private $classInfo = array();
164 $this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback; 170 $this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback;
165 } 171 }
166 } 172 }
167 173
168 /** 174 /**
169 * Sets the maximum number of items to clone past the first level in nested structures. 175 * Sets the maximum number of items to clone past the minimum depth in nested structures.
170 * 176 *
171 * @param int $maxItems 177 * @param int $maxItems
172 */ 178 */
173 public function setMaxItems($maxItems) 179 public function setMaxItems($maxItems)
174 { 180 {
181 * @param int $maxString 187 * @param int $maxString
182 */ 188 */
183 public function setMaxString($maxString) 189 public function setMaxString($maxString)
184 { 190 {
185 $this->maxString = (int) $maxString; 191 $this->maxString = (int) $maxString;
192 }
193
194 /**
195 * Sets the minimum tree depth where we are guaranteed to clone all the items. After this
196 * depth is reached, only setMaxItems items will be cloned.
197 *
198 * @param int $minDepth
199 */
200 public function setMinDepth($minDepth)
201 {
202 $this->minDepth = (int) $minDepth;
186 } 203 }
187 204
188 /** 205 /**
189 * Clones a PHP variable. 206 * Clones a PHP variable.
190 * 207 *
193 * 210 *
194 * @return Data The cloned variable represented by a Data object 211 * @return Data The cloned variable represented by a Data object
195 */ 212 */
196 public function cloneVar($var, $filter = 0) 213 public function cloneVar($var, $filter = 0)
197 { 214 {
198 $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) { 215 $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) {
199 if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { 216 if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
200 // Cloner never dies 217 // Cloner never dies
201 throw new \ErrorException($msg, 0, $type, $file, $line); 218 throw new \ErrorException($msg, 0, $type, $file, $line);
202 } 219 }
203 220