comparison vendor/symfony/var-dumper/Caster/CutStub.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
22 { 22 {
23 public function __construct($value) 23 public function __construct($value)
24 { 24 {
25 $this->value = $value; 25 $this->value = $value;
26 26
27 switch (gettype($value)) { 27 switch (\gettype($value)) {
28 case 'object': 28 case 'object':
29 $this->type = self::TYPE_OBJECT; 29 $this->type = self::TYPE_OBJECT;
30 $this->class = get_class($value); 30 $this->class = \get_class($value);
31 $this->cut = -1; 31 $this->cut = -1;
32 break; 32 break;
33 33
34 case 'array': 34 case 'array':
35 $this->type = self::TYPE_ARRAY; 35 $this->type = self::TYPE_ARRAY;
36 $this->class = self::ARRAY_ASSOC; 36 $this->class = self::ARRAY_ASSOC;
37 $this->cut = $this->value = count($value); 37 $this->cut = $this->value = \count($value);
38 break; 38 break;
39 39
40 case 'resource': 40 case 'resource':
41 case 'unknown type': 41 case 'unknown type':
42 case 'resource (closed)': 42 case 'resource (closed)':
49 break; 49 break;
50 50
51 case 'string': 51 case 'string':
52 $this->type = self::TYPE_STRING; 52 $this->type = self::TYPE_STRING;
53 $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY; 53 $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
54 $this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8'); 54 $this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8');
55 $this->value = ''; 55 $this->value = '';
56 break; 56 break;
57 } 57 }
58 } 58 }
59 } 59 }