comparison vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.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
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
36 */ 36 */
37 public static function isSupported($encoding, $convertEncoding = null) 37 public static function isSupported($encoding, $convertEncoding = null)
38 { 38 {
39 $supportedEncodings = static::getSupportedEncodings(); 39 $supportedEncodings = static::getSupportedEncodings();
40 40
41 if (!in_array(strtoupper($encoding), $supportedEncodings)) { 41 if (! in_array(strtoupper($encoding), $supportedEncodings)) {
42 return false; 42 return false;
43 } 43 }
44 44
45 if ($convertEncoding !== null && !in_array(strtoupper($convertEncoding), $supportedEncodings)) { 45 if ($convertEncoding !== null && ! in_array(strtoupper($convertEncoding), $supportedEncodings)) {
46 return false; 46 return false;
47 } 47 }
48 48
49 return true; 49 return true;
50 } 50 }
59 public function setEncoding($encoding, $convertEncoding = null) 59 public function setEncoding($encoding, $convertEncoding = null)
60 { 60 {
61 $supportedEncodings = static::getSupportedEncodings(); 61 $supportedEncodings = static::getSupportedEncodings();
62 62
63 $encodingUpper = strtoupper($encoding); 63 $encodingUpper = strtoupper($encoding);
64 if (!in_array($encodingUpper, $supportedEncodings)) { 64 if (! in_array($encodingUpper, $supportedEncodings)) {
65 throw new Exception\InvalidArgumentException( 65 throw new Exception\InvalidArgumentException(
66 'Wrapper doesn\'t support character encoding "' . $encoding . '"' 66 'Wrapper doesn\'t support character encoding "' . $encoding . '"'
67 ); 67 );
68 } 68 }
69 69
70 if ($convertEncoding !== null) { 70 if ($convertEncoding !== null) {
71 $convertEncodingUpper = strtoupper($convertEncoding); 71 $convertEncodingUpper = strtoupper($convertEncoding);
72 if (!in_array($convertEncodingUpper, $supportedEncodings)) { 72 if (! in_array($convertEncodingUpper, $supportedEncodings)) {
73 throw new Exception\InvalidArgumentException( 73 throw new Exception\InvalidArgumentException(
74 'Wrapper doesn\'t support character encoding "' . $convertEncoding . '"' 74 'Wrapper doesn\'t support character encoding "' . $convertEncoding . '"'
75 ); 75 );
76 } 76 }
77 77