/** * It creates a new user given entity and returns * result. * @param User $userEntity * @return array */ public function create(User $userEntity) { $payload = json_encode($this->getUserInformation($userEntity)); $requestManager = new RequestManager($this->getResource(), $payload, 'POST', $this->getHeader()); $requestManager->send(); if ($requestManager->getStatusCode() == 200 || $requestManager->getStatusCode() == 201) { $licenseManager = new LicenseManager($this->keys); $licenseManager->addLicense($userEntity->getAssignedLicenses(), $userEntity->getUserPrincipalName()); } return json_decode($requestManager->getHttpResponse(), true); }