| 1 | <?php |
||
| 3 | class CreateUser extends AbstractRequest { |
||
|
|
|||
| 4 | /** |
||
| 5 | * @var Location |
||
| 6 | */ |
||
| 7 | private $location; |
||
| 8 | private $deviceUid; |
||
| 9 | /** |
||
| 10 | * @return Location |
||
| 11 | */ |
||
| 12 | private function getLocation() |
||
| 16 | /** |
||
| 17 | * @param Location $location |
||
| 18 | */ |
||
| 19 | public function setLocation(Location $location) |
||
| 35 | |||
| 36 | private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
||
| 37 | { |
||
| 38 | $str = ''; |
||
| 39 | $max = mb_strlen($keyspace, '8bit') - 1; |
||
| 40 | for ($i = 0; $i < $length; ++$i) { |
||
| 41 | $str .= $keyspace[rand(0, $max)]; |
||
| 42 | } |
||
| 43 | return $str; |
||
| 44 | } |
||
| 45 | public function getApiEndPoint() |
||
| 46 | { |
||
| 47 | return '/v2/users'; |
||
| 48 | } |
||
| 49 | public function getPayload() |
||
| 50 | { |
||
| 51 | if(!isset($this->deviceUid)) |
||
| 52 | { |
||
| 53 | $this->setDeviceUid($this->generateDeviceUid()); |
||
| 54 | } |
||
| 55 | |||
| 56 | return array( |
||
| 57 | "location" => $this->getLocation()->toArray(), |
||
| 58 | "client_id" => self::CLIENTID, |
||
| 59 | "device_uid" => $this->getDeviceUid(), |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | public function getMethod() |
||
| 66 | } |
||
| 67 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.