code
stringlengths 52
7.75k
| docs
stringlengths 1
5.85k
|
---|---|
public function getSchoolAdmins($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSchoolAdminsWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSchoolAdmins
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SchoolAdminsResponse
|
public function getSchoolAdminsAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSchoolAdminsAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSchoolAdminsAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSchools($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSchoolsWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSchools
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SchoolsResponse
|
public function getSchoolsAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSchoolsAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSchoolsAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSchoolsForSchoolAdmin($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSchoolsForSchoolAdminWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSchoolsForSchoolAdmin
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SchoolsResponse
|
public function getSchoolsForSchoolAdminAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSchoolsForSchoolAdminAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSchoolsForSchoolAdminAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSchoolsForStudent($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSchoolsForStudentWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSchoolsForStudent
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SchoolsResponse
|
public function getSchoolsForStudentAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSchoolsForStudentAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSchoolsForStudentAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSchoolsForTeacher($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSchoolsForTeacherWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSchoolsForTeacher
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SchoolsResponse
|
public function getSchoolsForTeacherAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSchoolsForTeacherAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSchoolsForTeacherAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSections($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSections
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSectionsForCourse($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsForCourseWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSectionsForCourse
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsForCourseAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsForCourseAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsForCourseAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSectionsForSchool($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsForSchoolWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSectionsForSchool
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsForSchoolAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsForSchoolAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsForSchoolAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSectionsForStudent($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsForStudentWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSectionsForStudent
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsForStudentAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsForStudentAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsForStudentAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSectionsForTeacher($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsForTeacherWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSectionsForTeacher
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsForTeacherAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsForTeacherAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsForTeacherAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getSectionsForTerm($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getSectionsForTermWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getSectionsForTerm
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\SectionsResponse
|
public function getSectionsForTermAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getSectionsForTermAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getSectionsForTermAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getStudents($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getStudentsWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getStudents
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\StudentsResponse
|
public function getStudentsAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getStudentsAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getStudentsAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getStudentsForContact($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getStudentsForContactWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getStudentsForContact
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\StudentsResponse
|
public function getStudentsForContactAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getStudentsForContactAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getStudentsForContactAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getStudentsForSchool($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getStudentsForSchoolWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getStudentsForSchool
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\StudentsResponse
|
public function getStudentsForSchoolAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getStudentsForSchoolAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getStudentsForSchoolAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getStudentsForSection($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getStudentsForSectionWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getStudentsForSection
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\StudentsResponse
|
public function getStudentsForSectionAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getStudentsForSectionAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getStudentsForSectionAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getStudentsForTeacher($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getStudentsForTeacherWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getStudentsForTeacher
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\StudentsResponse
|
public function getStudentsForTeacherAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getStudentsForTeacherAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getStudentsForTeacherAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getTeachers($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getTeachersWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getTeachers
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\TeachersResponse
|
public function getTeachersAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getTeachersAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getTeachersAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getTeachersForSchool($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getTeachersForSchoolWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getTeachersForSchool
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\TeachersResponse
|
public function getTeachersForSchoolAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getTeachersForSchoolAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getTeachersForSchoolAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getTeachersForSection($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getTeachersForSectionWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getTeachersForSection
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\TeachersResponse
|
public function getTeachersForSectionAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getTeachersForSectionAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getTeachersForSectionAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getTeachersForStudent($id, $limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getTeachersForStudentWithHttpInfo($id, $limit, $starting_after, $ending_before);
return $response;
}
|
Operation getTeachersForStudent
@param string $id id (required)
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\TeachersResponse
|
public function getTeachersForStudentAsync($id, $limit = null, $starting_after = null, $ending_before = null)
{
return $this->getTeachersForStudentAsyncWithHttpInfo($id, $limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getTeachersForStudentAsync
@param string $id (required)
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
public function getTerms($limit = null, $starting_after = null, $ending_before = null)
{
list($response) = $this->getTermsWithHttpInfo($limit, $starting_after, $ending_before);
return $response;
}
|
Operation getTerms
@param int $limit limit (optional)
@param string $starting_after starting_after (optional)
@param string $ending_before ending_before (optional)
@throws \Clever\ApiException on non-2xx response
@throws \InvalidArgumentException
@return \Clever\Model\TermsResponse
|
public function getTermsAsync($limit = null, $starting_after = null, $ending_before = null)
{
return $this->getTermsAsyncWithHttpInfo($limit, $starting_after, $ending_before)
->then(
function ($response) {
return $response[0];
}
);
}
|
Operation getTermsAsync
@param int $limit (optional)
@param string $starting_after (optional)
@param string $ending_before (optional)
@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
|
private function service($name)
{
if (!isset($this->registry[$name])) {
if (isset(self::$services[$name])) {
$this->registry[$name] = new self::$services[$name]($this);
} else {
throw new InvalidArgumentException(sprintf('Service %s does not implement', $name));
}
}
return $this->registry[$name];
}
|
@param string $name
@return Rest\Service
|
private function parseJsonResponseBody(Request $request, Response $response, $type)
{
// Find resource type (URL) in response location or request url
$location = $response->hasHeader('Location')
? $this->createUri($response->getHeaderLine('Location'))
: $request->getUri();
$uri = urldecode($location->getPath());
// Remove version from URI
$uri = preg_replace('#^/' . self::CURRENT_VERSION . '#', '', $uri);
// Unserialize response body
$content = json_decode((string) $response->getBody(), true) ?: [];
// Build expected resource
$resource = $this->factory->create($uri, []);
if ($resource instanceof Rest\Collection) {
$content = [
'data' => $content,
'_metadata' => [
'uri' => $uri,
'limit' => (int) $response->getHeaderLine('Pagination-Limit'),
'offset' => (int) $response->getHeaderLine('Pagination-Offset'),
'total' => (int) $response->getHeaderLine('Pagination-Total'),
],
];
} else {
$content['_metadata'] = [
'uri' => $uri,
];
}
$resource->populate($content);
return $resource;
}
|
@param Request $request
@param Response $response
@param string $type
@return mixed
|
private function parseBinaryResponseBody(Request $request, Response $response, $type)
{
$body = $response->getBody();
return new File($type, (string) $body, $body->getSize());
}
|
@param Request $request
@param Response $response
@param string $type
@return File
|
public function createRequest($method, $uri, $payload, array $headers = [])
{
return new GuzzleRequest($method, $uri, $headers, $payload);
}
|
Factory method to create a new Request object.
@param string $method
@param mixed $uri
@param mixed $payload
@param array $headers
@return Request
|
public function createUri($uri, array $params = [])
{
if ($uri instanceof GuzzleUri) {
if (!empty($params)) {
$uri = $uri->withQuery(http_build_query($params));
}
return $uri;
}
// If URL template given, prepare URI
if (preg_match_all('/{[\w]+}/i', $uri, $matches)) {
foreach (array_unique($matches[0]) as $match) {
$param = substr($match, 1, -1);
if (isset($params[$param])) {
$uri = str_replace($match, $params[$param], $uri);
unset($params[$param]);
}
}
}
if (!empty($params)) {
$uri .= '?' . http_build_query($params);
}
return new GuzzleUri($uri);
}
|
Factory method to create a new Uri object.
@param string $uri
@param array $params
@return GuzzleUri
|
public function createEmails(array $value): array
{
return array_map(function ($data) {
if ($data instanceof EmailNotification) {
return $data;
}
return new EmailNotification((array) $data);
}, $value);
}
|
@param EmailNotification[]|array $value
@return EmailNotification[]|array
|
public function create($data, $noteId = null)
{
if (isset($noteId)) {
return $this->client()->put($data, 'notes/{noteId}', ['noteId' => $noteId]);
}
return $this->client()->post($data, 'notes');
}
|
@param array|JsonSerializable|Note $data
@param string $noteId
@throws UnprocessableEntityException The input data does not valid
@return Note
|
public function createWeightedList($value): array
{
return array_map(function ($data) {
if ($data instanceof AcquirerWeight) {
return $data;
}
return AcquirerWeight::createFromData((array) $data);
}, $value);
}
|
@param array $value
@return array
|
public function create($data, $kycDocumentId = null)
{
if (isset($kycDocumentId)) {
return $this->client()->put($data, 'kyc-documents/{id}', ['id' => $kycDocumentId]);
}
return $this->client()->post($data, 'kyc-documents');
}
|
@param array|JsonSerializable|KycDocument $data
@param string $kycDocumentId
@throws UnprocessableEntityException The input data does not valid
@return KycDocument
|
public function setOrderType($value)
{
if (!in_array($value, self::orderTypes(), true)) {
throw new DomainException(sprintf(self::MSG_UNEXPECTED_TYPE, implode(', ', self::orderTypes())));
}
return $this->setAttribute('orderType', $value);
}
|
@param string $value
@throws DomainException
@return Subscription
|
public function verify($token)
{
try {
$this->client()->head('authentication-tokens/{token}', ['token' => $token]);
return true;
} catch (NotFoundException $e) {
return false;
}
}
|
@param string $token
@return bool
|
public static function generateSignature($apiUser, $apiKey)
{
$serverTimezone = date_default_timezone_get();
date_default_timezone_set('UTC');
$nonce = self::generateNonce(self::NONCE_LENGTH);
$time = time();
$signature = hash_hmac('sha1', $apiUser . $nonce . $time, $apiKey);
$data = [
'REB-APIUSER' => $apiUser,
'REB-NONCE' => $nonce,
'REB-TIMESTAMP' => $time,
'REB-SIGNATURE' => $signature,
];
date_default_timezone_set($serverTimezone);
return base64_encode(json_encode($data));
}
|
This method returns an array with the header name and header values for the nonce,
timestamp and signature.
@param string $apiUser
@param string $apiKey
@return string
|
public static function generateNonce($length, $strong = true)
{
$bytes = openssl_random_pseudo_bytes($length, $strong);
if ($bytes === false || !$strong) {
throw new RuntimeException('Failed to generate random string');
}
return substr(base64_encode($bytes), 0, $length);
}
|
Generate a random cryptographic base64 nonce (number used only once)
@param int $length
@param bool $strong
@throws RuntimeException
@return string A random string (base64 characters only)
|
public function create($data, $token = null)
{
if (isset($token)) {
return $this->client()->put($data, 'password-tokens/{token}', ['token' => $token]);
}
return $this->client()->post($data, 'password-tokens');
}
|
@param array|JsonSerializable|ResetPasswordToken $data
@param string $token
@throws UnprocessableEntityException The input data does not valid
@return ResetPasswordToken
|
public function setStatus($value)
{
if (!in_array($value, self::statuses(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_STATUS, implode(', ', self::statuses())));
}
return $this->setAttribute('status', $value);
}
|
@param string $value
@throws DomainException
@return SubscriptionCancellation
|
public function setReason($value)
{
if (!in_array($value, self::reasons(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_CATEGORY, implode(', ', self::reasons())));
}
return $this->setAttribute('reason', $value);
}
|
@param string $value
@throws DomainException
@return SubscriptionCancellation
|
public static function createFromData(array $data)
{
if (!isset($data['method'])) {
throw new DomainException(self::REQUIRED_METHOD);
}
if (!in_array($data['method'], self::$availableMethods, true)) {
throw new DomainException(
sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
);
}
return parent::createFromData($data);
}
|
@param array $data
@return ScheduleInstruction
|
public function setMethod($value): self
{
if (!in_array($value, self::methods(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_METHOD, implode(', ', self::methods())));
}
return $this->setAttribute('method', $value);
}
|
@param string $value
@return $this
|
public function create($data, $shippingZoneId = null)
{
if (isset($shippingZoneId)) {
return $this->client()->put($data, 'shipping-zones/{shippingZoneId}', ['shippingZoneId' => $shippingZoneId]);
}
return $this->client()->post($data, 'shipping-zones');
}
|
@param array|JsonSerializable|ShippingZone $data
@param null $shippingZoneId
@return ShippingZone
|
public function setRates($value)
{
if (!is_array($value)) {
throw new DomainException(self::MSG_RATES_WRONG);
}
return $this->setAttribute('rates', $value);
}
|
@param Rate[] $value
@return $this
|
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
{
foreach ($this->config('fields') as $key => $field) {
if (is_int($key) && isset($data[$field])) {
$data[$field] = $this->purifyHtml($data[$field], $this->config('purifierConfig'));
}
if (is_string($key) && is_string($field)) {
$data[$key] = $this->purifyHtml($data[$key], $this->config($field));
}
}
}
|
Before marshal callaback
@param \Cake\Event\Event $event The Model.beforeMarshal event.
@param \ArrayObject $data Data.
@param \ArrayObject $options Options.
@return void
|
public function main()
{
# The theme is activated.
# Location: Resources/Themes/Default/
Theme::active('Default');
# The current settings are being configured.
Masterpage::headPage('Sections/head')
->bodyPage('Sections/body')
->browserIcon(FILES_DIR . 'favicon.ico')
->backgroundImage(FILES_DIR . 'background.jpg');
}
|
The codes to run at startup.
It enters the circuit before all controllers.
You can change this setting in Config/Starting.php file.
|
public function create($data, $gatewayAccountId = null)
{
if (isset($gatewayAccountId)) {
return $this->client()->put($data, 'gateway-accounts/{gatewayAccountId}', ['gatewayAccountId' => $gatewayAccountId]);
}
return $this->client()->post($data, 'gateway-accounts');
}
|
@param array|JsonSerializable|GatewayAccount $data
@param string $gatewayAccountId
@throws UnprocessableEntityException The input data does not valid
@return GatewayAccount
|
public function create($data, $productId = null)
{
if (isset($productId)) {
return $this->client()->put($data, 'products/{productId}', ['productId' => $productId]);
}
return $this->client()->post($data, 'products');
}
|
@param array|JsonSerializable|Product $data
@param null $productId
@return Product
|
public function getEmail()
{
$primaryAddress = $this->getPrimaryAddress();
if ($primaryAddress === null) {
return null;
}
$emails = $primaryAddress->getEmails();
if (empty($emails)) {
return null;
}
foreach ($emails as $email) {
if (is_array($email) && $email['primary'] === true) {
return $email['value'];
}
return $email->getValue();
}
return $emails[0]->getValue();
}
|
@deprecated Use getPrimaryAddress()->getEmails() instead
@return string|null
|
public function setEmail($value)
{
$primaryAddress = $this->getPrimaryAddress();
$email = Email::createFromData([
'label' => 'main',
'value' => $value,
'primary' => true,
]);
if ($primaryAddress !== null) {
$primaryAddress->setEmails([$email]);
} else {
$primaryAddress = Address::createFromData(['emails' => [$email]]);
}
$this->setPrimaryAddress($primaryAddress);
$this->setAttribute('email', $value);
return $this;
}
|
@deprecated Use getPrimaryAddress()->setEmails() instead
@param string $value
@return $this
|
public function setLastName($value)
{
$primaryAddress = $this->getPrimaryAddress();
if ($primaryAddress !== null) {
$primaryAddress->setLastName($value);
} else {
$primaryAddress = Address::createFromData(['lastName' => $value]);
}
$this->setPrimaryAddress($primaryAddress);
$this->setAttribute('lastName', $value);
return $this;
}
|
@deprecated Use getPrimaryAddress()->setLastName() instead
@param string $value
@return $this
|
public function setPrimaryAddress($value)
{
// TODO: Remove after deprecated setEmail(), setFirstName(), setLastName() methods removed
if (is_array($value)) {
$value = Address::createFromData($value);
}
if (empty($value->getEmails()) && $this->getAttribute('email') !== null) {
$email = Email::createFromData([
'label' => 'main',
'value' => $this->getAttribute('email'),
'primary' => true,
]);
$value->setEmails([$email]);
}
if (empty($value->getFirstName()) && $this->getAttribute('firstName') !== null) {
$value->setFirstName($this->getAttribute('firstName'));
}
if (empty($value->getLastName()) && $this->getAttribute('lastName') !== null) {
$value->setLastName($this->getAttribute('lastName'));
}
return $this->setAttribute('primaryAddress', $value);
}
|
@param Address|array $value
@return $this
|
public function createWeightedList($value): array
{
return array_map(function ($data) {
if ($data instanceof AccountWeight) {
return $data;
}
return AccountWeight::createFromData((array) $data);
}, $value);
}
|
@param array $value
@return array
|
public function loadVersion($listId, $version, $params = [])
{
return $this->client()->get('lists/{listId}/{version}', ['listId' => $listId, 'version' => $version] + (array) $params);
}
|
@param string $listId
@param int $version
@param array|ArrayObject $params
@throws NotFoundException The resource data does not exist
@return ValuesList
|
public function create($data, $listId = null)
{
if (isset($listId)) {
return $this->client()->put($data, 'lists/{listId}', ['listId' => $listId]);
}
return $this->client()->post($data, 'lists');
}
|
@param array|JsonSerializable|ValuesList $data
@param string $listId
@throws UnprocessableEntityException The input data does not valid
@return ValuesList
|
public static function ini($profile = null, $filename = null)
{
$filename = $filename ?: (self::getHomeDir() . self::INI_DEFAULT_FILE);
$profile = $profile ?: self::INI_PROFILE;
return function () use ($profile, $filename) {
if (!is_readable($filename)) {
throw new RuntimeException("Cannot read credentials from $filename");
}
$data = @parse_ini_file($filename, true);
if ($data === false) {
throw new UnexpectedValueException("Invalid credentials file: $filename");
}
if (!isset($data[$profile])) {
throw new UnexpectedValueException("'$profile' not found in credentials file");
}
if (!isset($data[$profile][self::INI_APIKEY])) {
throw new UnexpectedValueException('No APIKEY present in INI profile ' . "'$profile' ($filename)");
}
return $data[$profile][self::INI_APIKEY];
};
}
|
APIKEY provider that read APIKEY in an ini file stored in the current user's home directory.
@param string|null $profile Profile to use. If not specified will use the "default" profile.
@param string|null $filename If provided, uses a custom filename rather than looking in the home directory.
@return callable
|
private static function getHomeDir()
{
// On Linux/Unix-like systems, use the HOME environment variable
if ($homeDir = getenv('HOME')) {
return $homeDir;
}
// Get the HOMEDRIVE and HOMEPATH values for Windows hosts
if (($homeDrive = getenv('HOMEDRIVE')) && ($homePath = getenv('HOMEPATH'))) {
return $homeDrive . $homePath;
}
throw new BadMethodCallException('Cannot establish the home directory');
}
|
Gets the environment's HOME directory if available.
@return null|string
|
public function create($resourceType, $name, $data)
{
return $this->client()->put($data, 'custom-fields/{resourceType}/{name}', [
'resourceType' => $resourceType,
'name' => $name,
]);
}
|
@param string $resourceType
@param string $name
@param array|JsonSerializable|CustomField $data
@throws UnprocessableEntityException The input data does not valid
@return CustomField
|
public function load($resourceType, $name, $params = [])
{
return $this->client()->get('custom-fields/{resourceType}/{name}', [
'resourceType' => $resourceType,
'name' => $name,
] + (array) $params);
}
|
@param string $resourceType
@param string $name
@param array|ArrayObject $params
@throws NotFoundException The custom field does not exist
@return CustomField
|
public function update($resourceType, $name, $data)
{
return $this->client()->put($data, 'custom-fields/{resourceType}/{name}', [
'resourceType' => $resourceType,
'name' => $name,
]);
}
|
@param string $resourceType
@param string $name
@param array|JsonSerializable|CustomField $data
@throws UnprocessableEntityException The input data does not valid
@return CustomField
|
public function create($data, $webhookId = null)
{
if (isset($webhookId)) {
return $this->client()->put($data, 'webhooks/{webhookId}', ['webhookId' => $webhookId]);
}
return $this->client()->post($data, 'webhooks');
}
|
@param array|JsonSerializable|Webhook $data
@param string|null $webhookId
@return Webhook
|
private function dumpHeaders(array $headers)
{
if ($this->hideAuth) {
$headers = self::$authHeaders + $headers;
}
array_walk(
$headers,
function (&$value, $name) {
if (is_array($value)) {
$value = implode('; ', $value);
}
$value = $name . ': ' . $value;
}
);
return implode(PHP_EOL, $headers ?: ['<none>']);
}
|
@param array $headers
@return array
|
private function dumpStream(Stream $body)
{
$body = $body->getSize() < $this->maxStreamSize
? trim($body->getContents())
: 'stream(size=' . $body->getSize() . ')';
return $body ?: '<empty>';
}
|
@param Stream $body
@return string
|
public function current()
{
if ($this->currentSegment === null) {
if (!$this->valid()) {
throw new OutOfBoundsException('Cannot load segment, invalid offset');
}
$this->load(['offset' => $this->offset] + $this->params);
}
return $this->currentSegment;
}
|
{@inheritdoc}
@return Rest\Collection
|
public static function createFromData(array $data)
{
if (!isset($data['name'])) {
throw new DomainException(self::MSG_REQUIRED_NAME);
}
if (!isset($data['price'])) {
throw new DomainException(self::MSG_REQUIRED_NAME);
}
if (!isset($data['currency'])) {
throw new DomainException(self::MSG_REQUIRED_CURRENCY);
}
$rate = new self($data);
return $rate;
}
|
@param array $data
@return Rate
|
public function setDocumentType($value)
{
$allowedTypes = self::allowedTypes();
if (!in_array($value, $allowedTypes, true)) {
throw new DomainException(self::MSG_BAD_DOCUMENT_TYPE);
}
return $this->setAttribute('documentType', $value);
}
|
@param string $value
@return $this
|
public static function createFromData(array $data)
{
if (!isset($data['afterAttemptPolicies'])) {
throw new DomainException('afterAttemptPolicies is required');
}
if (!isset($data['afterRetryEndPolicies'])) {
throw new DomainException('afterRetryEndPolicies is required');
}
if (!isset($data['attempts'])) {
throw new DomainException('attempts is required');
}
if (!is_array($data['afterAttemptPolicies'])) {
throw new DomainException('afterAttemptPolicies must be an array');
}
if (!is_array($data['afterRetryEndPolicies'])) {
throw new DomainException('afterRetryEndPolicies must be an array');
}
if (!is_array($data['attempts'])) {
throw new DomainException('attempts must be an array');
}
foreach ($data['afterAttemptPolicies'] as $policy) {
if (!in_array($policy, self::$availableAfterAttemptPolicies, true)) {
throw new DomainException('Invalid afterAttemptPolicies provided');
}
}
foreach ($data['afterRetryEndPolicies'] as $policy) {
if (!in_array($policy, self::$availableAfterRetryEndPolicies, true)) {
throw new DomainException('Invalid afterRetryEndPolicies provided');
}
}
return new self($data);
}
|
@param array $data
@return RetryInstruction
|
public function create($data, $paypalAccountId = null)
{
if (isset($paypalAccountId)) {
return $this->client()->put($data, 'paypal-accounts/{paypalAccountId}', ['paypalAccountId' => $paypalAccountId]);
}
return $this->client()->post($data, 'paypal-accounts');
}
|
@param array|JsonSerializable|PayPalAccount $data
@param string $paypalAccountId
@throws UnprocessableEntityException The input data does not valid
@return PayPalAccount
|
public function setAmountPolicy($value): self
{
if (!in_array($value, self::amountPolicies(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_POLICY, implode(', ', self::amountPolicies())));
}
return $this->setAttribute('amountPolicy', $value);
}
|
@param string $value
@return $this
|
public function setDatetimeFormat($value)
{
if (!in_array($value, self::datetimeFormats(), true)) {
throw new DomainException(
sprintf(self::MSG_UNEXPECTED_DATETIME_FORMAT, implode(', ', self::datetimeFormats()))
);
}
return $this->setAttribute('datetimeFormat', $value);
}
|
@param string $value
@return $this
|
public function create($data, $redemptionCode = null)
{
if (isset($redemptionCode)) {
return $this->client()->put($data, 'coupons/{redemptionCode}', ['redemptionCode' => $redemptionCode]);
}
return $this->client()->post($data, 'coupons');
}
|
@param array|JsonSerializable|Coupon $data
@param string $redemptionCode
@throws UnprocessableEntityException The input data is not valid
@return Coupon
|
public static function createFromData(array $data)
{
if (!isset($data['method'])) {
throw new DomainException(self::REQUIRED_METHOD);
}
switch ($data['method']) {
case self::AUTO:
$scheduleInstruction = new AutoType($data);
break;
case self::DATE_INTERVAL:
$scheduleInstruction = new DateIntervalType($data);
break;
case self::DAY_OF_MONTH:
$scheduleInstruction = new DayOfMonthType($data);
break;
case self::DAY_OF_WEEK:
$scheduleInstruction = new DayOfWeekType($data);
break;
case self::IMMEDIATELY:
$scheduleInstruction = new ImmediatelyType($data);
break;
case self::INTELLIGENT:
$scheduleInstruction = new IntelligentType($data);
break;
default:
throw new DomainException(
sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
);
}
return $scheduleInstruction;
}
|
@param array $data
@return ScheduleInstruction
|
public function create($data, $contactId = null)
{
if (isset($contactId)) {
return $this->client()->put($data, 'contacts/{contactId}', ['contactId' => $contactId]);
}
return $this->client()->post($data, 'contacts');
}
|
@param array|JsonSerializable|Contact $data
@param string $contactId
@throws UnprocessableEntityException The input data does not valid
@return Contact
|
public function create($data, $layoutId = null)
{
if (isset($layoutId)) {
return $this->client()->put($data, 'layouts/{layoutId}', ['layoutId' => $layoutId]);
}
return $this->client()->post($data, 'layouts');
}
|
@param array|JsonSerializable|Layout $data
@param string $layoutId
@throws UnprocessableEntityException The input data does not valid
@return Layout
|
public function create($data, $attachmentId = null)
{
if (isset($attachmentId)) {
return $this->client()->put($data, 'attachments/{attachmentId}', ['attachmentId' => $attachmentId]);
}
return $this->client()->post($data, 'attachments');
}
|
@param array|JsonSerializable|Attachment $data
@param null $attachmentId
@return Attachment The input data does not valid
|
public function create($data, $bankAccountId = null)
{
if (isset($bankAccountId)) {
return $this->client()->put($data, 'bank-accounts/{bankAccountId}', ['bankAccountId' => $bankAccountId]);
}
return $this->client()->post($data, 'bank-accounts');
}
|
@param array|JsonSerializable|BankAccount $data
@param string $bankAccountId
@throws UnprocessableEntityException The input data does not valid
@return BankAccount
|
public function createActions(array $data): array
{
return array_map(function ($data) {
if ($data instanceof RuleAction) {
return $data;
}
return RuleAction::createFromData((array) $data);
}, $data);
}
|
@param array $data
@return RuleAction[]|array
|
public function createAttempts($value): array
{
return array_map(function ($data) {
if ($data instanceof PaymentRetryAttempt) {
return $data;
}
return new PaymentRetryAttempt((array) $data);
}, $value);
}
|
@param PaymentRetryAttempt[]|array $value
@return PaymentRetryAttempt[]|array
|
public function setAfterAttemptPolicy($value): self
{
if (!in_array($value, self::afterAttemptPolicies(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_POLICY, implode(', ', self::afterAttemptPolicies())));
}
return $this->setAttribute('afterAttemptPolicy', $value);
}
|
@param string $value
@return $this
|
public function setAfterRetryEndPolicy($value): self
{
if (!in_array($value, self::afterRetryEndPolicies(), true)) {
throw new DomainException(sprintf(self::UNEXPECTED_POLICY, implode(', ', self::afterRetryEndPolicies())));
}
return $this->setAttribute('afterRetryEndPolicy', $value);
}
|
@param string $value
@return $this
|
public function create($data, $apiKeyId = null)
{
if (isset($apiKeyId)) {
return $this->client()->put($data, 'api-keys/{apiKeyId}', ['apiKeyId' => $apiKeyId]);
}
return $this->client()->post($data, 'api-keys');
}
|
@param array|JsonSerializable|ApiKey $data
@param string $apiKeyId
@throws UnprocessableEntityException The input data does not valid
@return ApiKey
|
public function findProperties(ReflectionClass $reflectionClass)
{
$allProperties = [];
/** @var ReflectionClass $currentReflectionClass */
$currentReflectionClass = $reflectionClass;
while ($currentReflectionClass) {// class without parent has null in getParentClass()
$properties = $currentReflectionClass->getProperties();
foreach ($properties as $property) {
if (isset($allProperties[$property->getName()])) {
// Do not add the same property few times
// If parent class has public or protected property - the same property will be returned for the Child class
// As child class is processed first - its property will be taken
continue;
}
$allProperties[$property->getName()] = $property;
}
$currentReflectionClass = $currentReflectionClass->getParentClass();
}
return $allProperties;
}
|
@param ReflectionClass $reflectionClass
@return ReflectionProperty[]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.