comparison vendor/zendframework/zend-diactoros/src/MessageTrait.php @ 2:5311817fb629

Theme updates
author Chris Cannam
date Tue, 10 Jul 2018 13:19:18 +0000
parents c75dbcec494b
children a9cd425dd02b
comparison
equal deleted inserted replaced
1:0b0e5f3b1e83 2:5311817fb629
1 <?php 1 <?php
2 /** 2 /**
3 * Zend Framework (http://framework.zend.com/) 3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository
4 * 4 * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
5 * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
6 * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License 5 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
8 */ 6 */
9 7
10 namespace Zend\Diactoros; 8 namespace Zend\Diactoros;
11 9
12 use InvalidArgumentException; 10 use InvalidArgumentException;
13 use Psr\Http\Message\StreamInterface; 11 use Psr\Http\Message\StreamInterface;
12
13 use function array_map;
14 use function array_merge;
15 use function get_class;
16 use function gettype;
17 use function implode;
18 use function is_array;
19 use function is_object;
20 use function is_resource;
21 use function is_string;
22 use function preg_match;
23 use function sprintf;
24 use function strtolower;
14 25
15 /** 26 /**
16 * Trait implementing the various methods defined in MessageInterface. 27 * Trait implementing the various methods defined in MessageInterface.
17 * 28 *
18 * @see https://github.com/php-fig/http-message/tree/master/src/MessageInterface.php 29 * @see https://github.com/php-fig/http-message/tree/master/src/MessageInterface.php
341 * @throws InvalidArgumentException on invalid HTTP protocol version 352 * @throws InvalidArgumentException on invalid HTTP protocol version
342 */ 353 */
343 private function validateProtocolVersion($version) 354 private function validateProtocolVersion($version)
344 { 355 {
345 if (empty($version)) { 356 if (empty($version)) {
346 throw new InvalidArgumentException(sprintf( 357 throw new InvalidArgumentException(
347 'HTTP protocol version can not be empty' 358 'HTTP protocol version can not be empty'
348 )); 359 );
349 } 360 }
350 if (! is_string($version)) { 361 if (! is_string($version)) {
351 throw new InvalidArgumentException(sprintf( 362 throw new InvalidArgumentException(sprintf(
352 'Unsupported HTTP protocol version; must be a string, received %s', 363 'Unsupported HTTP protocol version; must be a string, received %s',
353 (is_object($version) ? get_class($version) : gettype($version)) 364 (is_object($version) ? get_class($version) : gettype($version))