@@ -17,7 +17,7 @@ class PendingRequest
17
17
/**
18
18
* The factory instance.
19
19
*
20
- * @var \Illuminate\Http\Client \Factory|null
20
+ * @var \MacsiDigital\API\Support \Factory|null
21
21
*/
22
22
protected $ factory ;
23
23
@@ -94,7 +94,7 @@ class PendingRequest
94
94
/**
95
95
* Create a new HTTP Client instance.
96
96
*
97
- * @param \Illuminate\Http\Client \Factory|null $factory
97
+ * @param \MacsiDigital\API\Support \Factory|null $factory
98
98
* @return void
99
99
*/
100
100
public function __construct (Factory $ factory = null )
@@ -379,7 +379,7 @@ public function beforeSending($callback)
379
379
*
380
380
* @param string $url
381
381
* @param array|string|null $query
382
- * @return \Illuminate\Http\Client \Response
382
+ * @return \MacsiDigital\API\Support \Response
383
383
*/
384
384
public function get (string $ url , $ query = null )
385
385
{
@@ -393,7 +393,7 @@ public function get(string $url, $query = null)
393
393
*
394
394
* @param string $url
395
395
* @param array|string|null $query
396
- * @return \Illuminate\Http\Client \Response
396
+ * @return \MacsiDigital\API\Support \Response
397
397
*/
398
398
public function head (string $ url , $ query = null )
399
399
{
@@ -407,7 +407,7 @@ public function head(string $url, $query = null)
407
407
*
408
408
* @param string $url
409
409
* @param array $data
410
- * @return \Illuminate\Http\Client \Response
410
+ * @return \MacsiDigital\API\Support \Response
411
411
*/
412
412
public function post (string $ url , array $ data = [])
413
413
{
@@ -421,7 +421,7 @@ public function post(string $url, array $data = [])
421
421
*
422
422
* @param string $url
423
423
* @param array $data
424
- * @return \Illuminate\Http\Client \Response
424
+ * @return \MacsiDigital\API\Support \Response
425
425
*/
426
426
public function patch ($ url , $ data = [])
427
427
{
@@ -435,7 +435,7 @@ public function patch($url, $data = [])
435
435
*
436
436
* @param string $url
437
437
* @param array $data
438
- * @return \Illuminate\Http\Client \Response
438
+ * @return \MacsiDigital\API\Support \Response
439
439
*/
440
440
public function put ($ url , $ data = [])
441
441
{
@@ -449,7 +449,7 @@ public function put($url, $data = [])
449
449
*
450
450
* @param string $url
451
451
* @param array $data
452
- * @return \Illuminate\Http\Client \Response
452
+ * @return \MacsiDigital\API\Support \Response
453
453
*/
454
454
public function delete ($ url , $ data = [])
455
455
{
@@ -464,7 +464,7 @@ public function delete($url, $data = [])
464
464
* @param string $method
465
465
* @param string $url
466
466
* @param array $options
467
- * @return \Illuminate\Http\Client \Response
467
+ * @return \MacsiDigital\API\Support \Response
468
468
*
469
469
* @throws \Exception
470
470
*/
@@ -486,10 +486,10 @@ public function send(string $method, string $url, array $options = [])
486
486
487
487
return retry ($ this ->tries ?? 1 , function () use ($ method , $ url , $ options ) {
488
488
try {
489
- $ laravelData = $ this ->parseRequestData ($ method , $ url , $ options );
489
+ $ apiData = $ this ->parseRequestData ($ method , $ url , $ options );
490
490
491
491
return tap (new Response ($ this ->buildClient ()->request ($ method , $ url , $ this ->mergeOptions ([
492
- 'laravel_data ' => $ laravelData ,
492
+ 'api_data ' => $ apiData ,
493
493
'on_stats ' => function ($ transferStats ) {
494
494
$ this ->transferStats = $ transferStats ;
495
495
},
@@ -530,21 +530,21 @@ protected function parseMultipartBodyFormat(array $data)
530
530
*/
531
531
protected function parseRequestData ($ method , $ url , array $ options )
532
532
{
533
- $ laravelData = $ options [$ this ->bodyFormat ] ?? $ options ['query ' ] ?? [];
533
+ $ apiData = $ options [$ this ->bodyFormat ] ?? $ options ['query ' ] ?? [];
534
534
535
- $ urlString = Str:: of ($ url );
535
+ $ urlString = new Stringable ($ url );
536
536
537
- if (empty ($ laravelData ) && $ method === 'GET ' && $ urlString ->contains ('? ' )) {
538
- $ laravelData = (string ) $ urlString ->after ('? ' );
537
+ if (empty ($ apiData ) && $ method === 'GET ' && $ urlString ->contains ('? ' )) {
538
+ $ apiData = (string ) $ urlString ->after ('? ' );
539
539
}
540
540
541
- if (is_string ($ laravelData )) {
542
- parse_str ($ laravelData , $ parsedData );
541
+ if (is_string ($ apiData )) {
542
+ parse_str ($ apiData , $ parsedData );
543
543
544
- $ laravelData = is_array ($ parsedData ) ? $ parsedData : [];
544
+ $ apiData = is_array ($ parsedData ) ? $ parsedData : [];
545
545
}
546
546
547
- return $ laravelData ;
547
+ return $ apiData ;
548
548
}
549
549
550
550
/**
@@ -601,7 +601,7 @@ public function buildRecorderHandler()
601
601
602
602
return $ promise ->then (function ($ response ) use ($ request , $ options ) {
603
603
optional ($ this ->factory )->recordRequestResponsePair (
604
- (new Request ($ request ))->withData ($ options ['laravel_data ' ]),
604
+ (new Request ($ request ))->withData ($ options ['api_data ' ]),
605
605
new Response ($ response )
606
606
);
607
607
@@ -622,7 +622,7 @@ public function buildStubHandler()
622
622
return function ($ request , $ options ) use ($ handler ) {
623
623
$ response = ($ this ->stubCallbacks ?? collect ())
624
624
->map
625
- ->__invoke ((new Request ($ request ))->withData ($ options ['laravel_data ' ]), $ options )
625
+ ->__invoke ((new Request ($ request ))->withData ($ options ['api_data ' ]), $ options )
626
626
->filter ()
627
627
->first ();
628
628
@@ -648,7 +648,7 @@ public function runBeforeSendingCallbacks($request, array $options)
648
648
{
649
649
return tap ($ request , function ($ request ) use ($ options ) {
650
650
$ this ->beforeSendingCallbacks ->each ->__invoke (
651
- (new Request ($ request ))->withData ($ options ['laravel_data ' ]),
651
+ (new Request ($ request ))->withData ($ options ['api_data ' ]),
652
652
$ options
653
653
);
654
654
});
0 commit comments