comparison vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
33 { 33 {
34 if ($value instanceof \__PHP_Incomplete_Class) { 34 if ($value instanceof \__PHP_Incomplete_Class) {
35 return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value)); 35 return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
36 } 36 }
37 37
38 if (is_object($value)) { 38 if (\is_object($value)) {
39 if ($value instanceof \DateTimeInterface) { 39 if ($value instanceof \DateTimeInterface) {
40 return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM)); 40 return sprintf('Object(%s) - %s', \get_class($value), $value->format(\DateTime::ATOM));
41 } 41 }
42 42
43 return sprintf('Object(%s)', get_class($value)); 43 return sprintf('Object(%s)', \get_class($value));
44 } 44 }
45 45
46 if (is_array($value)) { 46 if (\is_array($value)) {
47 if (empty($value)) { 47 if (empty($value)) {
48 return '[]'; 48 return '[]';
49 } 49 }
50 50
51 $indent = str_repeat(' ', $depth); 51 $indent = str_repeat(' ', $depth);
52 52
53 $a = array(); 53 $a = [];
54 foreach ($value as $k => $v) { 54 foreach ($value as $k => $v) {
55 if (is_array($v)) { 55 if (\is_array($v)) {
56 $deep = true; 56 $deep = true;
57 } 57 }
58 $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep)); 58 $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
59 } 59 }
60 60
62 return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1)); 62 return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
63 } 63 }
64 64
65 $s = sprintf('[%s]', implode(', ', $a)); 65 $s = sprintf('[%s]', implode(', ', $a));
66 66
67 if (80 > strlen($s)) { 67 if (80 > \strlen($s)) {
68 return $s; 68 return $s;
69 } 69 }
70 70
71 return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a)); 71 return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a));
72 } 72 }
73 73
74 if (is_resource($value)) { 74 if (\is_resource($value)) {
75 return sprintf('Resource(%s#%d)', get_resource_type($value), $value); 75 return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
76 } 76 }
77 77
78 if (null === $value) { 78 if (null === $value) {
79 return 'null'; 79 return 'null';