GenericResource.php in Auth0 Single Sign On 8.2
File
vendor/auth0/auth0-php/src/API/Management/GenericResource.php
View source
<?php
namespace Auth0\SDK\API\Management;
use Auth0\SDK\API\Helpers\ApiClient;
use Auth0\SDK\Exception\EmptyOrInvalidParameterException;
use Auth0\SDK\Exception\InvalidPermissionsArrayException;
class GenericResource {
protected $apiClient;
public function __construct(ApiClient $apiClient) {
$this->apiClient = $apiClient;
}
public function getApiClient() {
return $this->apiClient;
}
protected function normalizePagination(array $params, $page = null, $per_page = null) {
$pagination = [
'page' => isset($params['page']) ? $params['page'] : $page,
'per_page' => isset($params['per_page']) ? $params['per_page'] : $per_page,
];
$pagination = array_filter($pagination);
$pagination = array_map(function ($val) {
return abs(intval($val));
}, $pagination);
return array_merge($params, $pagination);
}
protected function normalizeIncludeTotals(array $params, $include_totals = null) {
if (!isset($params['include_totals'])) {
$params['include_totals'] = $include_totals;
}
$params['include_totals'] = filter_var($params['include_totals'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
return $params;
}
protected function checkInvalidPermissions(array $permissions) {
if (empty($permissions)) {
throw new InvalidPermissionsArrayException();
}
foreach ($permissions as $permission) {
if (empty($permission['permission_name'])) {
throw new InvalidPermissionsArrayException();
}
if (empty($permission['resource_server_identifier'])) {
throw new InvalidPermissionsArrayException();
}
}
}
protected function checkEmptyOrInvalidString($var, $var_name) {
if (!is_string($var) || empty($var)) {
throw new EmptyOrInvalidParameterException($var_name);
}
}
}
Classes
Name |
Description |
GenericResource |
Class GenericResource.
Extended by Management API endpoints classes. |