Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/browser-kit/Response.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 7a779792577d |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
26 * | 26 * |
27 * @param string $content The content of the response | 27 * @param string $content The content of the response |
28 * @param int $status The response status code | 28 * @param int $status The response status code |
29 * @param array $headers An array of headers | 29 * @param array $headers An array of headers |
30 */ | 30 */ |
31 public function __construct($content = '', $status = 200, array $headers = array()) | 31 public function __construct($content = '', $status = 200, array $headers = []) |
32 { | 32 { |
33 $this->content = $content; | 33 $this->content = $content; |
34 $this->status = $status; | 34 $this->status = $status; |
35 $this->headers = $headers; | 35 $this->headers = $headers; |
36 } | 36 } |
42 */ | 42 */ |
43 public function __toString() | 43 public function __toString() |
44 { | 44 { |
45 $headers = ''; | 45 $headers = ''; |
46 foreach ($this->headers as $name => $value) { | 46 foreach ($this->headers as $name => $value) { |
47 if (is_string($value)) { | 47 if (\is_string($value)) { |
48 $headers .= $this->buildHeader($name, $value); | 48 $headers .= $this->buildHeader($name, $value); |
49 } else { | 49 } else { |
50 foreach ($value as $headerValue) { | 50 foreach ($value as $headerValue) { |
51 $headers .= $this->buildHeader($name, $headerValue); | 51 $headers .= $this->buildHeader($name, $headerValue); |
52 } | 52 } |
111 { | 111 { |
112 $normalizedHeader = str_replace('-', '_', strtolower($header)); | 112 $normalizedHeader = str_replace('-', '_', strtolower($header)); |
113 foreach ($this->headers as $key => $value) { | 113 foreach ($this->headers as $key => $value) { |
114 if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) { | 114 if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) { |
115 if ($first) { | 115 if ($first) { |
116 return is_array($value) ? (count($value) ? $value[0] : '') : $value; | 116 return \is_array($value) ? (\count($value) ? $value[0] : '') : $value; |
117 } | 117 } |
118 | 118 |
119 return is_array($value) ? $value : array($value); | 119 return \is_array($value) ? $value : [$value]; |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 return $first ? null : array(); | 123 return $first ? null : []; |
124 } | 124 } |
125 } | 125 } |