Overview

Namespaces

  • ShippoClient
    • Entity
    • Http
      • Request
        • Addresses
        • Parcels
        • Shipments
        • Transactions
      • Response
        • Exception

Classes

  • ShippoClient\Addresses
  • ShippoClient\Entity\Address
  • ShippoClient\Entity\AddressCollection
  • ShippoClient\Entity\EntityCollection
  • ShippoClient\Entity\Location
  • ShippoClient\Entity\ObjectInformation
  • ShippoClient\Entity\Parcel
  • ShippoClient\Entity\ParcelCollection
  • ShippoClient\Entity\Rate
  • ShippoClient\Entity\RateCollection
  • ShippoClient\Entity\Refund
  • ShippoClient\Entity\RefundCollection
  • ShippoClient\Entity\ServiceLevel
  • ShippoClient\Entity\Shipment
  • ShippoClient\Entity\ShipmentCollection
  • ShippoClient\Entity\TrackingHistory
  • ShippoClient\Entity\TrackingStatus
  • ShippoClient\Entity\Tracks
  • ShippoClient\Entity\Transaction
  • ShippoClient\Entity\TransactionCollection
  • ShippoClient\Entity\WebhookTracks
  • ShippoClient\Http\Request
  • ShippoClient\Http\Request\Addresses\CreateObject
  • ShippoClient\Http\Request\CommonParameter
  • ShippoClient\Http\Request\MockCollection
  • ShippoClient\Http\Request\Parcels\CreateObject
  • ShippoClient\Http\Request\Shipments\CreateObject
  • ShippoClient\Http\Request\Shipments\CreateObjectByNested
  • ShippoClient\Http\Request\Shipments\CreateReturnObject
  • ShippoClient\Http\Request\Transactions\CreateObject
  • ShippoClient\Http\Response\AddressList
  • ShippoClient\Http\Response\ListResponse
  • ShippoClient\Http\Response\ParcelList
  • ShippoClient\Http\Response\RateList
  • ShippoClient\Http\Response\RefundList
  • ShippoClient\Http\Response\ShipmentList
  • ShippoClient\Http\Response\TransactionList
  • ShippoClient\Parcels
  • ShippoClient\Rates
  • ShippoClient\Refunds
  • ShippoClient\Shipments
  • ShippoClient\ShippoClient
  • ShippoClient\Tracks
  • ShippoClient\Transactions

Exceptions

  • ShippoClient\Http\Response\Exception\BadResponseException
  • ShippoClient\Http\Response\Exception\ClientErrorException
  • ShippoClient\Http\Response\Exception\ServerErrorException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace ShippoClient\Http\Request;
 4: 
 5: use Guzzle\Http\Message\Response;
 6: use Guzzle\Plugin\Mock\MockPlugin;
 7: use ShippoClient\Http\Request;
 8: 
 9: class MockCollection
10: {
11:     /**
12:      * @var static|null
13:      */
14:     private static $instance = null;
15: 
16:     private static $container = [];
17: 
18:     private function __construct()
19:     {
20:     }
21: 
22:     public static function getInstance()
23:     {
24:         if (self::$instance !== null) {
25:             return self::$instance;
26:         }
27:         self::$instance = new self();
28: 
29:         return self::$instance;
30:     }
31: 
32:     public function has($endPoint)
33:     {
34:         return array_key_exists($endPoint, self::$container);
35:     }
36: 
37:     /**
38:      * @param string $endPoint
39:      * @return MockPlugin
40:      */
41:     public function getMockResponse($endPoint)
42:     {
43:         $response = new Response(self::$container[$endPoint]['statusCode']);
44:         $response->setBody(json_encode(self::$container[$endPoint]['response']));
45:         $mock = new MockPlugin();
46:         $mock->addResponse($response);
47: 
48:         return $mock;
49:     }
50: 
51:     public function add($path, $statusCode, $response)
52:     {
53:         self::$container[$path] = [
54:             'statusCode' => $statusCode,
55:             'response'   => $response,
56:         ];
57: 
58:         return $this;
59:     }
60: 
61:     public function clear()
62:     {
63:         self::$container = [];
64:     }
65: }
66: 
API documentation generated by ApiGen