decode() public static method

Decodes a JSON string.
public static decode ( $json, $options ) : mixed
return mixed
示例#1
0
 /**
  * @secured
  * @param $usersID
  */
 public function handleDelete($usersID)
 {
     if (is_string($usersID)) {
         try {
             $usersID = (array) Json::decode($usersID);
             $usersID = array_values($usersID);
         } catch (JsonException $e) {
             $this['notification']->addError($e->getMessage());
             if ($this->isAjax()) {
                 $this['notification']->redrawControl('error');
             }
         }
     }
     $result = $this->userRepository->deactivate($usersID);
     if ($result === TRUE) {
         $this['notification']->addSuccess("Úspěšně deaktivováno...");
     } else {
         if (strpos("Integrity constraint violation", $result) != -1) {
             $this['notification']->addError("Uživatele se nepovedlo deaktivovat.");
         } else {
             $this['notification']->addError($result);
         }
     }
     if ($this->isAjax()) {
         $this['notification']->redrawControl('error');
         $this['notification']->redrawControl('success');
         $this['grid']->redrawControl();
     }
 }
示例#2
0
 /**
  * @return string
  */
 public function getPanel()
 {
     if (!$this->queries) {
         return NULL;
     }
     ob_start();
     $esc = callback('Nette\\Templating\\Helpers::escapeHtml');
     $click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = FALSE, $d = 4) {
         return \Tracy\Dumper::toHtml($o, array('collapse' => $c, 'depth' => $d));
     } : callback('\\Tracy\\Helpers::clickableDump');
     $totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
     $extractData = function ($object) {
         if ($object instanceof Elastica\Request) {
             $data = $object->getData();
         } elseif ($object instanceof Elastica\Response) {
             $data = $object->getData();
         } else {
             return array();
         }
         try {
             return !is_array($data) ? Json::decode($data, Json::FORCE_ARRAY) : $data;
         } catch (Nette\Utils\JsonException $e) {
             try {
                 return array_map(function ($row) {
                     return Json::decode($row, Json::FORCE_ARRAY);
                 }, explode("\n", trim($data)));
             } catch (Nette\Utils\JsonException $e) {
                 return $data;
             }
         }
     };
     $processedQueries = array();
     $allQueries = $this->queries;
     foreach ($allQueries as $authority => $requests) {
         /** @var Elastica\Request[] $item */
         foreach ($requests as $i => $item) {
             $processedQueries[$authority][$i] = $item;
             if (isset($item[3])) {
                 continue;
                 // exception, do not re-execute
             }
             if (stripos($item[0]->getPath(), '_search') === FALSE || $item[0]->getMethod() !== 'GET') {
                 continue;
                 // explain only search queries
             }
             if (!is_array($data = $extractData($item[0]))) {
                 continue;
             }
             try {
                 $response = $this->client->request($item[0]->getPath(), $item[0]->getMethod(), $item[0]->getData(), array('explain' => 1) + $item[0]->getQuery());
                 // replace the search response with the explained response
                 $processedQueries[$authority][$i][1] = $response;
             } catch (\Exception $e) {
                 // ignore
             }
         }
     }
     require __DIR__ . '/panel.phtml';
     return ob_get_clean();
 }
 /**
  * Funkce pro naparsování odpovědi získané od scoreru
  * @param array|string $scorerResponseData
  */
 private function parseResultResponse($scorerResponseData)
 {
     if (is_string($scorerResponseData)) {
         $scorerResponseData = Json::decode($scorerResponseData);
     }
     #region score and rule
     if (!empty($scorerResponseData['score'])) {
         foreach ($scorerResponseData['score'] as $i => $rowResult) {
             if ($rowResult == null) {
                 $this->classificationResults[] = null;
                 $this->rules[] = null;
                 continue;
             }
             if ($this->classificationAttribute == "") {
                 foreach ($rowResult as $key => $value) {
                     $this->classificationAttribute = $key;
                     break;
                 }
             }
             $this->classificationResults[] = @$rowResult[$this->classificationAttribute];
             if (!empty($scorerResponseData['rule'][$i]) && !empty($scorerResponseData['rule'][$i]['id'])) {
                 $this->rules[] = $scorerResponseData['rule'][$i]['id'];
             } else {
                 $this->rules[] = null;
             }
         }
     }
     #endregion score and rule
     #region confusionMatrix
     $this->confusionMatrix = new ScoringConfusionMatrix($scorerResponseData['confusionMatrix']['labels'], $scorerResponseData['confusionMatrix']['matrix']);
     #endregion confusionMatrix
 }
示例#4
0
 protected function process()
 {
     $v = $this->getValues();
     /** @var Rme\Subject $subject */
     $subject = $this->presenter->subject;
     $subject->title = $v->title;
     $subject->description = $v->description;
     /** @var self|EditorSelector[] $this */
     if ($this['editors']->isEditable()) {
         $subject->editors = $v->editors;
     }
     $schemas = Json::decode($v['positions']);
     foreach ($subject->schemas as $schema) {
         $schema->position = NULL;
         $schema->subject = NULL;
     }
     $position = 0;
     foreach ($schemas as $schemaId) {
         /** @var Rme\Schema $schema */
         $schema = $this->orm->schemas->getById($schemaId);
         $schema->position = $position;
         $schema->subject = $subject;
         $position++;
     }
     $this->orm->flush();
     $this->presenter->flashSuccess('editor.edited.schema');
     $this->presenter->purgeCacheTag('header');
     $this->presenter->redirect('this');
 }
示例#5
0
 /**
  * @param Request $request
  * @return Notification
  */
 public static function createFromRequest(Request $request)
 {
     $notification = new Notification();
     $parsed = Json::decode($request->getRawBody());
     $notification->setLive($parsed->live === 'true');
     $items = array();
     foreach ($parsed->notificationItems as $rawItem) {
         $item = new NotificationRequestItem($notification);
         $item->setAdditionalData(self::getNotificationRequestItemValue($rawItem, 'additionalData'));
         $item->setAmountValue(self::getNotificationRequestItemValue($rawItem, 'amount.value'));
         $item->setAmountCurrency(self::getNotificationRequestItemValue($rawItem, 'amount.currency'));
         $item->setPspReference(self::getNotificationRequestItemValue($rawItem, 'pspReference'));
         $item->setEventCode(self::getNotificationRequestItemValue($rawItem, 'eventCode'));
         $date = new DateTime(self::getNotificationRequestItemValue($rawItem, 'eventDate'));
         $item->setEventDate($date);
         $item->setMerchantAccountCode(self::getNotificationRequestItemValue($rawItem, 'merchantAccountCode'));
         $item->setOperations(self::getNotificationRequestItemValue($rawItem, 'operations'));
         $item->setMerchantReference(self::getNotificationRequestItemValue($rawItem, 'merchantReference'));
         $item->setOriginalReference(self::getNotificationRequestItemValue($rawItem, 'originalReference'));
         $item->setPaymentMethod(self::getNotificationRequestItemValue($rawItem, 'paymentMethod'));
         $item->setReason(self::getNotificationRequestItemValue($rawItem, 'reason'));
         $item->setSuccess(self::getNotificationRequestItemValue($rawItem, 'success') === 'true');
         $items[] = $item;
     }
     $notification->setNotificationItems($items);
     return $notification;
 }
示例#6
0
 /**
  * Parses a signed_request and validates the signature.
  *
  * @param string $signedRequest A signed token
  * @param string $appSecret
  *
  * @return array The payload inside it or null if the sig is wrong
  */
 public static function decode($signedRequest, $appSecret)
 {
     if (!$signedRequest || strpos($signedRequest, '.') === false) {
         Debugger::log('Signed request is invalid! ' . json_encode($signedRequest), 'facebook');
         return NULL;
     }
     list($encoded_sig, $payload) = explode('.', $signedRequest, 2);
     // decode the data
     $sig = Helpers::base64UrlDecode($encoded_sig);
     $data = Json::decode(Helpers::base64UrlDecode($payload), Json::FORCE_ARRAY);
     if (!isset($data['algorithm']) || strtoupper($data['algorithm']) !== Configuration::SIGNED_REQUEST_ALGORITHM) {
         Debugger::log("Unknown algorithm '{$data['algorithm']}', expected " . Configuration::SIGNED_REQUEST_ALGORITHM, 'facebook');
         return NULL;
     }
     // check sig
     $expected_sig = hash_hmac('sha256', $payload, $appSecret, $raw = TRUE);
     if (strlen($expected_sig) !== strlen($sig)) {
         Debugger::log('Bad Signed JSON signature! Expected ' . Dumper::toText($expected_sig) . ', but given ' . Dumper::toText($sig), 'facebook');
         return NULL;
     }
     $result = 0;
     for ($i = 0; $i < strlen($expected_sig); $i++) {
         $result |= ord($expected_sig[$i]) ^ ord($sig[$i]);
     }
     if ($result !== 0) {
         Debugger::log('Bad Signed JSON signature! Expected ' . Dumper::toText($expected_sig) . ', but given ' . Dumper::toText($sig), 'facebook');
         return NULL;
     }
     return $data;
 }
 /**
  * funkce obstaravajici prihlaseni uzivatele
  */
 private function login()
 {
     $this->database = $this->context->getService("database.default.context");
     $data = Nette\Utils\Json::decode($this->request->getParameters()["data"]);
     $authenticator = new LoginAuthenticator($this->database);
     $user = $this->getUser();
     $user->setAuthenticator($authenticator);
     try {
         $user->login($data->username, $data->password);
     } catch (Nette\Security\AuthenticationException $e) {
         $error["err"] = true;
         $error["message"] = $e->getMessage();
         return $error;
     }
     $userIdent = (array) $user->getIdentity()->getData();
     $tokenId = base64_encode(mcrypt_create_iv(32));
     $issuedAt = time();
     $notBefore = $issuedAt;
     $expire = $notBefore + 60 * 60;
     $serverName = "lolnotepad";
     $token = ['iat' => $issuedAt, 'jti' => $tokenId, 'iss' => $serverName, 'nbf' => $notBefore, 'exp' => $expire, 'data' => $userIdent];
     $key = base64_decode(KEY);
     $jwt = JWT::encode($token, $key, 'HS256');
     return $jwt;
 }
示例#8
0
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $output->writeln('Extracting files');
     $outputFolder = $input->getOption('o');
     if ($outputFolder === NULL) {
         $outputFolder = $this->outputFolder;
     }
     $files = $input->getOption('f');
     if ($files === NULL) {
         $files = $this->extractDirs;
     }
     if (!isset($files)) {
         $output->writeln('No input files given.');
         exit;
     }
     $remote = $input->getOption('r');
     if ($remote === NULL) {
         $remote = $this->remote;
     } else {
         $remote = (bool) $remote;
     }
     $extractor = new NetteExtractor();
     $extractor->setupForms()->setupDataGrid();
     $data = $extractor->scan($files);
     $builder = new TemplateBuilder();
     if ($remote === TRUE) {
         $templateData = $builder->formatTemplateData($data);
         $response = \Nette\Utils\Json::decode($this->uploader->upload($templateData));
         $output->writeln(sprintf('<info>Extracted %d tokens. Uploaded to remote server. Response: %s</info>', count($data), $response->message));
     } else {
         $outputFile = $outputFolder . '/template.neont';
         $builder->buildTemplate($outputFile, $data);
         $output->writeln(sprintf('<info>Extracted %d tokens. Output saved in: %s.</info>', count($data), $outputFile));
     }
 }
 public function authenticate(array $credentials)
 {
     $mcrypt = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
     $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($mcrypt), MCRYPT_DEV_RANDOM);
     mcrypt_generic_init($mcrypt, $this->cryptPassword, $iv);
     $url = $this->getUrl($credentials[self::USERNAME], $credentials[self::PASSWORD], $mcrypt, $iv);
     try {
         $res = $this->httpClient->get($url)->send();
     } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) {
         if ($e->getResponse()->getStatusCode() === 403) {
             throw new \Nette\Security\AuthenticationException("User '{$credentials[self::USERNAME]}' not found.", self::INVALID_CREDENTIAL);
         } elseif ($e->getResponse()->getStatusCode() === 404) {
             throw new \Nette\Security\AuthenticationException("Invalid password.", self::IDENTITY_NOT_FOUND);
         } else {
             throw $e;
         }
     }
     $responseBody = trim(mdecrypt_generic($mcrypt, $res->getBody(TRUE)));
     $apiData = Json::decode($responseBody);
     $user = $this->db->table('users')->where('id = ?', $apiData->id)->fetch();
     $registered = new \DateTimeImmutable($apiData->registered->date, new \DateTimeZone($apiData->registered->timezone));
     $userData = array('username' => $credentials[self::USERNAME], 'password' => $this->calculateAddonsPortalPasswordHash($credentials[self::PASSWORD]), 'email' => $apiData->email, 'realname' => $apiData->realname, 'url' => $apiData->url, 'signature' => $apiData->signature, 'language' => $apiData->language, 'num_posts' => $apiData->num_posts, 'apiToken' => $apiData->apiToken, 'registered' => $registered->getTimestamp());
     if (!$user) {
         $userData['id'] = $apiData->id;
         $userData['group_id'] = 4;
         $this->db->table('users')->insert($userData);
         $user = $this->db->table('users')->where('username = ?', $credentials[self::USERNAME])->fetch();
     } else {
         $user->update($userData);
     }
     return $this->createIdentity($user);
 }
示例#10
0
 /**
  * @param string $method "/tag"
  * @param array $args [data => string]
  * @return mixed
  * @throws \Nette\Utils\JsonException
  */
 protected function request($method, $args)
 {
     $args = $args + ['output' => 'json'];
     $url = self::ENDPOINT . "{$method}?" . http_build_query($args);
     $raw = file_get_contents($url);
     return Json::decode($raw, Json::FORCE_ARRAY)['result'];
 }
 public static function fromActiveRow(ActiveRow $row)
 {
     $version = new static();
     $version->id = $row->id;
     $version->version = $row->version;
     $version->license = $row->license;
     $version->distType = $row->distType;
     $version->distUrl = $row->distUrl;
     $version->sourceType = $row->sourceType;
     $version->sourceUrl = $row->sourceUrl;
     $version->sourceReference = $row->sourceReference;
     $version->composerJson = Json::decode($row->composerJson);
     // this may fail
     $version->updatedAt = $row->updatedAt;
     $linkTypes = self::getLinkTypes();
     $linkTypes = array_flip($linkTypes);
     foreach ($row->related('dependencies') as $dependencyRow) {
         $type = $dependencyRow->type;
         $type = $linkTypes[$type];
         $version->{$type}[$dependencyRow->packageName] = $dependencyRow->version;
         if ($dependencyRow->dependencyId) {
             $version->relatedAddons[$dependencyRow->packageName] = $dependencyRow->dependencyId;
         }
     }
     return $version;
 }
 private function updateAddon(ActiveRow $addon)
 {
     $this->writeln('Updating: ' . $addon->name);
     $github = $this->normalizeGithubUrl($addon->repository);
     if ($github) {
         $guzzle = new \Guzzle\Http\Client();
         try {
             $guzzle->get($github)->send();
             $this->db->table('addons_resources')->insert(array('addonId' => $addon->id, 'type' => 'github', 'resource' => $github));
         } catch (\Guzzle\Http\Exception\RequestException $e) {
             $this->writeln((string) $e);
         }
     }
     if ($addon->type === 'composer') {
         $version = $addon->related('versions')->order('id', 'DESC')->fetch();
         $composerData = Json::decode($version->composerJson);
         $packagist = $this->generatePackagistUrl($composerData->name);
         $guzzle = new \Guzzle\Http\Client();
         try {
             $guzzle->get($packagist . '.json')->send();
             $this->db->table('addons_resources')->insert(array('addonId' => $addon->id, 'type' => 'packagist', 'resource' => $packagist));
         } catch (\Guzzle\Http\Exception\RequestException $e) {
             $this->writeln((string) $e);
         }
     }
     if ($addon->demo) {
         $guzzle = new \Guzzle\Http\Client();
         try {
             $guzzle->get($addon->demo)->send();
             $this->db->table('addons_resources')->insert(array('addonId' => $addon->id, 'type' => 'demo', 'resource' => $addon->demo));
         } catch (\Guzzle\Http\Exception\RequestException $e) {
             $this->writeln((string) $e);
         }
     }
 }
 /**
  * @param string|object $json
  * @param int $forcedDepth
  * @return \SimpleXMLElement
  */
 public function settingsFromJson($json, $forcedDepth = 3)
 {
     if (is_string($json)) {
         $json = Json::decode($json);
     }
     $strict = $json->strict;
     $rule = $json->rule0;
     // Create basic structure of Document.
     //TODO taskId
     $this->init(!empty($json->taskId) ? $json->taskId : '', $json->limitHits);
     // Create antecedent
     if (!empty($rule->antecedent->children)) {
         $antecedentId = $this->parseCedent($rule->antecedent, 1, $forcedDepth, $strict);
         $this->antecedentSetting[0] = (string) $antecedentId;
     }
     // IMs
     foreach ($rule->IMs as $IM) {
         $this->createInterestMeasureThreshold($IM);
     }
     if (!empty($rule->specialIMs)) {
         foreach ($rule->specialIMs as $IM) {
             $this->createInterestMeasureThreshold($IM);
         }
     }
     // Create consequent
     $consequentId = $this->parseCedent($rule->succedent, 1, $forcedDepth, $strict);
     $this->consequentSetting[0] = (string) $consequentId;
     return $this->pmml;
 }
示例#14
0
 private function request($req, $args = [])
 {
     $args = $args + ['api_key' => $this->apiKey, 'api_username' => $this->apiUsername];
     $url = self::DOMAIN . "{$req}?" . http_build_query($args);
     $raw = file_get_contents($url);
     return Json::decode($raw, Json::FORCE_ARRAY);
 }
示例#15
0
 public function send(RequestInterface $request)
 {
     try {
         return parent::send($request);
     } catch (\GuzzleHttp\Exception\ServerException $e) {
         $response = $e->getResponse();
         $body = $response->getBody()->getContents();
         $message = $e->getMessage();
         try {
             $data = Json::decode($body);
             $message = implode(', ', $data->errors);
         } catch (JsonException $e) {
             //ignore
         }
         $ex = new ServerException($message, $e->getCode(), $e);
         $ex->setBody($body);
         throw $ex;
     } catch (\GuzzleHttp\Exception\ClientException $e) {
         $response = $e->getResponse();
         $body = $response->getBody()->getContents();
         $message = $e->getMessage();
         try {
             $data = Json::decode($body);
             $message = implode(', ', $data->errors);
         } catch (JsonException $e) {
             //ignore
         }
         $ex = new ClientException($message, $e->getCode(), $e);
         $ex->setBody($body);
         throw $ex;
     }
 }
 public function onUpload(Form $form)
 {
     /** @var UploadControl[] $form */
     /** @var FileUpload $json */
     /** @var FileUpload $audio */
     $json = $form['json']->getValue();
     $audio = $form['audio']->getValue();
     $data = Json::decode($json->getContents(), Json::FORCE_ARRAY);
     $blackboard = new Rme\Blackboard();
     $this->orm->contents->attach($blackboard);
     $blackboard->title = 'Nová nahrávka';
     $blackboard->description = ' ';
     $blackboard->hidden = TRUE;
     $blackboard->duration = $data['duration'];
     $blackboard->preview = 'https://placehold.it/480x320&text=...';
     $blackboard->author = $this->userEntity;
     $this->orm->flush();
     $base = $this->paths->getBlackboards() . "/{$blackboard->id}";
     $json->move("{$base}.json");
     $audio->move("{$base}.wav");
     $producer = $this->queue->getProducer('blackboardPreview');
     $producer->publish(serialize(['blackboard' => new EntityPointer($blackboard)]));
     $link = $this->link('BlackboardEditor:default', ['blackboardId' => $blackboard->id]);
     $this->sendJson(['redirect' => $link]);
 }
示例#17
0
 public function actionCreateOrder()
 {
     $post = $this->getHttpRequest()->getPost();
     $data = Json::decode($post['data'], 1);
     $this->orderManager->createOrder($data['language'], $data['products'], $data['customer']);
     $this->terminate();
 }
示例#18
0
 /**
  * Get plugins
  *
  * @param array $pluginsDirs Plugins directories
  *
  * @return array
  */
 private function getPlugins(array $pluginsDirs)
 {
     $plugins = array();
     foreach (Finder::findFiles("plugin.json")->from($pluginsDirs) as $plugin) {
         $config = Json::decode(file_get_contents($plugin->getRealPath()), 1);
         if (!isset($config["class"]) || !class_exists($config["class"])) {
             continue;
         }
         // Get types
         foreach (class_implements($config["class"]) as $interface) {
             if (isset($this->pluginTypes[$interface])) {
                 $config["types"][$this->pluginTypes[$interface]] = true;
             }
         }
         // Skip if unknown plugin type
         if (empty($config["types"])) {
             continue;
         }
         // Get plugin dir path
         $config["path"] = dirname($plugin->getPathName());
         // Get unique plugin name from class
         $config["name"] = strtolower(stripslashes($config["class"]));
         $plugins[$config["name"]] = $config;
     }
     return $plugins;
 }
示例#19
0
 /**
  * @param string $body
  * @return array|false
  */
 public function parse($body)
 {
     try {
         return Json::decode($body, Json::FORCE_ARRAY);
     } catch (\Exception $e) {
     }
     return false;
 }
示例#20
0
 /**
  * Convert client request data to array or traversable
  * @param string $data
  * @return array 
  *
  * @throws MappingException
  */
 public function parse($data)
 {
     try {
         return Json::decode($data, Json::FORCE_ARRAY);
     } catch (JsonException $e) {
         throw new MappingException('Error in parsing request: ' . $e->getMessage());
     }
 }
示例#21
0
文件: Json.php 项目: appcia/utils
 /**
  * {@inheritdoc}
  */
 public static function decode($json)
 {
     if (!is_string($json)) {
         throw new \InvalidArgumentException(sprintf("Value type '%s' is not a JSON string so it cannot be decoded.", gettype($json)));
     }
     $data = parent::decode($json);
     return $data;
 }
 /**
  * @param string $url
  * @param ResponseInterface $response
  * @return array|stdClass
  *
  * @throws ApiErrorException
  */
 public static function processResult(string $url, ResponseInterface $response)
 {
     $body = $response->getBody()->getContents();
     $body = Tools::jsonNumbersToString($body);
     $result = Json::decode($body);
     self::checkErrors($result, $url);
     return $result;
 }
 /**
  * @param string $body
  * @return string
  */
 public function format($body)
 {
     try {
         return Json::encode(Json::decode($body), Json::PRETTY);
     } catch (JsonException $e) {
         return $body;
     }
 }
示例#24
0
 /**
  * Toggle how much found updates are shown.
  */
 public function actionShowSettings()
 {
     $this->checkIsAjax();
     $showAll = \Nette\Utils\Json::decode($this->getParameter("showAll"));
     $this->payload->table = $this->updatorRender->renderTable($showAll);
     $this->payload->updatesCount = $this->updatorRender->renderUpdatesCount($showAll);
     $this->sendPayload();
 }
示例#25
0
 private function parse($input)
 {
     try {
         return Json::decode($input);
     } catch (JsonException $exception) {
         throw new TransitException('Input is not valid transit.');
     }
 }
示例#26
0
 /**
  * Decodes a JSON string.
  * @param string $json JSON string or filename
  * @param int
  * @return mixed
  */
 public static function decode($json, $options = 0)
 {
     $symbol = substr(trim($json), 0, 1);
     if ($symbol !== '[' && $symbol !== '{' && is_file($json)) {
         $json = file_get_contents($json);
     }
     return Nette\Utils\Json::decode($json, $options);
 }
示例#27
0
 /**
  * @param string $email
  * @param string $listId
  *
  * @return string|FALSE
  */
 private function getStatus($email, $listId)
 {
     $response = $this->call(Request::GET, "/lists/{$listId}/members/" . md5($email));
     if (!$response || $response->getCode() === 404) {
         return FALSE;
     }
     return Json::decode($response->getResponse())->status;
 }
 /**
  * @param null|string $configJson
  * @throws \Nette\Utils\JsonException
  */
 public function __construct($configJson = null)
 {
     if (is_string($configJson)) {
         $this->data = Json::decode($configJson, Json::FORCE_ARRAY);
     } else {
         $this->data = ['rule0' => []];
     }
 }
示例#29
0
 /**
  * @return UsersEntity
  */
 public function getUsers()
 {
     $request = Request::get("{$this->getCompanyId()}/users");
     $response = $this->getConnector()->sendRequest($request);
     $data = Json::decode($response->getContent());
     $json = new stdClass();
     $json->users = $data;
     return new UsersEntity($json);
 }
 /**
  * @return SenderEmailsEntity
  */
 public function getSenderEmails()
 {
     $request = Request::get("{$this->getCompanyId()}/sender-emails");
     $response = $this->getConnector()->sendRequest($request);
     $data = Json::decode($response->getContent());
     $json = new stdClass();
     $json->emails = $data;
     return new SenderEmailsEntity($json);
 }