@@ -32,6 +32,11 @@ class CachedResponseClient implements HttpClient
3232 */
3333 private $ apiKey ;
3434
35+ /**
36+ * @var null|string
37+ */
38+ private $ appCode ;
39+
3540 /**
3641 * @var string
3742 */
@@ -41,12 +46,14 @@ class CachedResponseClient implements HttpClient
4146 * @param HttpClient $delegate
4247 * @param string $cacheDir
4348 * @param string|null $apiKey
49+ * @param string|null $appCode
4450 */
45- public function __construct (HttpClient $ delegate , $ cacheDir , $ apiKey = null )
51+ public function __construct (HttpClient $ delegate , $ cacheDir , $ apiKey = null , $ appCode = null )
4652 {
4753 $ this ->delegate = $ delegate ;
4854 $ this ->cacheDir = $ cacheDir ;
4955 $ this ->apiKey = $ apiKey ;
56+ $ this ->appCode = $ appCode ;
5057 }
5158
5259 /**
@@ -62,6 +69,9 @@ public function sendRequest(RequestInterface $request)
6269 if (!empty ($ this ->apiKey )) {
6370 $ cacheKey = str_replace ($ this ->apiKey , '[apikey] ' , $ cacheKey );
6471 }
72+ if (!empty ($ this ->appCode )) {
73+ $ cacheKey = str_replace ($ this ->appCode , '[appCode] ' , $ cacheKey );
74+ }
6575
6676 $ file = sprintf ('%s/%s_%s ' , $ this ->cacheDir , $ host , sha1 ($ cacheKey ));
6777 if (is_file ($ file ) && is_readable ($ file )) {
0 commit comments