1 | <?php |
||
10 | final class InventoryClient |
||
11 | { |
||
12 | const BASE_URL = 'https://inventory.izettle.com/organizations/%s'; |
||
13 | |||
14 | const GET_HISTORY = self::BASE_URL . '/history/locations/%s'; |
||
15 | |||
16 | const GET_PRODUCT_INVENTORY = self::BASE_URL . '/inventory/locations/%s/products/%s'; |
||
17 | const GET_LOCATION_INVENTORY = self::BASE_URL . '/inventory/locations/%s'; |
||
18 | const POST_INVENTORY = self::BASE_URL . '/inventory'; |
||
19 | const POST_INVENTORY_BULK = self::BASE_URL . '/inventory/bulk'; |
||
20 | const PUT_INVENTORY = self::BASE_URL . '/inventory'; |
||
21 | const DELETE_PRODUCT_INVENTORY = self::BASE_URL . '/inventory/products/%s'; |
||
22 | |||
23 | const GET_LOCATIONS = self::BASE_URL . '/locations'; |
||
24 | const PUT_LOCATIONS = self::BASE_URL . '/locations/%s'; |
||
25 | |||
26 | const GET_SETTINGS = self::BASE_URL . '/settings'; |
||
27 | const POST_SETTINGS = self::BASE_URL . '/settings'; |
||
28 | const PUT_SETTINGS = self::BASE_URL . '/settings'; |
||
29 | |||
30 | private $client; |
||
31 | private $organizationUuid; |
||
32 | |||
33 | public function __construct(IzettleClientInterface $client, ?UuidInterface $organizationUuid = null) |
||
38 | |||
39 | public function getLocations() |
||
46 | |||
47 | public function getLocation(UuidInterface $locationUuid) |
||
54 | |||
55 | public function getProduct(UuidInterface $locationUuid, UuidInterface $productUuid) |
||
62 | |||
63 | public function getHistory(UuidInterface $locationUuid) |
||
70 | |||
71 | public function getSettings() |
||
78 | } |
||
79 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: