Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/var-dumper/Dumper/AbstractDumper.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
47 $this->flags = (int) $flags; | 47 $this->flags = (int) $flags; |
48 $this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'); | 48 $this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'); |
49 $this->decimalPoint = localeconv(); | 49 $this->decimalPoint = localeconv(); |
50 $this->decimalPoint = $this->decimalPoint['decimal_point']; | 50 $this->decimalPoint = $this->decimalPoint['decimal_point']; |
51 $this->setOutput($output ?: static::$defaultOutput); | 51 $this->setOutput($output ?: static::$defaultOutput); |
52 if (!$output && is_string(static::$defaultOutput)) { | 52 if (!$output && \is_string(static::$defaultOutput)) { |
53 static::$defaultOutput = $this->outputStream; | 53 static::$defaultOutput = $this->outputStream; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 /** | 57 /** |
63 */ | 63 */ |
64 public function setOutput($output) | 64 public function setOutput($output) |
65 { | 65 { |
66 $prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper; | 66 $prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper; |
67 | 67 |
68 if (is_callable($output)) { | 68 if (\is_callable($output)) { |
69 $this->outputStream = null; | 69 $this->outputStream = null; |
70 $this->lineDumper = $output; | 70 $this->lineDumper = $output; |
71 } else { | 71 } else { |
72 if (is_string($output)) { | 72 if (\is_string($output)) { |
73 $output = fopen($output, 'wb'); | 73 $output = fopen($output, 'wb'); |
74 } | 74 } |
75 $this->outputStream = $output; | 75 $this->outputStream = $output; |
76 $this->lineDumper = array($this, 'echoLine'); | 76 $this->lineDumper = [$this, 'echoLine']; |
77 } | 77 } |
78 | 78 |
79 return $prev; | 79 return $prev; |
80 } | 80 } |
81 | 81 |
162 * @param int $depth The recursive depth in the dumped structure for the line being dumped, | 162 * @param int $depth The recursive depth in the dumped structure for the line being dumped, |
163 * or -1 to signal the end-of-dump to the line dumper callable | 163 * or -1 to signal the end-of-dump to the line dumper callable |
164 */ | 164 */ |
165 protected function dumpLine($depth) | 165 protected function dumpLine($depth) |
166 { | 166 { |
167 call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad); | 167 \call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad); |
168 $this->line = ''; | 168 $this->line = ''; |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * Generic line dumper callback. | 172 * Generic line dumper callback. |
193 { | 193 { |
194 if (preg_match('//u', $s)) { | 194 if (preg_match('//u', $s)) { |
195 return $s; | 195 return $s; |
196 } | 196 } |
197 | 197 |
198 if (!function_exists('iconv')) { | 198 if (!\function_exists('iconv')) { |
199 throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); | 199 throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); |
200 } | 200 } |
201 | 201 |
202 if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) { | 202 if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) { |
203 return $c; | 203 return $c; |