autoload 순서 변경
This commit is contained in:
+4
-4
@@ -18,12 +18,12 @@
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"sammo\\": [
|
||||
"src/sammo",
|
||||
"d_setting"
|
||||
"d_setting",
|
||||
"src/sammo"
|
||||
],
|
||||
"kakao\\": [
|
||||
"src/kakao",
|
||||
"d_setting"
|
||||
"d_setting",
|
||||
"src/kakao"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+7
-7
@@ -90,16 +90,16 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.3.0",
|
||||
"version": "6.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
|
||||
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/49e42e6539f775e80c74086a710a882e1d5a8111",
|
||||
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -109,7 +109,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
@@ -118,7 +118,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.2-dev"
|
||||
"dev-master": "6.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -151,7 +151,7 @@
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2017-06-22T18:50:49+00:00"
|
||||
"time": "2018-03-26T12:06:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
|
||||
+14
-11
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
/**
|
||||
* https://php.net/manual/kr/language.oop5.autoload.php#120258
|
||||
* 현재 디렉토리 기준으로 php 파일 탐색.
|
||||
@@ -15,6 +13,18 @@ class Autoloader
|
||||
if($isRegisterd){
|
||||
return;
|
||||
}
|
||||
|
||||
//trick, 개인용 세팅의 경우 d_setting의 값을 우선시하도록 함.
|
||||
spl_autoload_register(function ($class) {
|
||||
$class = Util::array_last(explode('\\', $class));
|
||||
$file = __DIR__."/d_setting/{$class}.php";
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$isRegisterd = true;
|
||||
spl_autoload_register(function ($class) {
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
||||
@@ -25,19 +35,12 @@ class Autoloader
|
||||
return false;
|
||||
});
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$class = Util::array_last(explode('\\', $class));
|
||||
$file = __DIR__."/d_setting/{$class}.php";
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Autoloader::register();
|
||||
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
/******************************************************************************
|
||||
체섭용 인클루드 파일
|
||||
|
||||
Vendored
+2
-2
@@ -6,8 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'sammo\\' => array($baseDir . '/src/sammo', $baseDir . '/d_setting'),
|
||||
'kakao\\' => array($baseDir . '/src/kakao', $baseDir . '/d_setting'),
|
||||
'sammo\\' => array($baseDir . '/d_setting', $baseDir . '/src/sammo'),
|
||||
'kakao\\' => array($baseDir . '/d_setting', $baseDir . '/src/kakao'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
||||
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
||||
|
||||
Vendored
+4
-4
@@ -46,13 +46,13 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'sammo\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src/sammo',
|
||||
1 => __DIR__ . '/../..' . '/d_setting',
|
||||
0 => __DIR__ . '/../..' . '/d_setting',
|
||||
1 => __DIR__ . '/../..' . '/src/sammo',
|
||||
),
|
||||
'kakao\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src/kakao',
|
||||
1 => __DIR__ . '/../..' . '/d_setting',
|
||||
0 => __DIR__ . '/../..' . '/d_setting',
|
||||
1 => __DIR__ . '/../..' . '/src/kakao',
|
||||
),
|
||||
'Psr\\Log\\' =>
|
||||
array (
|
||||
|
||||
Vendored
+8
-8
@@ -87,17 +87,17 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"version": "6.3.1",
|
||||
"version_normalized": "6.3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
|
||||
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/49e42e6539f775e80c74086a710a882e1d5a8111",
|
||||
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -107,17 +107,17 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Required for using the Log middleware"
|
||||
},
|
||||
"time": "2017-06-22T18:50:49+00:00",
|
||||
"time": "2018-03-26T12:06:26+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.2-dev"
|
||||
"dev-master": "6.3-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
|
||||
+14
-1
@@ -1,4 +1,17 @@
|
||||
# CHANGELOG
|
||||
# Change Log
|
||||
|
||||
## 6.3.1 - 2018-03-26
|
||||
|
||||
* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014)
|
||||
* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012)
|
||||
* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999)
|
||||
* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998)
|
||||
* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953)
|
||||
* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915)
|
||||
* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916)
|
||||
|
||||
+ Minor code cleanups, documentation fixes and clarifications.
|
||||
|
||||
|
||||
## 6.3.0 - 2017-06-22
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
||||
Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
Vendored
+3
-1
@@ -1,7 +1,9 @@
|
||||
Guzzle, PHP HTTP client
|
||||
=======================
|
||||
|
||||
[](https://travis-ci.org/guzzle/guzzle)
|
||||
[](https://github.com/guzzle/guzzle/releases)
|
||||
[](https://travis-ci.org/guzzle/guzzle)
|
||||
[](https://packagist.org/packages/guzzlehttp/guzzle)
|
||||
|
||||
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
|
||||
trivial to integrate with web services.
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.2-dev"
|
||||
"dev-master": "6.3-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-10
@@ -290,7 +290,14 @@ class Client implements ClientInterface
|
||||
*/
|
||||
private function applyOptions(RequestInterface $request, array &$options)
|
||||
{
|
||||
$modify = [];
|
||||
$modify = [
|
||||
'set_headers' => [],
|
||||
];
|
||||
|
||||
if (isset($options['headers'])) {
|
||||
$modify['set_headers'] = $options['headers'];
|
||||
unset($options['headers']);
|
||||
}
|
||||
|
||||
if (isset($options['form_params'])) {
|
||||
if (isset($options['multipart'])) {
|
||||
@@ -302,6 +309,8 @@ class Client implements ClientInterface
|
||||
}
|
||||
$options['body'] = http_build_query($options['form_params'], '', '&');
|
||||
unset($options['form_params']);
|
||||
// Ensure that we don't have the header in different case and set the new value.
|
||||
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
|
||||
@@ -313,24 +322,19 @@ class Client implements ClientInterface
|
||||
if (isset($options['json'])) {
|
||||
$options['body'] = \GuzzleHttp\json_encode($options['json']);
|
||||
unset($options['json']);
|
||||
// Ensure that we don't have the header in different case and set the new value.
|
||||
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||
$options['_conditional']['Content-Type'] = 'application/json';
|
||||
}
|
||||
|
||||
if (!empty($options['decode_content'])
|
||||
&& $options['decode_content'] !== true
|
||||
) {
|
||||
// Ensure that we don't have the header in different case and set the new value.
|
||||
$options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $modify['set_headers']);
|
||||
$modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
|
||||
}
|
||||
|
||||
if (isset($options['headers'])) {
|
||||
if (isset($modify['set_headers'])) {
|
||||
$modify['set_headers'] = $options['headers'] + $modify['set_headers'];
|
||||
} else {
|
||||
$modify['set_headers'] = $options['headers'];
|
||||
}
|
||||
unset($options['headers']);
|
||||
}
|
||||
|
||||
if (isset($options['body'])) {
|
||||
if (is_array($options['body'])) {
|
||||
$this->invalidBody();
|
||||
@@ -344,6 +348,8 @@ class Client implements ClientInterface
|
||||
$type = isset($value[2]) ? strtolower($value[2]) : 'basic';
|
||||
switch ($type) {
|
||||
case 'basic':
|
||||
// Ensure that we don't have the header in different case and set the new value.
|
||||
$modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
|
||||
$modify['set_headers']['Authorization'] = 'Basic '
|
||||
. base64_encode("$value[0]:$value[1]");
|
||||
break;
|
||||
@@ -382,6 +388,8 @@ class Client implements ClientInterface
|
||||
$request = Psr7\modify_request($request, $modify);
|
||||
if ($request->getBody() instanceof Psr7\MultipartStream) {
|
||||
// Use a multipart/form-data POST if a Content-Type is not set.
|
||||
// Ensure that we don't have the header in different case and set the new value.
|
||||
$options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
|
||||
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
|
||||
. $request->getBody()->getBoundary();
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ use Psr\Http\Message\UriInterface;
|
||||
*/
|
||||
interface ClientInterface
|
||||
{
|
||||
const VERSION = '6.2.1';
|
||||
const VERSION = '6.3.1';
|
||||
|
||||
/**
|
||||
* Send an HTTP request.
|
||||
|
||||
+3
-3
@@ -95,11 +95,11 @@ class CookieJar implements CookieJarInterface
|
||||
public function getCookieByName($name)
|
||||
{
|
||||
// don't allow a null name
|
||||
if($name === null) {
|
||||
if ($name === null) {
|
||||
return null;
|
||||
}
|
||||
foreach($this->cookies as $cookie) {
|
||||
if($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
|
||||
foreach ($this->cookies as $cookie) {
|
||||
if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
|
||||
return $cookie;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class SessionCookieJar extends CookieJar
|
||||
/**
|
||||
* Create a new SessionCookieJar object
|
||||
*
|
||||
* @param string $sessionKey Session key name to store the cookie
|
||||
* @param string $sessionKey Session key name to store the cookie
|
||||
* data in session
|
||||
* @param bool $storeSessionCookies Set to true to store session cookies
|
||||
* in the cookie jar.
|
||||
|
||||
+4
-5
@@ -35,14 +35,13 @@ class SetCookie
|
||||
$data = self::$defaults;
|
||||
// Explode the cookie string using a series of semicolons
|
||||
$pieces = array_filter(array_map('trim', explode(';', $cookie)));
|
||||
// The name of the cookie (first kvp) must include an equal sign.
|
||||
if (empty($pieces) || !strpos($pieces[0], '=')) {
|
||||
// The name of the cookie (first kvp) must exist and include an equal sign.
|
||||
if (empty($pieces[0]) || !strpos($pieces[0], '=')) {
|
||||
return new self($data);
|
||||
}
|
||||
|
||||
// Add the cookie pieces into the parsed data array
|
||||
foreach ($pieces as $part) {
|
||||
|
||||
$cookieParts = explode('=', $part, 2);
|
||||
$key = trim($cookieParts[0]);
|
||||
$value = isset($cookieParts[1])
|
||||
@@ -349,7 +348,7 @@ class SetCookie
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain);
|
||||
return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -359,7 +358,7 @@ class SetCookie
|
||||
*/
|
||||
public function isExpired()
|
||||
{
|
||||
return $this->getExpires() && time() > $this->getExpires();
|
||||
return $this->getExpires() !== null && time() > $this->getExpires();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<?php
|
||||
namespace GuzzleHttp\Exception;
|
||||
|
||||
/**
|
||||
* @method string getMessage()
|
||||
* @method \Throwable|null getPrevious()
|
||||
* @method mixed getCode()
|
||||
* @method string getFile()
|
||||
* @method int getLine()
|
||||
* @method array getTrace()
|
||||
* @method string getTraceAsString()
|
||||
*/
|
||||
interface GuzzleException {}
|
||||
|
||||
+9
-3
@@ -4,7 +4,6 @@ namespace GuzzleHttp\Handler;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Promise\FulfilledPromise;
|
||||
use GuzzleHttp\Promise\RejectedPromise;
|
||||
use GuzzleHttp\Psr7;
|
||||
use GuzzleHttp\Psr7\LazyOpenStream;
|
||||
use GuzzleHttp\TransferStats;
|
||||
@@ -288,7 +287,14 @@ class CurlFactory implements CurlFactoryInterface
|
||||
{
|
||||
foreach ($conf['_headers'] as $name => $values) {
|
||||
foreach ($values as $value) {
|
||||
$conf[CURLOPT_HTTPHEADER][] = "$name: $value";
|
||||
$value = (string) $value;
|
||||
if ($value === '') {
|
||||
// cURL requires a special format for empty headers.
|
||||
// See https://github.com/guzzle/guzzle/issues/1882 for more details.
|
||||
$conf[CURLOPT_HTTPHEADER][] = "$name;";
|
||||
} else {
|
||||
$conf[CURLOPT_HTTPHEADER][] = "$name: $value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +394,7 @@ class CurlFactory implements CurlFactoryInterface
|
||||
if (isset($options['force_ip_resolve'])) {
|
||||
if ('v4' === $options['force_ip_resolve']) {
|
||||
$conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
|
||||
} else if ('v6' === $options['force_ip_resolve']) {
|
||||
} elseif ('v6' === $options['force_ip_resolve']) {
|
||||
$conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,9 @@ class CurlMultiHandler
|
||||
|
||||
$promise = new Promise(
|
||||
[$this, 'execute'],
|
||||
function () use ($id) { return $this->cancel($id); }
|
||||
function () use ($id) {
|
||||
return $this->cancel($id);
|
||||
}
|
||||
);
|
||||
|
||||
$this->addRequest(['easy' => $easy, 'deferred' => $promise]);
|
||||
|
||||
+3
-4
@@ -4,7 +4,6 @@ namespace GuzzleHttp\Handler;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Promise\FulfilledPromise;
|
||||
use GuzzleHttp\Promise\RejectedPromise;
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use GuzzleHttp\Psr7;
|
||||
use GuzzleHttp\TransferStats;
|
||||
@@ -61,6 +60,7 @@ class StreamHandler
|
||||
if (strpos($message, 'getaddrinfo') // DNS lookup failed
|
||||
|| strpos($message, 'Connection refused')
|
||||
|| strpos($message, "couldn't connect to host") // error on HHVM
|
||||
|| strpos($message, "connection attempt failed")
|
||||
) {
|
||||
$e = new ConnectException($e->getMessage(), $request, $e);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class StreamHandler
|
||||
$status = $parts[1];
|
||||
$reason = isset($parts[2]) ? $parts[2] : null;
|
||||
$headers = \GuzzleHttp\headers_from_lines($hdrs);
|
||||
list ($stream, $headers) = $this->checkDecode($options, $headers, $stream);
|
||||
list($stream, $headers) = $this->checkDecode($options, $headers, $stream);
|
||||
$stream = Psr7\stream_for($stream);
|
||||
$sink = $stream;
|
||||
|
||||
@@ -276,7 +276,7 @@ class StreamHandler
|
||||
}
|
||||
|
||||
$params = [];
|
||||
$context = $this->getDefaultContext($request, $options);
|
||||
$context = $this->getDefaultContext($request);
|
||||
|
||||
if (isset($options['on_headers']) && !is_callable($options['on_headers'])) {
|
||||
throw new \InvalidArgumentException('on_headers must be callable');
|
||||
@@ -307,7 +307,6 @@ class StreamHandler
|
||||
&& isset($options['auth'][2])
|
||||
&& 'ntlm' == $options['auth'][2]
|
||||
) {
|
||||
|
||||
throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler');
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ class HandlerStack
|
||||
* Creates a default handler stack that can be used by clients.
|
||||
*
|
||||
* The returned handler will wrap the provided handler or use the most
|
||||
* appropriate default handler for you system. The returned HandlerStack has
|
||||
* appropriate default handler for your system. The returned HandlerStack has
|
||||
* support for cookies, redirects, HTTP error exceptions, and preparing a body
|
||||
* before sending.
|
||||
*
|
||||
|
||||
@@ -19,7 +19,6 @@ use Psr\Http\Message\ResponseInterface;
|
||||
* - {host}: Host of the request
|
||||
* - {method}: Method of the request
|
||||
* - {uri}: URI of the request
|
||||
* - {host}: Host of the request
|
||||
* - {version}: Protocol version
|
||||
* - {target}: Request target of the request (path + query + fragment)
|
||||
* - {hostname}: Hostname of the machine that sent the request
|
||||
@@ -74,7 +73,6 @@ class MessageFormatter
|
||||
return preg_replace_callback(
|
||||
'/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
|
||||
function (array $matches) use ($request, $response, $error, &$cache) {
|
||||
|
||||
if (isset($cache[$matches[1]])) {
|
||||
return $cache[$matches[1]];
|
||||
}
|
||||
|
||||
+5
-4
@@ -34,10 +34,11 @@ final class Middleware
|
||||
$cookieJar = $options['cookies'];
|
||||
$request = $cookieJar->withCookieHeader($request);
|
||||
return $handler($request, $options)
|
||||
->then(function ($response) use ($cookieJar, $request) {
|
||||
$cookieJar->extractCookies($request, $response);
|
||||
return $response;
|
||||
}
|
||||
->then(
|
||||
function ($response) use ($cookieJar, $request) {
|
||||
$cookieJar->extractCookies($request, $response);
|
||||
return $response;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -107,7 +107,6 @@ class UriTemplate
|
||||
$useQuery = self::$operatorHash[$parsed['operator']]['query'];
|
||||
|
||||
foreach ($parsed['values'] as $value) {
|
||||
|
||||
if (!isset($this->variables[$value['value']])) {
|
||||
continue;
|
||||
}
|
||||
@@ -117,11 +116,9 @@ class UriTemplate
|
||||
$expanded = '';
|
||||
|
||||
if (is_array($variable)) {
|
||||
|
||||
$isAssoc = $this->isAssoc($variable);
|
||||
$kvp = [];
|
||||
foreach ($variable as $key => $var) {
|
||||
|
||||
if ($isAssoc) {
|
||||
$key = rawurlencode($key);
|
||||
$isNestedArray = is_array($var);
|
||||
@@ -179,7 +176,6 @@ class UriTemplate
|
||||
}
|
||||
$expanded = implode(',', $kvp);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($value['modifier'] === ':') {
|
||||
$variable = substr($variable, 0, $value['position']);
|
||||
|
||||
+4
-2
@@ -302,7 +302,8 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
|
||||
$data = \json_decode($json, $assoc, $depth, $options);
|
||||
if (JSON_ERROR_NONE !== json_last_error()) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json_decode error: ' . json_last_error_msg());
|
||||
'json_decode error: ' . json_last_error_msg()
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
@@ -324,7 +325,8 @@ function json_encode($value, $options = 0, $depth = 512)
|
||||
$json = \json_encode($value, $options, $depth);
|
||||
if (JSON_ERROR_NONE !== json_last_error()) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json_encode error: ' . json_last_error_msg());
|
||||
'json_encode error: ' . json_last_error_msg()
|
||||
);
|
||||
}
|
||||
|
||||
return $json;
|
||||
|
||||
Reference in New Issue
Block a user