repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mailjet/laravel-mailjet | src/Services/ContactsListService.php | ContactsListService._exec | private function _exec($listId, Contact $contact)
{
return $this->mailjet->post(Resources::$ContactslistManagecontact,
['id' => $listId, 'body' => $contact->format()]
);
} | php | private function _exec($listId, Contact $contact)
{
return $this->mailjet->post(Resources::$ContactslistManagecontact,
['id' => $listId, 'body' => $contact->format()]
);
} | [
"private",
"function",
"_exec",
"(",
"$",
"listId",
",",
"Contact",
"$",
"contact",
")",
"{",
"return",
"$",
"this",
"->",
"mailjet",
"->",
"post",
"(",
"Resources",
"::",
"$",
"ContactslistManagecontact",
",",
"[",
"'id'",
"=>",
"$",
"listId",
",",
"'bo... | An action for adding a contact to a contact list. Only POST is supported.
The API will internally create the new contact if it does not exist,
add or update the name and properties.
The properties have to be defined before they can be used.
The API then adds the contact to the contact list with active=true and
unsub=specified value if it is not already in the list,
or updates the entry with these values. On success,
the API returns a packet with the same format but with all properties available
for that contact.
@param string $listId
@param Contact $contact | [
"An",
"action",
"for",
"adding",
"a",
"contact",
"to",
"a",
"contact",
"list",
".",
"Only",
"POST",
"is",
"supported",
".",
"The",
"API",
"will",
"internally",
"create",
"the",
"new",
"contact",
"if",
"it",
"does",
"not",
"exist",
"add",
"or",
"update",
... | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/ContactsListService.php#L203-L208 | train |
mailjet/laravel-mailjet | src/Model/CampaignDraft.php | CampaignDraft.format | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->locale)) {
$result[self::LOCALE_KEY] = $this->locale;
}
if (!is_null($this->sender)) {
$result[self::SENDER_KEY] = $this->sender;
}
if (!is_null($this->senderEmail)) {
$result[self::SENDEREMAIL_KEY] = $this->senderEmail;
}
if (!is_null($this->subject)) {
$result[self::SUBJECT_KEY] = $this->subject;
}
if (!is_null($this->contactsListID)) {
$result[self::CONTACTLISTID_KEY] = $this->contactsListID;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | php | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->locale)) {
$result[self::LOCALE_KEY] = $this->locale;
}
if (!is_null($this->sender)) {
$result[self::SENDER_KEY] = $this->sender;
}
if (!is_null($this->senderEmail)) {
$result[self::SENDEREMAIL_KEY] = $this->senderEmail;
}
if (!is_null($this->subject)) {
$result[self::SUBJECT_KEY] = $this->subject;
}
if (!is_null($this->contactsListID)) {
$result[self::CONTACTLISTID_KEY] = $this->contactsListID;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | [
"public",
"function",
"format",
"(",
")",
"{",
"/* * Add the mandatary props* */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"locale",
")",
")",
"{",
"$",
"result",
"[",
"self",
"::",
"LOCALE_KEY",
"]",
"=",
"$",
"this",
"->",
"locale",
... | Format CampaignDraft for MailJet API request
@return array | [
"Format",
"CampaignDraft",
"for",
"MailJet",
"API",
"request"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Model/CampaignDraft.php#L50-L77 | train |
mailjet/laravel-mailjet | src/Model/Campaign.php | Campaign.format | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->fromEmail)) {
$result[self::FROMEMAIL_KEY] = $this->fromEmail;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | php | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->fromEmail)) {
$result[self::FROMEMAIL_KEY] = $this->fromEmail;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | [
"public",
"function",
"format",
"(",
")",
"{",
"/* * Add the mandatary props* */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"fromEmail",
")",
")",
"{",
"$",
"result",
"[",
"self",
"::",
"FROMEMAIL_KEY",
"]",
"=",
"$",
"this",
"->",
"fromE... | Format Campaign for MailJet API request
@return array | [
"Format",
"Campaign",
"for",
"MailJet",
"API",
"request"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Model/Campaign.php#L35-L48 | train |
mailjet/laravel-mailjet | src/Model/ContactsList.php | ContactsList.validateAction | private function validateAction($action)
{
$actionAvailable = [self::ACTION_ADDFORCE, self::ACTION_ADDNOFORCE, self::ACTION_REMOVE, self::ACTION_UNSUB];
if (in_array($action, $actionAvailable)) {
return true;
}
return false;
} | php | private function validateAction($action)
{
$actionAvailable = [self::ACTION_ADDFORCE, self::ACTION_ADDNOFORCE, self::ACTION_REMOVE, self::ACTION_UNSUB];
if (in_array($action, $actionAvailable)) {
return true;
}
return false;
} | [
"private",
"function",
"validateAction",
"(",
"$",
"action",
")",
"{",
"$",
"actionAvailable",
"=",
"[",
"self",
"::",
"ACTION_ADDFORCE",
",",
"self",
"::",
"ACTION_ADDNOFORCE",
",",
"self",
"::",
"ACTION_REMOVE",
",",
"self",
"::",
"ACTION_UNSUB",
"]",
";",
... | Validate if action is authorized
@param string $action
@return bool | [
"Validate",
"if",
"action",
"is",
"authorized"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Model/ContactsList.php#L102-L109 | train |
mailjet/laravel-mailjet | src/Services/EventCallbackUrlService.php | EventCallbackUrlService.create | public function create(EventCallbackUrl $eventCallbackUrl)
{
$response = $this->mailjet->post(Resources::$Eventcallbackurl, ['body' => $eventCallbackUrl->format()]);
if (!$response->success()) {
$this->throwError("EventCallbackUrlService:create() failed", $response);
}
return $response->getData();
} | php | public function create(EventCallbackUrl $eventCallbackUrl)
{
$response = $this->mailjet->post(Resources::$Eventcallbackurl, ['body' => $eventCallbackUrl->format()]);
if (!$response->success()) {
$this->throwError("EventCallbackUrlService:create() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"create",
"(",
"EventCallbackUrl",
"$",
"eventCallbackUrl",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"post",
"(",
"Resources",
"::",
"$",
"Eventcallbackurl",
",",
"[",
"'body'",
"=>",
"$",
"eventCallbackUrl",
... | Create one EventCallbackUrl
@param EventCallbackUrl $eventCallbackUrl
@return array | [
"Create",
"one",
"EventCallbackUrl"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/EventCallbackUrlService.php#L67-L75 | train |
mailjet/laravel-mailjet | src/Services/EventCallbackUrlService.php | EventCallbackUrlService.update | public function update($id, EventCallbackUrl $eventCallbackUrl)
{
$response = $this->mailjet->put(Resources::$Eventcallbackurl, ['id' => $id, 'body' => $eventCallbackUrl->format()]);
if (!$response->success()) {
$this->throwError("EventCallbackUrlService:update() failed", $response);
}
return $response->getData();
} | php | public function update($id, EventCallbackUrl $eventCallbackUrl)
{
$response = $this->mailjet->put(Resources::$Eventcallbackurl, ['id' => $id, 'body' => $eventCallbackUrl->format()]);
if (!$response->success()) {
$this->throwError("EventCallbackUrlService:update() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"EventCallbackUrl",
"$",
"eventCallbackUrl",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"put",
"(",
"Resources",
"::",
"$",
"Eventcallbackurl",
",",
"[",
"'id'",
"=>",
"$",
"id... | Update one EventCallbackUrl
@param string $id
@param EventCallbackUrl $eventCallbackUrl
@return array | [
"Update",
"one",
"EventCallbackUrl"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/EventCallbackUrlService.php#L83-L91 | train |
mailjet/laravel-mailjet | src/Exception/MailjetException.php | MailjetException.setErrorFromResponse | private function setErrorFromResponse(Response $response)
{
$this->statusCode = $response->getStatus();
$body = $response->getBody();
if (isset($body['ErrorInfo'])) {
$this->errorInfo = $body['ErrorInfo'];
}
if (isset($body['ErrorMessage'])) {
$this->errorMessage = $body['ErrorMessage'];
}
if (isset($body['ErrorIdentifier'])) {
$this->errorIdentifier = $body['ErrorIdentifier'];
}
} | php | private function setErrorFromResponse(Response $response)
{
$this->statusCode = $response->getStatus();
$body = $response->getBody();
if (isset($body['ErrorInfo'])) {
$this->errorInfo = $body['ErrorInfo'];
}
if (isset($body['ErrorMessage'])) {
$this->errorMessage = $body['ErrorMessage'];
}
if (isset($body['ErrorIdentifier'])) {
$this->errorIdentifier = $body['ErrorIdentifier'];
}
} | [
"private",
"function",
"setErrorFromResponse",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"statusCode",
"=",
"$",
"response",
"->",
"getStatus",
"(",
")",
";",
"$",
"body",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"if",
... | Configure MailjetException from Mailjet\Response
@method setErrorFromResponse
@param Response $response | [
"Configure",
"MailjetException",
"from",
"Mailjet",
"\\",
"Response"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Exception/MailjetException.php#L47-L60 | train |
mailjet/laravel-mailjet | src/MailjetMailServiceProvider.php | MailjetMailServiceProvider.registerSwiftTransport | protected function registerSwiftTransport()
{
parent::registerSwiftTransport();
app('swift.transport')->extend('mailjet', function ($app) {
$config = $this->app['config']->get('services.mailjet', array());
$call = $this->app['config']->get('services.mailjet.transactionnal.call', true);
$options = $this->app['config']->get('services.mailjet.transactionnal.options', array());
return new MailjetTransport(new \Swift_Events_SimpleEventDispatcher(), $config['key'], $config['secret'], $call, $options);
});
} | php | protected function registerSwiftTransport()
{
parent::registerSwiftTransport();
app('swift.transport')->extend('mailjet', function ($app) {
$config = $this->app['config']->get('services.mailjet', array());
$call = $this->app['config']->get('services.mailjet.transactionnal.call', true);
$options = $this->app['config']->get('services.mailjet.transactionnal.options', array());
return new MailjetTransport(new \Swift_Events_SimpleEventDispatcher(), $config['key'], $config['secret'], $call, $options);
});
} | [
"protected",
"function",
"registerSwiftTransport",
"(",
")",
"{",
"parent",
"::",
"registerSwiftTransport",
"(",
")",
";",
"app",
"(",
"'swift.transport'",
")",
"->",
"extend",
"(",
"'mailjet'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"config",
"=",... | Extended register the Swift Transport instance.
@return void | [
"Extended",
"register",
"the",
"Swift",
"Transport",
"instance",
"."
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/MailjetMailServiceProvider.php#L15-L25 | train |
mailjet/laravel-mailjet | src/Services/CampaignDraftService.php | CampaignDraftService.getAllCampaignDrafts | public function getAllCampaignDrafts(array $filters = null)
{
$response = $this->mailjet->get(Resources::$Campaigndraft,
['filters' => $filters]);
if (!$response->success()) {
$this->throwError("CampaignDraftService :getAllCampaignDrafts() failed",
$response);
}
return $response->getData();
} | php | public function getAllCampaignDrafts(array $filters = null)
{
$response = $this->mailjet->get(Resources::$Campaigndraft,
['filters' => $filters]);
if (!$response->success()) {
$this->throwError("CampaignDraftService :getAllCampaignDrafts() failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"getAllCampaignDrafts",
"(",
"array",
"$",
"filters",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Campaigndraft",
",",
"[",
"'filters'",
"=>",
"$",
"filters",
... | List campaigndraft resources available for this apikey
@return array | [
"List",
"campaigndraft",
"resources",
"available",
"for",
"this",
"apikey"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/CampaignDraftService.php#L33-L43 | train |
mailjet/laravel-mailjet | src/Services/CampaignDraftService.php | CampaignDraftService.createDetailContent | public function createDetailContent($id, $contentData)
{
$response = $this->mailjet->post(Resources::$CampaigndraftDetailcontent,
['id' => $id, 'body' => $contentData]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:createDetailContent failed",
$response);
}
return $response->getData();
} | php | public function createDetailContent($id, $contentData)
{
$response = $this->mailjet->post(Resources::$CampaigndraftDetailcontent,
['id' => $id, 'body' => $contentData]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:createDetailContent failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"createDetailContent",
"(",
"$",
"id",
",",
"$",
"contentData",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"post",
"(",
"Resources",
"::",
"$",
"CampaigndraftDetailcontent",
",",
"[",
"'id'",
"=>",
"$",
"id",
... | Creates the content of a campaigndraft
@param string $id
@return array | [
"Creates",
"the",
"content",
"of",
"a",
"campaigndraft"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/CampaignDraftService.php#L115-L125 | train |
mailjet/laravel-mailjet | src/Services/CampaignDraftService.php | CampaignDraftService.getSchedule | public function getSchedule($CampaignId)
{
$response = $this->mailjet->get(Resources::$CampaigndraftSchedule,
['id' => $CampaignId]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:getSchedule failed",
$response);
}
return $response->getData();
} | php | public function getSchedule($CampaignId)
{
$response = $this->mailjet->get(Resources::$CampaigndraftSchedule,
['id' => $CampaignId]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:getSchedule failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"getSchedule",
"(",
"$",
"CampaignId",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"get",
"(",
"Resources",
"::",
"$",
"CampaigndraftSchedule",
",",
"[",
"'id'",
"=>",
"$",
"CampaignId",
"]",
")",
";",
"if",
... | Return the date of the scheduled sending of the campaigndraft
@param string Campaign $id
@return array | [
"Return",
"the",
"date",
"of",
"the",
"scheduled",
"sending",
"of",
"the",
"campaigndraft"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/CampaignDraftService.php#L132-L142 | train |
mailjet/laravel-mailjet | src/Services/CampaignDraftService.php | CampaignDraftService.scheduleCampaign | public function scheduleCampaign($CampaignId, $date)
{
$response = $this->mailjet->post(Resources::$CampaigndraftSchedule,
['id' => $CampaignId, 'body' => $date]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:scheduleCampaign failed",
$response);
}
return $response->getData();
} | php | public function scheduleCampaign($CampaignId, $date)
{
$response = $this->mailjet->post(Resources::$CampaigndraftSchedule,
['id' => $CampaignId, 'body' => $date]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:scheduleCampaign failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"scheduleCampaign",
"(",
"$",
"CampaignId",
",",
"$",
"date",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"post",
"(",
"Resources",
"::",
"$",
"CampaigndraftSchedule",
",",
"[",
"'id'",
"=>",
"$",
"CampaignId",... | Schedule when the campaigndraft will be sent
@param string Campaign $id
@param RFC3339 format "Y-m-d\TH:i:sP" $date
@return array | [
"Schedule",
"when",
"the",
"campaigndraft",
"will",
"be",
"sent"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/CampaignDraftService.php#L150-L160 | train |
mailjet/laravel-mailjet | src/Services/CampaignDraftService.php | CampaignDraftService.updateCampaignSchedule | public function updateCampaignSchedule($CampaignId, $date)
{
$response = $this->mailjet->put(Resources::$CampaigndraftSchedule,
['id' => $CampaignId, 'body' => $date]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:updateCampaignSchedule failed",
$response);
}
return $response->getData();
} | php | public function updateCampaignSchedule($CampaignId, $date)
{
$response = $this->mailjet->put(Resources::$CampaigndraftSchedule,
['id' => $CampaignId, 'body' => $date]);
if (!$response->success()) {
$this->throwError("CampaignDraftService:updateCampaignSchedule failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"updateCampaignSchedule",
"(",
"$",
"CampaignId",
",",
"$",
"date",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"put",
"(",
"Resources",
"::",
"$",
"CampaigndraftSchedule",
",",
"[",
"'id'",
"=>",
"$",
"Campaig... | Update the date when the campaigndraft will be sent
@param string Campaign $id
@param string Schedule $date
@return array | [
"Update",
"the",
"date",
"when",
"the",
"campaigndraft",
"will",
"be",
"sent"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/CampaignDraftService.php#L168-L178 | train |
mailjet/laravel-mailjet | src/Model/Template.php | Template.format | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->name)) {
$result[self::NAME_KEY] = $this->name;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | php | public function format() {
/* * Add the mandatary props* */
if (!is_null($this->name)) {
$result[self::NAME_KEY] = $this->name;
}
/* * Add the optional props if any* */
if (!is_null($this->optionalProperties)) {
$result = array_merge($result, $this->optionalProperties);
}
return $result;
} | [
"public",
"function",
"format",
"(",
")",
"{",
"/* * Add the mandatary props* */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"name",
")",
")",
"{",
"$",
"result",
"[",
"self",
"::",
"NAME_KEY",
"]",
"=",
"$",
"this",
"->",
"name",
";",
... | Format Template for MailJet API request
@return array | [
"Format",
"Template",
"for",
"MailJet",
"API",
"request"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Model/Template.php#L35-L49 | train |
laravel-notification-channels/twilio | src/TwilioChannel.php | TwilioChannel.getTo | protected function getTo($notifiable)
{
if ($notifiable->routeNotificationFor('twilio')) {
return $notifiable->routeNotificationFor('twilio');
}
if (isset($notifiable->phone_number)) {
return $notifiable->phone_number;
}
throw CouldNotSendNotification::invalidReceiver();
} | php | protected function getTo($notifiable)
{
if ($notifiable->routeNotificationFor('twilio')) {
return $notifiable->routeNotificationFor('twilio');
}
if (isset($notifiable->phone_number)) {
return $notifiable->phone_number;
}
throw CouldNotSendNotification::invalidReceiver();
} | [
"protected",
"function",
"getTo",
"(",
"$",
"notifiable",
")",
"{",
"if",
"(",
"$",
"notifiable",
"->",
"routeNotificationFor",
"(",
"'twilio'",
")",
")",
"{",
"return",
"$",
"notifiable",
"->",
"routeNotificationFor",
"(",
"'twilio'",
")",
";",
"}",
"if",
... | Get the address to send a notification to.
@param mixed $notifiable
@return mixed
@throws CouldNotSendNotification | [
"Get",
"the",
"address",
"to",
"send",
"a",
"notification",
"to",
"."
] | 4554feb7db38a9f53b49f0ce7150bc8600301c2d | https://github.com/laravel-notification-channels/twilio/blob/4554feb7db38a9f53b49f0ce7150bc8600301c2d/src/TwilioChannel.php#L76-L86 | train |
laravel-notification-channels/twilio | src/TwilioSmsMessage.php | TwilioSmsMessage.getFrom | public function getFrom()
{
if ($this->from) {
return $this->from;
}
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) {
return $this->alphaNumSender;
}
} | php | public function getFrom()
{
if ($this->from) {
return $this->from;
}
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) {
return $this->alphaNumSender;
}
} | [
"public",
"function",
"getFrom",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"from",
")",
"{",
"return",
"$",
"this",
"->",
"from",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"alphaNumSender",
"&&",
"strlen",
"(",
"$",
"this",
"->",
"alphaNumSender",
... | Get the from address of this message.
@return null|string | [
"Get",
"the",
"from",
"address",
"of",
"this",
"message",
"."
] | 4554feb7db38a9f53b49f0ce7150bc8600301c2d | https://github.com/laravel-notification-channels/twilio/blob/4554feb7db38a9f53b49f0ce7150bc8600301c2d/src/TwilioSmsMessage.php#L42-L51 | train |
laravel-notification-channels/twilio | src/Twilio.php | Twilio.sendMessage | public function sendMessage(TwilioMessage $message, $to, $useAlphanumericSender = false)
{
if ($message instanceof TwilioSmsMessage) {
if ($useAlphanumericSender && $sender = $this->getAlphanumericSender()) {
$message->from($sender);
}
return $this->sendSmsMessage($message, $to);
}
if ($message instanceof TwilioCallMessage) {
return $this->makeCall($message, $to);
}
throw CouldNotSendNotification::invalidMessageObject($message);
} | php | public function sendMessage(TwilioMessage $message, $to, $useAlphanumericSender = false)
{
if ($message instanceof TwilioSmsMessage) {
if ($useAlphanumericSender && $sender = $this->getAlphanumericSender()) {
$message->from($sender);
}
return $this->sendSmsMessage($message, $to);
}
if ($message instanceof TwilioCallMessage) {
return $this->makeCall($message, $to);
}
throw CouldNotSendNotification::invalidMessageObject($message);
} | [
"public",
"function",
"sendMessage",
"(",
"TwilioMessage",
"$",
"message",
",",
"$",
"to",
",",
"$",
"useAlphanumericSender",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"message",
"instanceof",
"TwilioSmsMessage",
")",
"{",
"if",
"(",
"$",
"useAlphanumericSender"... | Send a TwilioMessage to the a phone number.
@param TwilioMessage $message
@param string $to
@param bool $useAlphanumericSender
@return mixed
@throws \Twilio\Exceptions\TwilioException | [
"Send",
"a",
"TwilioMessage",
"to",
"the",
"a",
"phone",
"number",
"."
] | 4554feb7db38a9f53b49f0ce7150bc8600301c2d | https://github.com/laravel-notification-channels/twilio/blob/4554feb7db38a9f53b49f0ce7150bc8600301c2d/src/Twilio.php#L41-L56 | train |
laravel-notification-channels/twilio | src/Twilio.php | Twilio.sendSmsMessage | protected function sendSmsMessage(TwilioSmsMessage $message, $to)
{
$params = [
'body' => trim($message->content),
];
if ($messagingServiceSid = $this->getMessagingServiceSid($message)) {
$params['messagingServiceSid'] = $messagingServiceSid;
}
if ($from = $this->getFrom($message)) {
$params['from'] = $from;
}
if (! $from && ! $messagingServiceSid) {
throw CouldNotSendNotification::missingFrom();
}
$this->fillOptionalParams($params, $message, [
'statusCallback',
'statusCallbackMethod',
'applicationSid',
'maxPrice',
'provideFeedback',
'validityPeriod',
]);
if ($message instanceof TwilioMmsMessage) {
$this->fillOptionalParams($params, $message, [
'mediaUrl',
]);
}
return $this->twilioService->messages->create($to, $params);
} | php | protected function sendSmsMessage(TwilioSmsMessage $message, $to)
{
$params = [
'body' => trim($message->content),
];
if ($messagingServiceSid = $this->getMessagingServiceSid($message)) {
$params['messagingServiceSid'] = $messagingServiceSid;
}
if ($from = $this->getFrom($message)) {
$params['from'] = $from;
}
if (! $from && ! $messagingServiceSid) {
throw CouldNotSendNotification::missingFrom();
}
$this->fillOptionalParams($params, $message, [
'statusCallback',
'statusCallbackMethod',
'applicationSid',
'maxPrice',
'provideFeedback',
'validityPeriod',
]);
if ($message instanceof TwilioMmsMessage) {
$this->fillOptionalParams($params, $message, [
'mediaUrl',
]);
}
return $this->twilioService->messages->create($to, $params);
} | [
"protected",
"function",
"sendSmsMessage",
"(",
"TwilioSmsMessage",
"$",
"message",
",",
"$",
"to",
")",
"{",
"$",
"params",
"=",
"[",
"'body'",
"=>",
"trim",
"(",
"$",
"message",
"->",
"content",
")",
",",
"]",
";",
"if",
"(",
"$",
"messagingServiceSid"... | Send an sms message using the Twilio Service.
@param TwilioSmsMessage $message
@param string $to
@return \Twilio\Rest\Api\V2010\Account\MessageInstance | [
"Send",
"an",
"sms",
"message",
"using",
"the",
"Twilio",
"Service",
"."
] | 4554feb7db38a9f53b49f0ce7150bc8600301c2d | https://github.com/laravel-notification-channels/twilio/blob/4554feb7db38a9f53b49f0ce7150bc8600301c2d/src/Twilio.php#L65-L99 | train |
laravel-notification-channels/twilio | src/Twilio.php | Twilio.makeCall | protected function makeCall(TwilioCallMessage $message, $to)
{
$params = [
'url' => trim($message->content),
];
$this->fillOptionalParams($params, $message, [
'statusCallback',
'statusCallbackMethod',
'method',
'status',
'fallbackUrl',
'fallbackMethod',
]);
if (! $from = $this->getFrom($message)) {
throw CouldNotSendNotification::missingFrom();
}
return $this->twilioService->calls->create(
$to,
$from,
$params
);
} | php | protected function makeCall(TwilioCallMessage $message, $to)
{
$params = [
'url' => trim($message->content),
];
$this->fillOptionalParams($params, $message, [
'statusCallback',
'statusCallbackMethod',
'method',
'status',
'fallbackUrl',
'fallbackMethod',
]);
if (! $from = $this->getFrom($message)) {
throw CouldNotSendNotification::missingFrom();
}
return $this->twilioService->calls->create(
$to,
$from,
$params
);
} | [
"protected",
"function",
"makeCall",
"(",
"TwilioCallMessage",
"$",
"message",
",",
"$",
"to",
")",
"{",
"$",
"params",
"=",
"[",
"'url'",
"=>",
"trim",
"(",
"$",
"message",
"->",
"content",
")",
",",
"]",
";",
"$",
"this",
"->",
"fillOptionalParams",
... | Make a call using the Twilio Service.
@param TwilioCallMessage $message
@param string $to
@return \Twilio\Rest\Api\V2010\Account\CallInstance
@throws \Twilio\Exceptions\TwilioException | [
"Make",
"a",
"call",
"using",
"the",
"Twilio",
"Service",
"."
] | 4554feb7db38a9f53b49f0ce7150bc8600301c2d | https://github.com/laravel-notification-channels/twilio/blob/4554feb7db38a9f53b49f0ce7150bc8600301c2d/src/Twilio.php#L109-L133 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.GetPendingSettlements | public function GetPendingSettlements(& $pagination = null, $sorting = null)
{
return $this->GetList('disputes_pendingsettlement', $pagination, '\MangoPay\Dispute', null, null, $sorting);
} | php | public function GetPendingSettlements(& $pagination = null, $sorting = null)
{
return $this->GetList('disputes_pendingsettlement', $pagination, '\MangoPay\Dispute', null, null, $sorting);
} | [
"public",
"function",
"GetPendingSettlements",
"(",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_pendingsettlement'",
",",
"$",
"pagination",
",",
"'\\MangoPay\\Dispute'"... | List Disputes that need settling
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@return \MangoPay\Dispute[] Array with disputes | [
"List",
"Disputes",
"that",
"need",
"settling"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L42-L45 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.ResubmitDispute | public function ResubmitDispute($disputeId)
{
$dispute = new Dispute();
$dispute->Id = $disputeId;
return $this->SaveObject('disputes_save_contest_funds', $dispute, '\MangoPay\Dispute');
} | php | public function ResubmitDispute($disputeId)
{
$dispute = new Dispute();
$dispute->Id = $disputeId;
return $this->SaveObject('disputes_save_contest_funds', $dispute, '\MangoPay\Dispute');
} | [
"public",
"function",
"ResubmitDispute",
"(",
"$",
"disputeId",
")",
"{",
"$",
"dispute",
"=",
"new",
"Dispute",
"(",
")",
";",
"$",
"dispute",
"->",
"Id",
"=",
"$",
"disputeId",
";",
"return",
"$",
"this",
"->",
"SaveObject",
"(",
"'disputes_save_contest_... | This method is used to resubmit a Dispute if it is reopened requiring more docs
@param string $disputeId Dispute identifier
@return \MangoPay\Dispute Dispute instance returned from API | [
"This",
"method",
"is",
"used",
"to",
"resubmit",
"a",
"Dispute",
"if",
"it",
"is",
"reopened",
"requiring",
"more",
"docs"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L76-L81 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.GetTransactions | public function GetTransactions($disputeId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_transactions', $pagination, 'MangoPay\Transaction', $disputeId, $filter, $sorting);
} | php | public function GetTransactions($disputeId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_transactions', $pagination, 'MangoPay\Transaction', $disputeId, $filter, $sorting);
} | [
"public",
"function",
"GetTransactions",
"(",
"$",
"disputeId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_get_transactions'... | Gets dispute's transactions
@param string $disputeId Dispute identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@param \MangoPay\FilterTransactions $filter Filtering object
@return \MangoPay\Transaction[] List of Transaction instances returned from API
@throws Libraries\Exception | [
"Gets",
"dispute",
"s",
"transactions"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L104-L107 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.GetDisputesForWallet | public function GetDisputesForWallet($walletId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_for_wallet', $pagination, 'MangoPay\Dispute', $walletId, $filter, $sorting);
} | php | public function GetDisputesForWallet($walletId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_for_wallet', $pagination, 'MangoPay\Dispute', $walletId, $filter, $sorting);
} | [
"public",
"function",
"GetDisputesForWallet",
"(",
"$",
"walletId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_get_for_walle... | Gets dispute's documents for wallet
@param string $walletId Wallet identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@param \MangoPay\FilterDisputes $filter Filtering object
@return \MangoPay\Dispute[] List of dispute instances returned from API
@throws Libraries\Exception | [
"Gets",
"dispute",
"s",
"documents",
"for",
"wallet"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L118-L121 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.GetDisputesForUser | public function GetDisputesForUser($userId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_for_user', $pagination, 'MangoPay\Dispute', $userId, $filter, $sorting);
} | php | public function GetDisputesForUser($userId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_get_for_user', $pagination, 'MangoPay\Dispute', $userId, $filter, $sorting);
} | [
"public",
"function",
"GetDisputesForUser",
"(",
"$",
"userId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_get_for_user'",
... | Gets user's disputes
@param string $userId User identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@param \MangoPay\FilterDisputes $filter Filtering object
@return \MangoPay\Dispute[] List of Dispute instances returned from API
@throws Libraries\Exception | [
"Gets",
"user",
"s",
"disputes"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L132-L135 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.CreateSettlementTransfer | public function CreateSettlementTransfer($settlementTransfer, $repudiationId, $idempotencyKey = null)
{
return $this->CreateObject('disputes_repudiation_create_settlement', $settlementTransfer, '\MangoPay\Transfer', $repudiationId, null, $idempotencyKey);
} | php | public function CreateSettlementTransfer($settlementTransfer, $repudiationId, $idempotencyKey = null)
{
return $this->CreateObject('disputes_repudiation_create_settlement', $settlementTransfer, '\MangoPay\Transfer', $repudiationId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateSettlementTransfer",
"(",
"$",
"settlementTransfer",
",",
"$",
"repudiationId",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'disputes_repudiation_create_settlement'",
",",
"$",
"s... | Creates settlement transfer
@param \MangoPay\SettlementTransfer $settlementTransfer Settlement transfer
@param string $repudiationId Repudiation identifier
@return \MangoPay\Transfer Transfer instance returned from API | [
"Creates",
"settlement",
"transfer"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L153-L156 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.GetDocumentsForDispute | public function GetDocumentsForDispute($disputeId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_document_get_for_dispute', $pagination, 'MangoPay\DisputeDocument', $disputeId, $filter, $sorting);
} | php | public function GetDocumentsForDispute($disputeId, & $pagination = null, $sorting = null, $filter = null)
{
return $this->GetList('disputes_document_get_for_dispute', $pagination, 'MangoPay\DisputeDocument', $disputeId, $filter, $sorting);
} | [
"public",
"function",
"GetDocumentsForDispute",
"(",
"$",
"disputeId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_document_g... | Gets documents for dispute
@param string $disputeId Dispute identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@param \MangoPay\FilterDisputeDocuments $filter Filtering object
@return \MangoPay\DisputeDocument[] List of DisputeDocument instances returned from API
@throws Libraries\Exception | [
"Gets",
"documents",
"for",
"dispute"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L177-L180 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.CreateDisputeDocument | public function CreateDisputeDocument($disputeId, $disputeDocument, $idempotencyKey = null)
{
return $this->CreateObject('disputes_document_create', $disputeDocument, '\MangoPay\DisputeDocument', $disputeId, null, $idempotencyKey);
} | php | public function CreateDisputeDocument($disputeId, $disputeDocument, $idempotencyKey = null)
{
return $this->CreateObject('disputes_document_create', $disputeDocument, '\MangoPay\DisputeDocument', $disputeId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateDisputeDocument",
"(",
"$",
"disputeId",
",",
"$",
"disputeDocument",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'disputes_document_create'",
",",
"$",
"disputeDocument",
",",
... | Creates document for dispute
@param string $disputeId Dispute identifier
@param \MangoPay\DisputeDocument $disputeDocument Dispute document to be created
@return \MangoPay\DisputeDocument Dispute document returned from API | [
"Creates",
"document",
"for",
"dispute"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L199-L202 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.CreateDisputeDocumentPage | public function CreateDisputeDocumentPage($disputeId, $disputeDocumentId, $disputeDocumentPage, $idempotencyKey = null)
{
try {
$this->CreateObject('disputes_document_page_create', $disputeDocumentPage, null, $disputeId, $disputeDocumentId, $idempotencyKey);
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
}
}
} | php | public function CreateDisputeDocumentPage($disputeId, $disputeDocumentId, $disputeDocumentPage, $idempotencyKey = null)
{
try {
$this->CreateObject('disputes_document_page_create', $disputeDocumentPage, null, $disputeId, $disputeDocumentId, $idempotencyKey);
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
}
}
} | [
"public",
"function",
"CreateDisputeDocumentPage",
"(",
"$",
"disputeId",
",",
"$",
"disputeDocumentId",
",",
"$",
"disputeDocumentPage",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"CreateObject",
"(",
"'disputes_document_pag... | Creates document's page for dispute
@param string $disputeId Dispute identifier
@param string $disputeDocumentId Dispute document identifier
@param \MangoPay\DisputeDocumentPage $disputeDocumentPage Dispute document page object | [
"Creates",
"document",
"s",
"page",
"for",
"dispute"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L210-L219 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputes.php | ApiDisputes.CreateDisputeDocumentPageFromFile | public function CreateDisputeDocumentPageFromFile($disputeId, $disputeDocumentId, $file, $idempotencyKey = null)
{
$filePath = $file;
if (is_array($file)) {
$filePath = $file['tmp_name'];
}
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$disputeDocumentPage = new \MangoPay\DisputeDocumentPage();
$disputeDocumentPage->File = base64_encode(file_get_contents($filePath));
if (empty($disputeDocumentPage->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
$this->CreateDisputeDocumentPage($disputeId, $disputeDocumentId, $disputeDocumentPage, $idempotencyKey);
} | php | public function CreateDisputeDocumentPageFromFile($disputeId, $disputeDocumentId, $file, $idempotencyKey = null)
{
$filePath = $file;
if (is_array($file)) {
$filePath = $file['tmp_name'];
}
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$disputeDocumentPage = new \MangoPay\DisputeDocumentPage();
$disputeDocumentPage->File = base64_encode(file_get_contents($filePath));
if (empty($disputeDocumentPage->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
$this->CreateDisputeDocumentPage($disputeId, $disputeDocumentId, $disputeDocumentPage, $idempotencyKey);
} | [
"public",
"function",
"CreateDisputeDocumentPageFromFile",
"(",
"$",
"disputeId",
",",
"$",
"disputeDocumentId",
",",
"$",
"file",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"filePath",
"=",
"$",
"file",
";",
"if",
"(",
"is_array",
"(",
"$",
"... | Creates document's page for dispute from file
@param string $disputeId Dispute identifier
@param string $disputeDocumentId Dispute document identifier
@param string $file File path
@throws \MangoPay\Libraries\Exception | [
"Creates",
"document",
"s",
"page",
"for",
"dispute",
"from",
"file"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputes.php#L228-L251 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiBankAccounts.php | ApiBankAccounts.GetTransactions | public function GetTransactions($bankAccountId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_bank_account', $pagination, '\MangoPay\Transaction', $bankAccountId, $filter, $sorting);
} | php | public function GetTransactions($bankAccountId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_bank_account', $pagination, '\MangoPay\Transaction', $bankAccountId, $filter, $sorting);
} | [
"public",
"function",
"GetTransactions",
"(",
"$",
"bankAccountId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'transactions_get_for_b... | Retrieves a list of Transactions pertaining to a certain Bank Account
@param string $bankAccountId Bank Account identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterTransactions $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object | [
"Retrieves",
"a",
"list",
"of",
"Transactions",
"pertaining",
"to",
"a",
"certain",
"Bank",
"Account"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiBankAccounts.php#L17-L20 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/AuthorizationTokenManager.php | AuthorizationTokenManager.GetToken | public function GetToken($autenticationKey)
{
$token = $this->_storageStrategy->Get();
if (is_null($token) || false === $token || $token->IsExpired() || $token->GetAutenticationKey() != $autenticationKey) {
$this->StoreToken($this->_root->AuthenticationManager->CreateToken());
}
return $this->_storageStrategy->Get();
} | php | public function GetToken($autenticationKey)
{
$token = $this->_storageStrategy->Get();
if (is_null($token) || false === $token || $token->IsExpired() || $token->GetAutenticationKey() != $autenticationKey) {
$this->StoreToken($this->_root->AuthenticationManager->CreateToken());
}
return $this->_storageStrategy->Get();
} | [
"public",
"function",
"GetToken",
"(",
"$",
"autenticationKey",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"_storageStrategy",
"->",
"Get",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"token",
")",
"||",
"false",
"===",
"$",
"token",
"||",
"$... | Gets the current authorization token.
In the very first call, this method creates a new token before returning.
If currently stored token is expired, this method creates a new one.
@return \MangoPay\Libraries\OAuthToken Valid OAuthToken instance. | [
"Gets",
"the",
"current",
"authorization",
"token",
".",
"In",
"the",
"very",
"first",
"call",
"this",
"method",
"creates",
"a",
"new",
"token",
"before",
"returning",
".",
"If",
"currently",
"stored",
"token",
"is",
"expired",
"this",
"method",
"creates",
"... | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/AuthorizationTokenManager.php#L28-L37 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiOAuth.php | ApiOAuth.CreateToken | public function CreateToken()
{
$urlMethod = $this->GetRequestUrl('authentication_oauth');
$requestType = $this->GetRequestType('authentication_oauth');
$requestData = array(
'grant_type' => 'client_credentials'
);
$rest = new RestTool(false, $this->_root);
$authHlp = new AuthenticationHelper($this->_root);
$urlDetails = parse_url($this->_root->Config->BaseUrl);
$rest->AddRequestHttpHeader('Host: ' . @$urlDetails['host']);
$rest->AddRequestHttpHeader('Authorization: Basic ' . $authHlp->GetHttpHeaderBasicKey());
$rest->AddRequestHttpHeader('Content-Type: application/x-www-form-urlencoded');
$response = $rest->Request($urlMethod, $requestType, $requestData);
$token = $this->CastResponseToEntity($response, '\MangoPay\Libraries\OAuthToken');
$token->autentication_key = $authHlp->GetAutenticationKey();
return $token;
} | php | public function CreateToken()
{
$urlMethod = $this->GetRequestUrl('authentication_oauth');
$requestType = $this->GetRequestType('authentication_oauth');
$requestData = array(
'grant_type' => 'client_credentials'
);
$rest = new RestTool(false, $this->_root);
$authHlp = new AuthenticationHelper($this->_root);
$urlDetails = parse_url($this->_root->Config->BaseUrl);
$rest->AddRequestHttpHeader('Host: ' . @$urlDetails['host']);
$rest->AddRequestHttpHeader('Authorization: Basic ' . $authHlp->GetHttpHeaderBasicKey());
$rest->AddRequestHttpHeader('Content-Type: application/x-www-form-urlencoded');
$response = $rest->Request($urlMethod, $requestType, $requestData);
$token = $this->CastResponseToEntity($response, '\MangoPay\Libraries\OAuthToken');
$token->autentication_key = $authHlp->GetAutenticationKey();
return $token;
} | [
"public",
"function",
"CreateToken",
"(",
")",
"{",
"$",
"urlMethod",
"=",
"$",
"this",
"->",
"GetRequestUrl",
"(",
"'authentication_oauth'",
")",
";",
"$",
"requestType",
"=",
"$",
"this",
"->",
"GetRequestType",
"(",
"'authentication_oauth'",
")",
";",
"$",
... | Get token information to OAuth Authentication
@return \MangoPay\Libraries\OAuthToken OAuthToken object with token information | [
"Get",
"token",
"information",
"to",
"OAuth",
"Authentication"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiOAuth.php#L13-L33 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiBankingAliases.php | ApiBankingAliases.Create | public function Create($bankingAlias)
{
$className = get_class($bankingAlias);
if ($className == 'MangoPay\BankingAliasIBAN') {
$methodKey = 'banking_aliases_iban_create';
} else {
throw new Libraries\Exception('Wrong entity class for BankingAlias');
}
$response = $this->CreateObject($methodKey, $bankingAlias, null, $bankingAlias->WalletId);
return $this->GetBankingAliasResponse($response);
} | php | public function Create($bankingAlias)
{
$className = get_class($bankingAlias);
if ($className == 'MangoPay\BankingAliasIBAN') {
$methodKey = 'banking_aliases_iban_create';
} else {
throw new Libraries\Exception('Wrong entity class for BankingAlias');
}
$response = $this->CreateObject($methodKey, $bankingAlias, null, $bankingAlias->WalletId);
return $this->GetBankingAliasResponse($response);
} | [
"public",
"function",
"Create",
"(",
"$",
"bankingAlias",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"bankingAlias",
")",
";",
"if",
"(",
"$",
"className",
"==",
"'MangoPay\\BankingAliasIBAN'",
")",
"{",
"$",
"methodKey",
"=",
"'banking_aliases_ib... | Create a banking alias
@param \MangoPay\BankingAlias $bankingAlias Banking alias
@return \MangoPay\BankingAlias returned from API
@throws Libraries\Exception | [
"Create",
"a",
"banking",
"alias"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiBankingAliases.php#L26-L37 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiBankingAliases.php | ApiBankingAliases.GetAll | public function GetAll($walletId, & $pagination = null, $sorting = null)
{
$bankingAliases = $this->GetList('banking_aliases_all', $pagination, null, $walletId, null, $sorting);
return array_map(array($this, "GetBankingAliasResponse"), $bankingAliases);
} | php | public function GetAll($walletId, & $pagination = null, $sorting = null)
{
$bankingAliases = $this->GetList('banking_aliases_all', $pagination, null, $walletId, null, $sorting);
return array_map(array($this, "GetBankingAliasResponse"), $bankingAliases);
} | [
"public",
"function",
"GetAll",
"(",
"$",
"walletId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"$",
"bankingAliases",
"=",
"$",
"this",
"->",
"GetList",
"(",
"'banking_aliases_all'",
",",
"$",
"pagination",
",... | Get all banking aliases
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Object to sorting data
@param string $walletId Wallet identifier
@return \MangoPay\BankingAlias[] List of banking aliases | [
"Get",
"all",
"banking",
"aliases"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiBankingAliases.php#L57-L61 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiBankingAliases.php | ApiBankingAliases.GetBankingAliasResponse | private function GetBankingAliasResponse($response)
{
if (isset($response->Type)) {
switch ($response->Type) {
case BankingAliasType::IBAN:
return $this->CastResponseToEntity($response, '\MangoPay\BankingAliasIBAN');
default:
throw new Libraries\Exception('Unexpected response. Wrong BankingAlias Type value');
}
} else {
throw new Libraries\Exception('Unexpected response. Missing BankingAlias Type property');
}
} | php | private function GetBankingAliasResponse($response)
{
if (isset($response->Type)) {
switch ($response->Type) {
case BankingAliasType::IBAN:
return $this->CastResponseToEntity($response, '\MangoPay\BankingAliasIBAN');
default:
throw new Libraries\Exception('Unexpected response. Wrong BankingAlias Type value');
}
} else {
throw new Libraries\Exception('Unexpected response. Missing BankingAlias Type property');
}
} | [
"private",
"function",
"GetBankingAliasResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"Type",
")",
")",
"{",
"switch",
"(",
"$",
"response",
"->",
"Type",
")",
"{",
"case",
"BankingAliasType",
"::",
"IBAN",
":"... | Get correct banking alias object
@param object $response Response from API
@return \MangoPay\BankingAlias BankingAlias object returned from API
@throws \MangoPay\Libraries\Exception If occur unexpected response from API | [
"Get",
"correct",
"banking",
"alias",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiBankingAliases.php#L69-L81 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiCardPreAuthorizations.php | ApiCardPreAuthorizations.Create | public function Create($cardPreAuthorization, $idempotencyKey = null)
{
return $this->CreateObject('preauthorization_create', $cardPreAuthorization, '\MangoPay\CardPreAuthorization', null, null, $idempotencyKey);
} | php | public function Create($cardPreAuthorization, $idempotencyKey = null)
{
return $this->CreateObject('preauthorization_create', $cardPreAuthorization, '\MangoPay\CardPreAuthorization', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"cardPreAuthorization",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'preauthorization_create'",
",",
"$",
"cardPreAuthorization",
",",
"'\\MangoPay\\CardPreAuthorizatio... | Create new pre-authorization object
@param \MangoPay\CardPreAuthorization $cardPreAuthorization PreAuthorization object to create
@return \MangoPay\CardPreAuthorization PreAuthorization object returned from API | [
"Create",
"new",
"pre",
"-",
"authorization",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiCardPreAuthorizations.php#L14-L17 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/RestTool.php | RestTool.Request | public function Request($urlMethod, $requestType, $requestData = null, $idempotencyKey = null, & $pagination = null, $additionalUrlParams = null)
{
$this->_requestType = $requestType;
$this->_requestData = $requestData;
if (strpos($urlMethod, 'consult') !== false
&& (strpos($urlMethod, 'KYC/documents') !== false || strpos($urlMethod, 'dispute-documents') !== false)) {
$this->_requestData = "";
}
$logClass = $this->_root->Config->LogClass;
$this->logger->debug("New request");
if ($this->_root->Config->DebugMode) {
$logClass::Debug('++++++++++++++++++++++ New request ++++++++++++++++++++++', '');
}
$this->BuildRequest($urlMethod, $pagination, $additionalUrlParams, $idempotencyKey);
$responseResult = $this->_root->getHttpClient()->Request($this);
$logClass = $this->_root->Config->LogClass;
$this->logger->debug('Response JSON : ' . print_r($responseResult->Body, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('Response JSON', $responseResult->Body);
}
// FIXME This can fail hard.
$response = json_decode($responseResult->Body);
$this->logger->debug('Decoded object : ' . print_r($response, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('Response object', $response);
}
$this->CheckResponseCode($responseResult->ResponseCode, $response);
$this->ReadResponseHeader($responseResult->Headers);
if (!is_null($pagination)) {
$pagination = $this->_pagination;
}
return $response;
} | php | public function Request($urlMethod, $requestType, $requestData = null, $idempotencyKey = null, & $pagination = null, $additionalUrlParams = null)
{
$this->_requestType = $requestType;
$this->_requestData = $requestData;
if (strpos($urlMethod, 'consult') !== false
&& (strpos($urlMethod, 'KYC/documents') !== false || strpos($urlMethod, 'dispute-documents') !== false)) {
$this->_requestData = "";
}
$logClass = $this->_root->Config->LogClass;
$this->logger->debug("New request");
if ($this->_root->Config->DebugMode) {
$logClass::Debug('++++++++++++++++++++++ New request ++++++++++++++++++++++', '');
}
$this->BuildRequest($urlMethod, $pagination, $additionalUrlParams, $idempotencyKey);
$responseResult = $this->_root->getHttpClient()->Request($this);
$logClass = $this->_root->Config->LogClass;
$this->logger->debug('Response JSON : ' . print_r($responseResult->Body, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('Response JSON', $responseResult->Body);
}
// FIXME This can fail hard.
$response = json_decode($responseResult->Body);
$this->logger->debug('Decoded object : ' . print_r($response, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('Response object', $response);
}
$this->CheckResponseCode($responseResult->ResponseCode, $response);
$this->ReadResponseHeader($responseResult->Headers);
if (!is_null($pagination)) {
$pagination = $this->_pagination;
}
return $response;
} | [
"public",
"function",
"Request",
"(",
"$",
"urlMethod",
",",
"$",
"requestType",
",",
"$",
"requestData",
"=",
"null",
",",
"$",
"idempotencyKey",
"=",
"null",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"additionalUrlParams",
"=",
"null",
")",
"... | Call request to MangoPay API
@param string $urlMethod Type of method in REST API
@param \MangoPay\Libraries\RequestType $requestType Type of request
@param array $requestData Data to send in request
@param string $idempotencyKey
@param \MangoPay\Pagination $pagination Pagination object
@param array $additionalUrlParams with additional parameters to URL. Expected keys: "sort" and "filter"
@return object Response data | [
"Call",
"request",
"to",
"MangoPay",
"API"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/RestTool.php#L125-L157 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/RestTool.php | RestTool.BuildRequest | private function BuildRequest($urlMethod, $pagination, $additionalUrlParams = null, $idempotencyKey = null)
{
$urlTool = new UrlTool($this->_root);
$restUrl = $urlTool->GetRestUrl($urlMethod, $this->_authRequired, $pagination, $additionalUrlParams);
$this->_requestUrl = $urlTool->GetFullUrl($restUrl);
$logClass = $this->_root->Config->LogClass;
$this->logger->debug('FullUrl : ' . $this->_requestUrl);
if ($this->_root->Config->DebugMode) {
$logClass::Debug('FullUrl', $this->_requestUrl);
}
if (!is_null($pagination)) {
$this->_pagination = $pagination;
}
$this->logger->debug('RequestType : ' . $this->_requestType);
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestType', $this->_requestType);
}
$httpHeaders = $this->GetHttpHeaders($idempotencyKey);
$this->logger->debug('HTTP Headers : ' . print_r($httpHeaders, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('HTTP Headers', $httpHeaders);
}
if (!is_null($this->_requestData)) {
$this->logger->debug('RequestData object :' . print_r($this->_requestData, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestData object', $this->_requestData);
}
// encode to json if needed
if (in_array(self::$_JSON_HEADER, $httpHeaders)) {
// FIXME This can also fail hard and is not checked.
$this->_requestData = json_encode($this->_requestData);
$this->logger->debug('RequestData JSON :' . print_r($this->_requestData, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestData JSON', $this->_requestData);
}
}
}
} | php | private function BuildRequest($urlMethod, $pagination, $additionalUrlParams = null, $idempotencyKey = null)
{
$urlTool = new UrlTool($this->_root);
$restUrl = $urlTool->GetRestUrl($urlMethod, $this->_authRequired, $pagination, $additionalUrlParams);
$this->_requestUrl = $urlTool->GetFullUrl($restUrl);
$logClass = $this->_root->Config->LogClass;
$this->logger->debug('FullUrl : ' . $this->_requestUrl);
if ($this->_root->Config->DebugMode) {
$logClass::Debug('FullUrl', $this->_requestUrl);
}
if (!is_null($pagination)) {
$this->_pagination = $pagination;
}
$this->logger->debug('RequestType : ' . $this->_requestType);
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestType', $this->_requestType);
}
$httpHeaders = $this->GetHttpHeaders($idempotencyKey);
$this->logger->debug('HTTP Headers : ' . print_r($httpHeaders, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('HTTP Headers', $httpHeaders);
}
if (!is_null($this->_requestData)) {
$this->logger->debug('RequestData object :' . print_r($this->_requestData, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestData object', $this->_requestData);
}
// encode to json if needed
if (in_array(self::$_JSON_HEADER, $httpHeaders)) {
// FIXME This can also fail hard and is not checked.
$this->_requestData = json_encode($this->_requestData);
$this->logger->debug('RequestData JSON :' . print_r($this->_requestData, true));
if ($this->_root->Config->DebugMode) {
$logClass::Debug('RequestData JSON', $this->_requestData);
}
}
}
} | [
"private",
"function",
"BuildRequest",
"(",
"$",
"urlMethod",
",",
"$",
"pagination",
",",
"$",
"additionalUrlParams",
"=",
"null",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"urlTool",
"=",
"new",
"UrlTool",
"(",
"$",
"this",
"->",
"_root",
... | Prepare all parameter to request
@param string $urlMethod Type of method in REST API
@param \MangoPay\Pagination $pagination
@param null $additionalUrlParams
@param string $idempotencyKey Key for response replication | [
"Prepare",
"all",
"parameter",
"to",
"request"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/RestTool.php#L167-L204 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/RestTool.php | RestTool.GetHttpHeaders | private function GetHttpHeaders($idempotencyKey = null)
{
// return if already created...
if (!is_null($this->_requestHttpHeaders)) {
return $this->_requestHttpHeaders;
}
// ...or initialize with default headers
$this->_requestHttpHeaders = array();
// content type
array_push($this->_requestHttpHeaders, self::$_JSON_HEADER);
// Add User-Agent Header
array_push($this->_requestHttpHeaders, 'User-Agent: MangoPay V2 PHP/' . self::VERSION);
// Authentication http header
if ($this->_authRequired) {
$authHlp = new AuthenticationHelper($this->_root);
array_push($this->_requestHttpHeaders, $authHlp->GetHttpHeaderKey());
}
if ($idempotencyKey != null) {
array_push($this->_requestHttpHeaders, 'Idempotency-Key: ' . $idempotencyKey);
}
return $this->_requestHttpHeaders;
} | php | private function GetHttpHeaders($idempotencyKey = null)
{
// return if already created...
if (!is_null($this->_requestHttpHeaders)) {
return $this->_requestHttpHeaders;
}
// ...or initialize with default headers
$this->_requestHttpHeaders = array();
// content type
array_push($this->_requestHttpHeaders, self::$_JSON_HEADER);
// Add User-Agent Header
array_push($this->_requestHttpHeaders, 'User-Agent: MangoPay V2 PHP/' . self::VERSION);
// Authentication http header
if ($this->_authRequired) {
$authHlp = new AuthenticationHelper($this->_root);
array_push($this->_requestHttpHeaders, $authHlp->GetHttpHeaderKey());
}
if ($idempotencyKey != null) {
array_push($this->_requestHttpHeaders, 'Idempotency-Key: ' . $idempotencyKey);
}
return $this->_requestHttpHeaders;
} | [
"private",
"function",
"GetHttpHeaders",
"(",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"// return if already created...",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_requestHttpHeaders",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_requestHttpHead... | Get HTTP header to use in request
@param string $idempotencyKey Key for response replication
@return array Array with HTTP headers | [
"Get",
"HTTP",
"header",
"to",
"use",
"in",
"request"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/RestTool.php#L316-L337 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/RestTool.php | RestTool.CheckResponseCode | private function CheckResponseCode($responseCode, $response)
{
if ($responseCode < 200 || $responseCode > 299) {
if (isset($response) && is_object($response) && isset($response->Message)) {
$error = new Error();
$error->Message = $response->Message;
$error->Errors = property_exists($response, 'Errors')
? $response->Errors
: property_exists($response, 'errors') ? $response->errors : null;
$error->Id = property_exists($response, 'Id') ? $response->Id : null;
$error->Type = property_exists($response, 'Type') ? $response->Type : null;
$error->Date = property_exists($response, 'Date') ? $response->Date : null;
throw new ResponseException($this->_requestUrl, $responseCode, $error);
} else {
throw new ResponseException($this->_requestUrl, $responseCode);
}
}
} | php | private function CheckResponseCode($responseCode, $response)
{
if ($responseCode < 200 || $responseCode > 299) {
if (isset($response) && is_object($response) && isset($response->Message)) {
$error = new Error();
$error->Message = $response->Message;
$error->Errors = property_exists($response, 'Errors')
? $response->Errors
: property_exists($response, 'errors') ? $response->errors : null;
$error->Id = property_exists($response, 'Id') ? $response->Id : null;
$error->Type = property_exists($response, 'Type') ? $response->Type : null;
$error->Date = property_exists($response, 'Date') ? $response->Date : null;
throw new ResponseException($this->_requestUrl, $responseCode, $error);
} else {
throw new ResponseException($this->_requestUrl, $responseCode);
}
}
} | [
"private",
"function",
"CheckResponseCode",
"(",
"$",
"responseCode",
",",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"responseCode",
"<",
"200",
"||",
"$",
"responseCode",
">",
"299",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"response",
")",
"&&",
"is_... | Check response code
@param int $responseCode
@param object $response Response from REST API
@throws ResponseException If response code not OK | [
"Check",
"response",
"code"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/RestTool.php#L347-L364 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiReports.php | ApiReports.Create | public function Create($reportRequest, $idempotencyKey = null)
{
$type = $reportRequest->ReportType;
if (is_null($type) || strlen($type) == 0)
throw new Libraries\Exception('Report type property is required when create a report request.');
switch ($type) {
case ReportType::Transactions:
return $this->CreateObject('reports_transactions_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
case ReportType::Wallets:
return $this->CreateObject('reports_wallets_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
default:
throw new Libraries\Exception('Unexpected Report type. Wrong ReportType value.');
}
} | php | public function Create($reportRequest, $idempotencyKey = null)
{
$type = $reportRequest->ReportType;
if (is_null($type) || strlen($type) == 0)
throw new Libraries\Exception('Report type property is required when create a report request.');
switch ($type) {
case ReportType::Transactions:
return $this->CreateObject('reports_transactions_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
case ReportType::Wallets:
return $this->CreateObject('reports_wallets_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
default:
throw new Libraries\Exception('Unexpected Report type. Wrong ReportType value.');
}
} | [
"public",
"function",
"Create",
"(",
"$",
"reportRequest",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"reportRequest",
"->",
"ReportType",
";",
"if",
"(",
"is_null",
"(",
"$",
"type",
")",
"||",
"strlen",
"(",
"$",
"type"... | Creates new report request
@param \MangoPay\ReportRequest $reportRequest
@return \MangoPay\ReportRequest Report request instance returned from API | [
"Creates",
"new",
"report",
"request"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiReports.php#L14-L29 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiHooks.php | ApiHooks.Create | public function Create($hook, $idempotencyKey = null)
{
return $this->CreateObject('hooks_create', $hook, '\MangoPay\Hook', null, null, $idempotencyKey);
} | php | public function Create($hook, $idempotencyKey = null)
{
return $this->CreateObject('hooks_create', $hook, '\MangoPay\Hook', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"hook",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'hooks_create'",
",",
"$",
"hook",
",",
"'\\MangoPay\\Hook'",
",",
"null",
",",
"null",
",",
"$",
"ide... | Create new hook
@param Hook $hook
@param string $idempotencyKey Idempotency key for response replication
@return \MangoPay\Hook Hook object returned from API | [
"Create",
"new",
"hook"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiHooks.php#L15-L18 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiHooks.php | ApiHooks.GetAll | public function GetAll(& $pagination = null, $sorting = null)
{
return $this->GetList('hooks_all', $pagination, '\MangoPay\Hook', null, null, $sorting);
} | php | public function GetAll(& $pagination = null, $sorting = null)
{
return $this->GetList('hooks_all', $pagination, '\MangoPay\Hook', null, null, $sorting);
} | [
"public",
"function",
"GetAll",
"(",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'hooks_all'",
",",
"$",
"pagination",
",",
"'\\MangoPay\\Hook'",
",",
"null",
",",
"null",... | Get all hooks
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Hook[] Array with objects returned from API
@throws Libraries\Exception | [
"Get",
"all",
"hooks"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiHooks.php#L47-L50 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/HttpCurl.php | HttpCurl.RunRequest | private function RunRequest()
{
$result = curl_exec($this->_curlHandle);
if ($result === false && curl_errno($this->_curlHandle) != 0) {
$this->logger->error("cURL error: " . curl_error($this->_curlHandle));
throw new Exception('cURL error: ' . curl_error($this->_curlHandle));
}
$response = new HttpResponse();
$response->ResponseCode = (int) curl_getinfo($this->_curlHandle, CURLINFO_HTTP_CODE);
curl_close($this->_curlHandle);
$explode = explode("\r\n\r\n", $result);
// multiple query (follow redirect) take only the last request
$explode = array_slice($explode, sizeof($explode) - 2, 2);
$response->Headers = explode("\n", implode($explode));
$response->Body = array_pop($explode);
return $response;
} | php | private function RunRequest()
{
$result = curl_exec($this->_curlHandle);
if ($result === false && curl_errno($this->_curlHandle) != 0) {
$this->logger->error("cURL error: " . curl_error($this->_curlHandle));
throw new Exception('cURL error: ' . curl_error($this->_curlHandle));
}
$response = new HttpResponse();
$response->ResponseCode = (int) curl_getinfo($this->_curlHandle, CURLINFO_HTTP_CODE);
curl_close($this->_curlHandle);
$explode = explode("\r\n\r\n", $result);
// multiple query (follow redirect) take only the last request
$explode = array_slice($explode, sizeof($explode) - 2, 2);
$response->Headers = explode("\n", implode($explode));
$response->Body = array_pop($explode);
return $response;
} | [
"private",
"function",
"RunRequest",
"(",
")",
"{",
"$",
"result",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"_curlHandle",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
"&&",
"curl_errno",
"(",
"$",
"this",
"->",
"_curlHandle",
")",
"!=",
"0",
... | Execute request and check response
@return HttpResponse Response data
@throws Exception If cURL has error | [
"Execute",
"request",
"and",
"check",
"response"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/HttpCurl.php#L101-L123 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiDisputeDocuments.php | ApiDisputeDocuments.CreateDisputeDocumentConsult | public function CreateDisputeDocumentConsult($documentId, & $pagination = null)
{
return $this->GetList('disputes_document_create_consult', $pagination, 'MangoPay\DocumentPageConsult', $documentId, null, null);
} | php | public function CreateDisputeDocumentConsult($documentId, & $pagination = null)
{
return $this->GetList('disputes_document_create_consult', $pagination, 'MangoPay\DocumentPageConsult', $documentId, null, null);
} | [
"public",
"function",
"CreateDisputeDocumentConsult",
"(",
"$",
"documentId",
",",
"&",
"$",
"pagination",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'disputes_document_create_consult'",
",",
"$",
"pagination",
",",
"'MangoPay\\DocumentPage... | Creates temporary URLs where each page of a dispute document can be viewed.
@param string $documentId Identification of the document whose pages to view
@param \MangoPay\Pagination $pagination Pagination object
@return \MangoPay\DocumentPageConsult[] Array of consults for viewing the dispute document's pages | [
"Creates",
"temporary",
"URLs",
"where",
"each",
"page",
"of",
"a",
"dispute",
"document",
"can",
"be",
"viewed",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiDisputeDocuments.php#L42-L45 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.CreateObject | protected function CreateObject($methodKey, $entity, $responseClassName = null, $entityId = null, $subEntityId = null, $idempotencyKey = null)
{
if (is_null($entityId)) {
$urlMethod = $this->GetRequestUrl($methodKey);
} elseif (is_null($subEntityId)) {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId);
} else {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $subEntityId);
}
$requestData = null;
if (!is_null($entity)) {
$requestData = $this->BuildRequestData($entity);
}
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), $requestData, $idempotencyKey);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | php | protected function CreateObject($methodKey, $entity, $responseClassName = null, $entityId = null, $subEntityId = null, $idempotencyKey = null)
{
if (is_null($entityId)) {
$urlMethod = $this->GetRequestUrl($methodKey);
} elseif (is_null($subEntityId)) {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId);
} else {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $subEntityId);
}
$requestData = null;
if (!is_null($entity)) {
$requestData = $this->BuildRequestData($entity);
}
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), $requestData, $idempotencyKey);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | [
"protected",
"function",
"CreateObject",
"(",
"$",
"methodKey",
",",
"$",
"entity",
",",
"$",
"responseClassName",
"=",
"null",
",",
"$",
"entityId",
"=",
"null",
",",
"$",
"subEntityId",
"=",
"null",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"i... | Create object in API
@param string $methodKey Key with request data
@param object $entity Entity object
@param object $responseClassName Name of entity class from response
@param string $entityId Entity identifier
@return object Response data | [
"Create",
"object",
"in",
"API"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L221-L244 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.GetObject | protected function GetObject($methodKey, $entityId, $responseClassName = null, $secondEntityId = null)
{
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $secondEntityId);
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey));
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | php | protected function GetObject($methodKey, $entityId, $responseClassName = null, $secondEntityId = null)
{
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $secondEntityId);
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey));
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | [
"protected",
"function",
"GetObject",
"(",
"$",
"methodKey",
",",
"$",
"entityId",
",",
"$",
"responseClassName",
"=",
"null",
",",
"$",
"secondEntityId",
"=",
"null",
")",
"{",
"$",
"urlMethod",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"GetRequestUrl",
"("... | Get entity object from API
@param string $methodKey Key with request data
@param string $entityId Entity identifier
@param object $responseClassName Name of entity class from response
@param int $secondEntityId Entity identifier for second entity
@return object Response data | [
"Get",
"entity",
"object",
"from",
"API"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L254-L266 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.GetList | protected function GetList($methodKey, & $pagination, $responseClassName = null, $entityId = null, $filter = null, $sorting = null, $secondEntityId = null)
{
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $secondEntityId);
if (is_null($pagination) || !is_object($pagination) || get_class($pagination) != 'MangoPay\Pagination') {
$pagination = new \MangoPay\Pagination();
}
$rest = new RestTool(true, $this->_root);
$additionalUrlParams = array();
if (!is_null($filter)) {
$additionalUrlParams["filter"] = $filter;
}
if (!is_null($sorting)) {
if (!is_a($sorting, "\MangoPay\Sorting")) {
throw new Exception('Wrong type of sorting object');
}
$additionalUrlParams["sort"] = $sorting->GetSortParameter();
}
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), null, null, $pagination, $additionalUrlParams);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | php | protected function GetList($methodKey, & $pagination, $responseClassName = null, $entityId = null, $filter = null, $sorting = null, $secondEntityId = null)
{
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $secondEntityId);
if (is_null($pagination) || !is_object($pagination) || get_class($pagination) != 'MangoPay\Pagination') {
$pagination = new \MangoPay\Pagination();
}
$rest = new RestTool(true, $this->_root);
$additionalUrlParams = array();
if (!is_null($filter)) {
$additionalUrlParams["filter"] = $filter;
}
if (!is_null($sorting)) {
if (!is_a($sorting, "\MangoPay\Sorting")) {
throw new Exception('Wrong type of sorting object');
}
$additionalUrlParams["sort"] = $sorting->GetSortParameter();
}
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), null, null, $pagination, $additionalUrlParams);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | [
"protected",
"function",
"GetList",
"(",
"$",
"methodKey",
",",
"&",
"$",
"pagination",
",",
"$",
"responseClassName",
"=",
"null",
",",
"$",
"entityId",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
",",
"$",
"secondE... | Get lst with entities object from API
@param string $methodKey Key with request data
@param \MangoPay\Pagination $pagination Pagination object
@param object $responseClassName Name of entity class from response
@param string $entityId Entity identifier
@param object $filter Object to filter data
@param \MangoPay\Sorting $sorting Object to sorting data
@return object[] Response data | [
"Get",
"lst",
"with",
"entities",
"object",
"from",
"API"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L278-L306 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.SaveObject | protected function SaveObject($methodKey, $entity, $responseClassName = null, $secondEntityId = null)
{
$entityId = null;
if (isset($entity->Id)){
$entityId = $entity->Id;
}
if (is_null($secondEntityId)) {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId);
} else {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $secondEntityId, $entityId);
}
$requestData = $this->BuildRequestData($entity);
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), $requestData);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | php | protected function SaveObject($methodKey, $entity, $responseClassName = null, $secondEntityId = null)
{
$entityId = null;
if (isset($entity->Id)){
$entityId = $entity->Id;
}
if (is_null($secondEntityId)) {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId);
} else {
$urlMethod = sprintf($this->GetRequestUrl($methodKey), $secondEntityId, $entityId);
}
$requestData = $this->BuildRequestData($entity);
$rest = new RestTool(true, $this->_root);
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), $requestData);
if (!is_null($responseClassName)) {
return $this->CastResponseToEntity($response, $responseClassName);
}
return $response;
} | [
"protected",
"function",
"SaveObject",
"(",
"$",
"methodKey",
",",
"$",
"entity",
",",
"$",
"responseClassName",
"=",
"null",
",",
"$",
"secondEntityId",
"=",
"null",
")",
"{",
"$",
"entityId",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"entity",
... | Save object in API
@param string $methodKey Key with request data
@param object $entity Entity object to save
@param object $responseClassName Name of entity class from response
@return object Response data | [
"Save",
"object",
"in",
"API"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L315-L338 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.CastResponseToEntity | protected function CastResponseToEntity($response, $entityClassName, $asDependentObject = false)
{
if (is_array($response)) {
$list = array();
foreach ($response as $responseObject) {
array_push($list, $this->CastResponseToEntity($responseObject, $entityClassName));
}
return $list;
}
if (is_string($entityClassName)) {
$entity = new $entityClassName();
} else {
throw new Exception('Cannot cast response to entity object. Wrong entity class name');
}
$responseReflection = new \ReflectionObject($response);
$entityReflection = new \ReflectionObject($entity);
$responseProperties = $responseReflection->getProperties();
$subObjects = $entity->GetSubObjects();
$dependsObjects = $entity->GetDependsObjects();
foreach ($responseProperties as $responseProperty) {
$responseProperty->setAccessible(true);
$name = $responseProperty->getName();
$value = $responseProperty->getValue($response);
if ($entityReflection->hasProperty($name)) {
$entityProperty = $entityReflection->getProperty($name);
$entityProperty->setAccessible(true);
if ($entityProperty->getName() == "DeclaredUBOs") {
$declaredUbos = [];
foreach ($value as $declaredUboRaw) {
$declaredUbo = new \MangoPay\DeclaredUbo();
$declaredUbo->UserId = $declaredUboRaw->UserId;
$declaredUbo->Status = $declaredUboRaw->Status;
$declaredUbo->RefusedReasonType = $declaredUboRaw->RefusedReasonMessage;
$declaredUbo->RefusedReasonMessage = $declaredUboRaw->RefusedReasonMessage;
array_push($declaredUbos, $declaredUbo);
}
$value = $declaredUbos;
}
// is sub object?
if (isset($subObjects[$name])) {
if (is_null($value)) {
$object = null;
} else {
$object = $this->CastResponseToEntity($value, $subObjects[$name]);
}
$entityProperty->setValue($entity, $object);
} else {
$entityProperty->setValue($entity, $value);
}
// has dependent object?
if (isset($dependsObjects[$name])) {
$dependsObject = $dependsObjects[$name];
$entityDependProperty = $entityReflection->getProperty($dependsObject['_property_name']);
$entityDependProperty->setAccessible(true);
$entityDependProperty->setValue($entity, $this->CastResponseToEntity($response, $dependsObject[$value], true));
}
} else {
if ($asDependentObject || !empty($dependsObjects)) {
continue;
} else {
/* UNCOMMENT THE LINE BELOW TO ENABLE RESTRICTIVE REFLECTION MODE */
//throw new Exception('Cannot cast response to entity object. Missing property ' . $name .' in entity ' . $entityClassName);
continue;
}
}
}
return $entity;
} | php | protected function CastResponseToEntity($response, $entityClassName, $asDependentObject = false)
{
if (is_array($response)) {
$list = array();
foreach ($response as $responseObject) {
array_push($list, $this->CastResponseToEntity($responseObject, $entityClassName));
}
return $list;
}
if (is_string($entityClassName)) {
$entity = new $entityClassName();
} else {
throw new Exception('Cannot cast response to entity object. Wrong entity class name');
}
$responseReflection = new \ReflectionObject($response);
$entityReflection = new \ReflectionObject($entity);
$responseProperties = $responseReflection->getProperties();
$subObjects = $entity->GetSubObjects();
$dependsObjects = $entity->GetDependsObjects();
foreach ($responseProperties as $responseProperty) {
$responseProperty->setAccessible(true);
$name = $responseProperty->getName();
$value = $responseProperty->getValue($response);
if ($entityReflection->hasProperty($name)) {
$entityProperty = $entityReflection->getProperty($name);
$entityProperty->setAccessible(true);
if ($entityProperty->getName() == "DeclaredUBOs") {
$declaredUbos = [];
foreach ($value as $declaredUboRaw) {
$declaredUbo = new \MangoPay\DeclaredUbo();
$declaredUbo->UserId = $declaredUboRaw->UserId;
$declaredUbo->Status = $declaredUboRaw->Status;
$declaredUbo->RefusedReasonType = $declaredUboRaw->RefusedReasonMessage;
$declaredUbo->RefusedReasonMessage = $declaredUboRaw->RefusedReasonMessage;
array_push($declaredUbos, $declaredUbo);
}
$value = $declaredUbos;
}
// is sub object?
if (isset($subObjects[$name])) {
if (is_null($value)) {
$object = null;
} else {
$object = $this->CastResponseToEntity($value, $subObjects[$name]);
}
$entityProperty->setValue($entity, $object);
} else {
$entityProperty->setValue($entity, $value);
}
// has dependent object?
if (isset($dependsObjects[$name])) {
$dependsObject = $dependsObjects[$name];
$entityDependProperty = $entityReflection->getProperty($dependsObject['_property_name']);
$entityDependProperty->setAccessible(true);
$entityDependProperty->setValue($entity, $this->CastResponseToEntity($response, $dependsObject[$value], true));
}
} else {
if ($asDependentObject || !empty($dependsObjects)) {
continue;
} else {
/* UNCOMMENT THE LINE BELOW TO ENABLE RESTRICTIVE REFLECTION MODE */
//throw new Exception('Cannot cast response to entity object. Missing property ' . $name .' in entity ' . $entityClassName);
continue;
}
}
}
return $entity;
} | [
"protected",
"function",
"CastResponseToEntity",
"(",
"$",
"response",
",",
"$",
"entityClassName",
",",
"$",
"asDependentObject",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"response",
")",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";... | Cast response object to entity object
@param object $response Object from API response
@param string $entityClassName Name of entity class to cast
@return \MangoPay\$entityClassName Return entity object | [
"Cast",
"response",
"object",
"to",
"entity",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L346-L426 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/ApiBase.php | ApiBase.BuildRequestData | protected function BuildRequestData($entity)
{
if (is_a($entity, 'MangoPay\UboDeclaration')) {
$declaredUboIds = [];
foreach ($entity->DeclaredUBOs as $declaredUBO) {
if (is_string($declaredUBO)) {
array_push($declaredUboIds, $declaredUBO);
} else {
array_push($declaredUboIds, $declaredUBO->UserId);
}
}
$entity->DeclaredUBOs = $declaredUboIds;
}
$entityProperties = get_object_vars($entity);
$blackList = $entity->GetReadOnlyProperties();
$requestData = array();
foreach ($entityProperties as $propertyName => $propertyValue) {
if (in_array($propertyName, $blackList)) {
continue;
}
if ($this->CanReadSubRequestData($entity, $propertyName)) {
$subRequestData = $this->BuildRequestData($propertyValue);
foreach ($subRequestData as $key => $value) {
$requestData[$key] = $value;
}
} else {
if (isset($propertyValue)) {
$requestData[$propertyName] = $propertyValue;
}
}
}
if (count($requestData) == 0) {
return new \stdClass();
}
return $requestData;
} | php | protected function BuildRequestData($entity)
{
if (is_a($entity, 'MangoPay\UboDeclaration')) {
$declaredUboIds = [];
foreach ($entity->DeclaredUBOs as $declaredUBO) {
if (is_string($declaredUBO)) {
array_push($declaredUboIds, $declaredUBO);
} else {
array_push($declaredUboIds, $declaredUBO->UserId);
}
}
$entity->DeclaredUBOs = $declaredUboIds;
}
$entityProperties = get_object_vars($entity);
$blackList = $entity->GetReadOnlyProperties();
$requestData = array();
foreach ($entityProperties as $propertyName => $propertyValue) {
if (in_array($propertyName, $blackList)) {
continue;
}
if ($this->CanReadSubRequestData($entity, $propertyName)) {
$subRequestData = $this->BuildRequestData($propertyValue);
foreach ($subRequestData as $key => $value) {
$requestData[$key] = $value;
}
} else {
if (isset($propertyValue)) {
$requestData[$propertyName] = $propertyValue;
}
}
}
if (count($requestData) == 0) {
return new \stdClass();
}
return $requestData;
} | [
"protected",
"function",
"BuildRequestData",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"entity",
",",
"'MangoPay\\UboDeclaration'",
")",
")",
"{",
"$",
"declaredUboIds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entity",
"->",
"DeclaredUBO... | Get array with request data
@param object $entity Entity object to send as request data
@return array | [
"Get",
"array",
"with",
"request",
"data"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/ApiBase.php#L433-L471 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiResponses.php | ApiResponses.Get | public function Get($idempotencyKey)
{
$response = $this->GetObject('responses_get', $idempotencyKey, 'MangoPay\Response');
$className = $this->GetObjectForIdempotencyUrl($response->RequestURL);
if (is_null($className) || empty($className) || is_null($response->Resource) || empty($response->Resource))
return $response;
$response->Resource = $this->CastResponseToEntity($response->Resource, $className);
return $response;
} | php | public function Get($idempotencyKey)
{
$response = $this->GetObject('responses_get', $idempotencyKey, 'MangoPay\Response');
$className = $this->GetObjectForIdempotencyUrl($response->RequestURL);
if (is_null($className) || empty($className) || is_null($response->Resource) || empty($response->Resource))
return $response;
$response->Resource = $this->CastResponseToEntity($response->Resource, $className);
return $response;
} | [
"public",
"function",
"Get",
"(",
"$",
"idempotencyKey",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"GetObject",
"(",
"'responses_get'",
",",
"$",
"idempotencyKey",
",",
"'MangoPay\\Response'",
")",
";",
"$",
"className",
"=",
"$",
"this",
"->",
"G... | Get response from previous call by idempotency key
@param string $idempotencyKey Idempotency key
@return \MangoPay\Response Entity of Response object | [
"Get",
"response",
"from",
"previous",
"call",
"by",
"idempotency",
"key"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiResponses.php#L15-L24 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiPayOuts.php | ApiPayOuts.Create | public function Create($payOut, $idempotencyKey = null)
{
$paymentKey = $this->GetPaymentKey($payOut);
return $this->CreateObject('payouts_' . $paymentKey . '_create', $payOut, '\MangoPay\PayOut', null, null, $idempotencyKey);
} | php | public function Create($payOut, $idempotencyKey = null)
{
$paymentKey = $this->GetPaymentKey($payOut);
return $this->CreateObject('payouts_' . $paymentKey . '_create', $payOut, '\MangoPay\PayOut', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"payOut",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"paymentKey",
"=",
"$",
"this",
"->",
"GetPaymentKey",
"(",
"$",
"payOut",
")",
";",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'payouts_'... | Create new pay-out
@param PayOut $payOut
@return \MangoPay\PayOut Object returned from API | [
"Create",
"new",
"pay",
"-",
"out"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiPayOuts.php#L14-L18 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiPayOuts.php | ApiPayOuts.GetRefunds | public function GetRefunds($payOutId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_payout', $pagination, '\MangoPay\Refund', $payOutId, $filter, $sorting);
} | php | public function GetRefunds($payOutId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_payout', $pagination, '\MangoPay\Refund', $payOutId, $filter, $sorting);
} | [
"public",
"function",
"GetRefunds",
"(",
"$",
"payOutId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'refunds_get_for_payout'",
",",... | Returns a list of Refunds pertaining to a certain PayOut.
@param string $payOutId ID of the PayOut for which to retrieve Refunds
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterRefunds filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Refund[] List of Refunds for the PayOut | [
"Returns",
"a",
"list",
"of",
"Refunds",
"pertaining",
"to",
"a",
"certain",
"PayOut",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiPayOuts.php#L38-L41 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiCards.php | ApiCards.GetByFingerprint | public function GetByFingerprint($fingerprint, & $pagination = null, $sorting = null)
{
return $this->GetList('cards_get_by_fingerprint', $pagination, '\MangoPay\Card', $fingerprint, null, $sorting);
} | php | public function GetByFingerprint($fingerprint, & $pagination = null, $sorting = null)
{
return $this->GetList('cards_get_by_fingerprint', $pagination, '\MangoPay\Card', $fingerprint, null, $sorting);
} | [
"public",
"function",
"GetByFingerprint",
"(",
"$",
"fingerprint",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'cards_get_by_fingerprint'",
",",
"$",
"pagination",
",",
... | Gets a list of cards having the same fingerprint.
The fingerprint is a hash uniquely generated per 16-digit card number.
@param string $fingerprint The fingerprint hash
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Card[] List of Cards corresponding to provided fingerprint | [
"Gets",
"a",
"list",
"of",
"cards",
"having",
"the",
"same",
"fingerprint",
".",
"The",
"fingerprint",
"is",
"a",
"hash",
"uniquely",
"generated",
"per",
"16",
"-",
"digit",
"card",
"number",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiCards.php#L29-L32 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiCards.php | ApiCards.GetPreAuthorizations | public function GetPreAuthorizations($cardId, $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList("preauthorizations_get_for_card", $pagination, '\MangoPay\CardPreAuthorization', $cardId, $filter, $sorting);
} | php | public function GetPreAuthorizations($cardId, $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList("preauthorizations_get_for_card", $pagination, '\MangoPay\CardPreAuthorization', $cardId, $filter, $sorting);
} | [
"public",
"function",
"GetPreAuthorizations",
"(",
"$",
"cardId",
",",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"\"preauthorizations_get_for_card... | Gets a Card's PreAuthorizations
@param int $cardId ID of the Card for which to retrieve PreAuthorizations
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterPreAuthorizations filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\CardPreAuthorization[] List of the Card's PreAuthorizations | [
"Gets",
"a",
"Card",
"s",
"PreAuthorizations"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiCards.php#L52-L55 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiCards.php | ApiCards.GetTransactions | public function GetTransactions($cardId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_card', $pagination, '\MangoPay\Transaction', $cardId, $filter, $sorting);
} | php | public function GetTransactions($cardId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_card', $pagination, '\MangoPay\Transaction', $cardId, $filter, $sorting);
} | [
"public",
"function",
"GetTransactions",
"(",
"$",
"cardId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'transactions_get_for_card'",
... | Retrieves a list of Transactions pertaining to a certain Card
@param string $cardId Card identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterTransactions $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Transaction[] | [
"Retrieves",
"a",
"list",
"of",
"Transactions",
"pertaining",
"to",
"a",
"certain",
"Card"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiCards.php#L65-L68 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiRepudiations.php | ApiRepudiations.GetRefunds | public function GetRefunds($repudiationId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_repudiation', $pagination, '\MangoPay\Repudiation', $repudiationId, $filter, $sorting);
} | php | public function GetRefunds($repudiationId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_repudiation', $pagination, '\MangoPay\Repudiation', $repudiationId, $filter, $sorting);
} | [
"public",
"function",
"GetRefunds",
"(",
"$",
"repudiationId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'refunds_get_for_repudiation... | Retrieves a list of Refunds pertaining to a certain Repudiation
@param string $repudiationId Repudiation identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterRefunds $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Refund[] | [
"Retrieves",
"a",
"list",
"of",
"Refunds",
"pertaining",
"to",
"a",
"certain",
"Repudiation"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiRepudiations.php#L26-L29 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/DefaultStorageStrategy.php | DefaultStorageStrategy.Get | public function Get()
{
$filename = $this->GetPathToFile();
if (!file_exists($filename)) {
return null;
}
$data = file_get_contents($filename);
if ($data === false) {
return null;
}
$serialized = str_replace($this->_prefixContent, '', $data);
return unserialize($serialized);
} | php | public function Get()
{
$filename = $this->GetPathToFile();
if (!file_exists($filename)) {
return null;
}
$data = file_get_contents($filename);
if ($data === false) {
return null;
}
$serialized = str_replace($this->_prefixContent, '', $data);
return unserialize($serialized);
} | [
"public",
"function",
"Get",
"(",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"GetPathToFile",
"(",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"data",
"=",
"file_get_contents"... | Gets the current authorization token.
@return \MangoPay\Libraries\OAuthToken Currently stored token instance or null. | [
"Gets",
"the",
"current",
"authorization",
"token",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/DefaultStorageStrategy.php#L22-L36 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/DefaultStorageStrategy.php | DefaultStorageStrategy.Store | public function Store($token)
{
if (!is_writable($this->GetPathToTemporaryFolder())) {
throw new \MangoPay\Libraries\Exception('Cannot create or write to file ' . $this->GetPathToTemporaryFolder());
}
$serialized = serialize($token);
$result = file_put_contents($this->GetPathToFile(), $this->_prefixContent . $serialized, LOCK_EX);
if ($result === false) {
throw new \MangoPay\Libraries\Exception('Cannot put token to file');
}
} | php | public function Store($token)
{
if (!is_writable($this->GetPathToTemporaryFolder())) {
throw new \MangoPay\Libraries\Exception('Cannot create or write to file ' . $this->GetPathToTemporaryFolder());
}
$serialized = serialize($token);
$result = file_put_contents($this->GetPathToFile(), $this->_prefixContent . $serialized, LOCK_EX);
if ($result === false) {
throw new \MangoPay\Libraries\Exception('Cannot put token to file');
}
} | [
"public",
"function",
"Store",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"this",
"->",
"GetPathToTemporaryFolder",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"MangoPay",
"\\",
"Libraries",
"\\",
"Exception",
"(",
"'Cannot ... | Stores authorization token passed as an argument.
@param \MangoPay\Libraries\OAuthToken $token Token instance to be stored. | [
"Stores",
"authorization",
"token",
"passed",
"as",
"an",
"argument",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/DefaultStorageStrategy.php#L42-L53 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/DefaultStorageStrategy.php | DefaultStorageStrategy.GetPathToTemporaryFolder | private function GetPathToTemporaryFolder()
{
if (is_null($this->_config->TemporaryFolder)) {
throw new \MangoPay\Libraries\Exception('Path to temporary folder is not defined');
}
return $this->_config->TemporaryFolder;
} | php | private function GetPathToTemporaryFolder()
{
if (is_null($this->_config->TemporaryFolder)) {
throw new \MangoPay\Libraries\Exception('Path to temporary folder is not defined');
}
return $this->_config->TemporaryFolder;
} | [
"private",
"function",
"GetPathToTemporaryFolder",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_config",
"->",
"TemporaryFolder",
")",
")",
"{",
"throw",
"new",
"\\",
"MangoPay",
"\\",
"Libraries",
"\\",
"Exception",
"(",
"'Path to temporary ... | Get path to temporary folder
@return string | [
"Get",
"path",
"to",
"temporary",
"folder"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/DefaultStorageStrategy.php#L68-L75 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiKycDocuments.php | ApiKycDocuments.CreateKycDocumentConsult | public function CreateKycDocumentConsult($kycDocumentId, & $pagination = null)
{
return $this->GetList('kyc_documents_create_consult', $pagination, '\MangoPay\DocumentPageConsult', $kycDocumentId, null, null);
} | php | public function CreateKycDocumentConsult($kycDocumentId, & $pagination = null)
{
return $this->GetList('kyc_documents_create_consult', $pagination, '\MangoPay\DocumentPageConsult', $kycDocumentId, null, null);
} | [
"public",
"function",
"CreateKycDocumentConsult",
"(",
"$",
"kycDocumentId",
",",
"&",
"$",
"pagination",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'kyc_documents_create_consult'",
",",
"$",
"pagination",
",",
"'\\MangoPay\\DocumentPageCon... | Creates temporary URLs where each page of a KYC document can be viewed.
@param string $kycDocumentId Identification of the document whose pages to view
@param \MangoPay\Pagination $pagination Pagination object
@return \MangoPay\DocumentPageConsult[] Array of consults for viewing the KYC document's pages
@throws Libraries\Exception | [
"Creates",
"temporary",
"URLs",
"where",
"each",
"page",
"of",
"a",
"KYC",
"document",
"can",
"be",
"viewed",
"."
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiKycDocuments.php#L40-L43 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiTransfers.php | ApiTransfers.CreateRefund | public function CreateRefund($transferId, $refund, $idempotencyKey = null)
{
return $this->CreateObject('transfers_createrefunds', $refund, '\MangoPay\Refund', $transferId, null, $idempotencyKey);
} | php | public function CreateRefund($transferId, $refund, $idempotencyKey = null)
{
return $this->CreateObject('transfers_createrefunds', $refund, '\MangoPay\Refund', $transferId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateRefund",
"(",
"$",
"transferId",
",",
"$",
"refund",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'transfers_createrefunds'",
",",
"$",
"refund",
",",
"'\\MangoPay\\Refund'",
... | Create refund for transfer object
@param string $transferId Transfer identifier
@param \MangoPay\Refund $refund Refund object to create
@return \MangoPay\Refund Object returned by REST API | [
"Create",
"refund",
"for",
"transfer",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiTransfers.php#L35-L38 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiTransfers.php | ApiTransfers.GetRefunds | public function GetRefunds($transferId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_transfer', $pagination, '\MangoPay\Refund', $transferId, $filter, $sorting);
} | php | public function GetRefunds($transferId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_transfer', $pagination, '\MangoPay\Refund', $transferId, $filter, $sorting);
} | [
"public",
"function",
"GetRefunds",
"(",
"$",
"transferId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'refunds_get_for_transfer'",
... | Retrieve list of Refunds pertaining to a certain Transfer
@param string $transferId Transfer identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterRefunds $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Refund[] List of the Transfer's Refunds | [
"Retrieve",
"list",
"of",
"Refunds",
"pertaining",
"to",
"a",
"certain",
"Transfer"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiTransfers.php#L48-L51 | train |
Mangopay/mangopay2-php-sdk | MangoPay/CardRegistration.php | CardRegistration.GetReadOnlyProperties | public function GetReadOnlyProperties()
{
$properties = parent::GetReadOnlyProperties();
array_push($properties, 'AccessKey');
array_push($properties, 'PreregistrationData');
array_push($properties, 'CardRegistrationURL');
array_push($properties, 'CardId');
array_push($properties, 'ResultCode');
array_push($properties, 'ResultMessage');
array_push($properties, 'Status');
return $properties;
} | php | public function GetReadOnlyProperties()
{
$properties = parent::GetReadOnlyProperties();
array_push($properties, 'AccessKey');
array_push($properties, 'PreregistrationData');
array_push($properties, 'CardRegistrationURL');
array_push($properties, 'CardId');
array_push($properties, 'ResultCode');
array_push($properties, 'ResultMessage');
array_push($properties, 'Status');
return $properties;
} | [
"public",
"function",
"GetReadOnlyProperties",
"(",
")",
"{",
"$",
"properties",
"=",
"parent",
"::",
"GetReadOnlyProperties",
"(",
")",
";",
"array_push",
"(",
"$",
"properties",
",",
"'AccessKey'",
")",
";",
"array_push",
"(",
"$",
"properties",
",",
"'Prere... | Get array with read-only properties
@return array | [
"Get",
"array",
"with",
"read",
"-",
"only",
"properties"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/CardRegistration.php#L80-L91 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/AuthenticationHelper.php | AuthenticationHelper.GetHttpHeaderBasicKey | public function GetHttpHeaderBasicKey()
{
if (is_null($this->_root->Config->ClientId) || strlen($this->_root->Config->ClientId) == 0) {
throw new Exception('MangoPayApi.Config.ClientId is not set.');
}
if (is_null($this->_root->Config->ClientPassword) || strlen($this->_root->Config->ClientPassword) == 0) {
throw new Exception('MangoPayApi.Config.ClientPassword is not set.');
}
$signature = $this->_root->Config->ClientId . ':' . $this->_root->Config->ClientPassword;
return base64_encode($signature);
} | php | public function GetHttpHeaderBasicKey()
{
if (is_null($this->_root->Config->ClientId) || strlen($this->_root->Config->ClientId) == 0) {
throw new Exception('MangoPayApi.Config.ClientId is not set.');
}
if (is_null($this->_root->Config->ClientPassword) || strlen($this->_root->Config->ClientPassword) == 0) {
throw new Exception('MangoPayApi.Config.ClientPassword is not set.');
}
$signature = $this->_root->Config->ClientId . ':' . $this->_root->Config->ClientPassword;
return base64_encode($signature);
} | [
"public",
"function",
"GetHttpHeaderBasicKey",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_root",
"->",
"Config",
"->",
"ClientId",
")",
"||",
"strlen",
"(",
"$",
"this",
"->",
"_root",
"->",
"Config",
"->",
"ClientId",
")",
"==",
"0... | Get basic key for HTTP header
@return string
@throws \MangoPay\Libraries\Exception If MangoPay_ClientId or MangoPay_ClientPassword is not defined | [
"Get",
"basic",
"key",
"for",
"HTTP",
"header"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/AuthenticationHelper.php#L35-L47 | train |
Mangopay/mangopay2-php-sdk | MangoPay/Libraries/AuthenticationHelper.php | AuthenticationHelper.GetHttpHeaderStrong | private function GetHttpHeaderStrong()
{
$token = $this->_root->OAuthTokenManager->GetToken($this->GetAutenticationKey());
if (is_null($token) || !isset($token->access_token) || !isset($token->token_type)) {
throw new Exception('OAuth token is not created (or is invalid) for strong authentication');
}
return 'Authorization: ' . $token->token_type . ' ' . $token->access_token;
} | php | private function GetHttpHeaderStrong()
{
$token = $this->_root->OAuthTokenManager->GetToken($this->GetAutenticationKey());
if (is_null($token) || !isset($token->access_token) || !isset($token->token_type)) {
throw new Exception('OAuth token is not created (or is invalid) for strong authentication');
}
return 'Authorization: ' . $token->token_type . ' ' . $token->access_token;
} | [
"private",
"function",
"GetHttpHeaderStrong",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"_root",
"->",
"OAuthTokenManager",
"->",
"GetToken",
"(",
"$",
"this",
"->",
"GetAutenticationKey",
"(",
")",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"t... | Get HTTP header value with authorization string for strong authentication
@return string Value for HTTP header with authentication string
@throws \MangoPay\Libraries\Exception If OAuth token is not created (or is invalid) for strong authentication. | [
"Get",
"HTTP",
"header",
"value",
"with",
"authorization",
"string",
"for",
"strong",
"authentication"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/Libraries/AuthenticationHelper.php#L81-L90 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiPayIns.php | ApiPayIns.Create | public function Create($payIn, $idempotencyKey = null)
{
$paymentKey = $this->GetPaymentKey($payIn);
$executionKey = $this->GetExecutionKey($payIn);
return $this->CreateObject('payins_' . $paymentKey . '-' . $executionKey . '_create', $payIn, '\MangoPay\PayIn', null, null, $idempotencyKey);
} | php | public function Create($payIn, $idempotencyKey = null)
{
$paymentKey = $this->GetPaymentKey($payIn);
$executionKey = $this->GetExecutionKey($payIn);
return $this->CreateObject('payins_' . $paymentKey . '-' . $executionKey . '_create', $payIn, '\MangoPay\PayIn', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"payIn",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"paymentKey",
"=",
"$",
"this",
"->",
"GetPaymentKey",
"(",
"$",
"payIn",
")",
";",
"$",
"executionKey",
"=",
"$",
"this",
"->",
"GetExecutionKey",... | Create new pay-in object
@param \MangoPay\PayIn $payIn \MangoPay\PayIn object
@return \MangoPay\PayIn Object returned from API | [
"Create",
"new",
"pay",
"-",
"in",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiPayIns.php#L14-L19 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiPayIns.php | ApiPayIns.CreateRefund | public function CreateRefund($payInId, $refund, $idempotencyKey = null)
{
return $this->CreateObject('payins_createrefunds', $refund, '\MangoPay\Refund', $payInId, null, $idempotencyKey);
} | php | public function CreateRefund($payInId, $refund, $idempotencyKey = null)
{
return $this->CreateObject('payins_createrefunds', $refund, '\MangoPay\Refund', $payInId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateRefund",
"(",
"$",
"payInId",
",",
"$",
"refund",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'payins_createrefunds'",
",",
"$",
"refund",
",",
"'\\MangoPay\\Refund'",
",",
... | Create refund for pay-in object
@param string $payInId Pay-in identifier
@param \MangoPay\Refund $refund Refund object to create
@return \MangoPay\Refund Object returned by REST API | [
"Create",
"refund",
"for",
"pay",
"-",
"in",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiPayIns.php#L37-L40 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiPayIns.php | ApiPayIns.GetRefunds | public function GetRefunds($payInId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_payin', $pagination, '\MangoPay\Refund', $payInId, $filter, $sorting);
} | php | public function GetRefunds($payInId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('refunds_get_for_payin', $pagination, '\MangoPay\Refund', $payInId, $filter, $sorting);
} | [
"public",
"function",
"GetRefunds",
"(",
"$",
"payInId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'refunds_get_for_payin'",
",",
... | Retrieves a list of Refunds pertaining to a certain PayIn
@param string $payInId ID of PayIn for which to retrieve Refunds
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterRefunds $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Refund[] List of the PayIn's Refunds | [
"Retrieves",
"a",
"list",
"of",
"Refunds",
"pertaining",
"to",
"a",
"certain",
"PayIn"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiPayIns.php#L50-L53 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiCardRegistrations.php | ApiCardRegistrations.Create | public function Create($cardRegistration, $idempotencyKey = null)
{
return $this->CreateObject('cardregistration_create', $cardRegistration, '\MangoPay\CardRegistration', null, null, $idempotencyKey);
} | php | public function Create($cardRegistration, $idempotencyKey = null)
{
return $this->CreateObject('cardregistration_create', $cardRegistration, '\MangoPay\CardRegistration', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"cardRegistration",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'cardregistration_create'",
",",
"$",
"cardRegistration",
",",
"'\\MangoPay\\CardRegistration'",
",",
... | Create new card registration
@param \MangoPay\CardRegistration $cardRegistration Card registration object to create
@return \MangoPay\CardRegistration Card registration object returned from API | [
"Create",
"new",
"card",
"registration"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiCardRegistrations.php#L14-L17 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiMandates.php | ApiMandates.Create | public function Create($mandate, $idempotencyKey = null)
{
return $this->CreateObject('mandates_create', $mandate, '\MangoPay\Mandate', null, null, $idempotencyKey);
} | php | public function Create($mandate, $idempotencyKey = null)
{
return $this->CreateObject('mandates_create', $mandate, '\MangoPay\Mandate', null, null, $idempotencyKey);
} | [
"public",
"function",
"Create",
"(",
"$",
"mandate",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'mandates_create'",
",",
"$",
"mandate",
",",
"'\\MangoPay\\Mandate'",
",",
"null",
",",
"null",
",",
... | Create new mandate
@param Mandate $mandate
@return \MangoPay\Mandate Mandate object returned from API | [
"Create",
"new",
"mandate"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiMandates.php#L14-L17 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiMandates.php | ApiMandates.GetTransactions | public function GetTransactions($mandateId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_mandate', $pagination, '\MangoPay\Transaction', $mandateId, $filter, $sorting);
} | php | public function GetTransactions($mandateId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('transactions_get_for_mandate', $pagination, '\MangoPay\Transaction', $mandateId, $filter, $sorting);
} | [
"public",
"function",
"GetTransactions",
"(",
"$",
"mandateId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'transactions_get_for_manda... | Retrieves list of Transactions pertaining to a certain Mandate
@param string $mandateId Mandate identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterTransactions $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\Transaction[] | [
"Retrieves",
"list",
"of",
"Transactions",
"pertaining",
"to",
"a",
"certain",
"Mandate"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiMandates.php#L62-L65 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiClients.php | ApiClients.UploadLogo | public function UploadLogo($logoUpload, $idempotencyKey = null)
{
try {
$this->CreateObject('client_upload_logo', $logoUpload, null, null, null, $idempotencyKey);
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
}
}
} | php | public function UploadLogo($logoUpload, $idempotencyKey = null)
{
try {
$this->CreateObject('client_upload_logo', $logoUpload, null, null, null, $idempotencyKey);
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
}
}
} | [
"public",
"function",
"UploadLogo",
"(",
"$",
"logoUpload",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"CreateObject",
"(",
"'client_upload_logo'",
",",
"$",
"logoUpload",
",",
"null",
",",
"null",
",",
"null",
",",
... | Upload a logo for client.
Only GIF, PNG, JPG, JPEG, BMP, PDF and DOC formats are accepted,
and file must be less than about 7MB
@param \MangoPay\ClientLogoUpload $logo ClientLogoUpload object | [
"Upload",
"a",
"logo",
"for",
"client",
".",
"Only",
"GIF",
"PNG",
"JPG",
"JPEG",
"BMP",
"PDF",
"and",
"DOC",
"formats",
"are",
"accepted",
"and",
"file",
"must",
"be",
"less",
"than",
"about",
"7MB"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiClients.php#L41-L50 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiClients.php | ApiClients.UploadLogoFromFile | public function UploadLogoFromFile($file, $idempotencyKey = null)
{
$filePath = $file;
if (is_array($file)) {
$filePath = $file['tmp_name'];
}
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$logoUpload = new \MangoPay\ClientLogoUpload();
$logoUpload->File = base64_encode(file_get_contents($filePath));
if (empty($logoUpload->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
$this->UploadLogo($logoUpload, $idempotencyKey);
} | php | public function UploadLogoFromFile($file, $idempotencyKey = null)
{
$filePath = $file;
if (is_array($file)) {
$filePath = $file['tmp_name'];
}
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$logoUpload = new \MangoPay\ClientLogoUpload();
$logoUpload->File = base64_encode(file_get_contents($filePath));
if (empty($logoUpload->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
$this->UploadLogo($logoUpload, $idempotencyKey);
} | [
"public",
"function",
"UploadLogoFromFile",
"(",
"$",
"file",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"filePath",
"=",
"$",
"file",
";",
"if",
"(",
"is_array",
"(",
"$",
"file",
")",
")",
"{",
"$",
"filePath",
"=",
"$",
"file",
"[",
... | Upload a logo for client from file.
Only GIF, PNG, JPG, JPEG, BMP, PDF and DOC formats are accepted,
and file must be less than about 7MB
@param string $file Path of file with logo
@throws \MangoPay\Libraries\Exception | [
"Upload",
"a",
"logo",
"for",
"client",
"from",
"file",
".",
"Only",
"GIF",
"PNG",
"JPG",
"JPEG",
"BMP",
"PDF",
"and",
"DOC",
"formats",
"are",
"accepted",
"and",
"file",
"must",
"be",
"less",
"than",
"about",
"7MB"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiClients.php#L59-L82 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiWallets.php | ApiWallets.GetTransactions | public function GetTransactions($walletId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('wallets_alltransactions', $pagination, '\MangoPay\Transaction', $walletId, $filter, $sorting);
} | php | public function GetTransactions($walletId, & $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('wallets_alltransactions', $pagination, '\MangoPay\Transaction', $walletId, $filter, $sorting);
} | [
"public",
"function",
"GetTransactions",
"(",
"$",
"walletId",
",",
"&",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'wallets_alltransactions'",
... | Get transactions for the wallet
@param string $walletId Wallet identifier
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterTransactions $filter Object to filter data
@param \MangoPay\Sorting $sorting Object to sorting data
@return \MangoPay\Transaction[] Transactions for wallet returned from API | [
"Get",
"transactions",
"for",
"the",
"wallet"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiWallets.php#L47-L50 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.CreateBankAccount | public function CreateBankAccount($userId, $bankAccount, $idempotencyKey = null)
{
$type = $this->GetBankAccountType($bankAccount);
return $this->CreateObject('users_createbankaccounts_' . $type, $bankAccount, '\MangoPay\BankAccount', $userId, null, $idempotencyKey);
} | php | public function CreateBankAccount($userId, $bankAccount, $idempotencyKey = null)
{
$type = $this->GetBankAccountType($bankAccount);
return $this->CreateObject('users_createbankaccounts_' . $type, $bankAccount, '\MangoPay\BankAccount', $userId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateBankAccount",
"(",
"$",
"userId",
",",
"$",
"bankAccount",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"GetBankAccountType",
"(",
"$",
"bankAccount",
")",
";",
"return",
"$",
"this",
... | Create bank account for user
@param string $userId User Id
@param \MangoPay\BankAccount $bankAccount Entity of bank account object
@return \MangoPay\BankAccount Create bank account object | [
"Create",
"bank",
"account",
"for",
"user"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L125-L129 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.CreateKycDocument | public function CreateKycDocument($userId, $kycDocument, $idempotencyKey = null)
{
return $this->CreateObject('kyc_documents_create', $kycDocument, '\MangoPay\KycDocument', $userId, null, $idempotencyKey);
} | php | public function CreateKycDocument($userId, $kycDocument, $idempotencyKey = null)
{
return $this->CreateObject('kyc_documents_create', $kycDocument, '\MangoPay\KycDocument', $userId, null, $idempotencyKey);
} | [
"public",
"function",
"CreateKycDocument",
"(",
"$",
"userId",
",",
"$",
"kycDocument",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"CreateObject",
"(",
"'kyc_documents_create'",
",",
"$",
"kycDocument",
",",
"'\\MangoPay\\Kyc... | Create new KYC document
@param string $userId User Id
@param \MangoPay\KycDocument $kycDocument
@param string $idempotencyKey Key for response replication
@return \MangoPay\KycDocument Document returned from API | [
"Create",
"new",
"KYC",
"document"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L215-L218 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.CreateKycPage | public function CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey = null)
{
$uploaded = false;
try {
$response = $this->CreateObject('kyc_page_create', $kycPage, null, $userId, $kycDocumentId, $idempotencyKey);
$uploaded = true;
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
} else {
$uploaded = true;
}
}
return $uploaded;
} | php | public function CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey = null)
{
$uploaded = false;
try {
$response = $this->CreateObject('kyc_page_create', $kycPage, null, $userId, $kycDocumentId, $idempotencyKey);
$uploaded = true;
} catch (\MangoPay\Libraries\ResponseException $exc) {
if ($exc->getCode() != 204) {
throw $exc;
} else {
$uploaded = true;
}
}
return $uploaded;
} | [
"public",
"function",
"CreateKycPage",
"(",
"$",
"userId",
",",
"$",
"kycDocumentId",
",",
"$",
"kycPage",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"$",
"uploaded",
"=",
"false",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"Crea... | Create page for Kyc document
@param string $userId User Id
@param string $kycDocumentId KYC Document Id
@param \MangoPay\KycPage $kycPage KYC Page
@return bool `true` if the upload was successful, `false` otherwise
@throws \MangoPay\Libraries\Exception | [
"Create",
"page",
"for",
"Kyc",
"document"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L293-L307 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.CreateKycPageFromFile | public function CreateKycPageFromFile($userId, $kycDocumentId, $filePath, $idempotencyKey = null)
{
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$kycPage = new \MangoPay\KycPage();
$kycPage->File = base64_encode(file_get_contents($filePath));
if (empty($kycPage->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
return $this->CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey);
} | php | public function CreateKycPageFromFile($userId, $kycDocumentId, $filePath, $idempotencyKey = null)
{
if (empty($filePath)) {
throw new \MangoPay\Libraries\Exception('Path of file cannot be empty');
}
if (!file_exists($filePath)) {
throw new \MangoPay\Libraries\Exception('File not exist');
}
$kycPage = new \MangoPay\KycPage();
$kycPage->File = base64_encode(file_get_contents($filePath));
if (empty($kycPage->File)) {
throw new \MangoPay\Libraries\Exception('Content of the file cannot be empty');
}
return $this->CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey);
} | [
"public",
"function",
"CreateKycPageFromFile",
"(",
"$",
"userId",
",",
"$",
"kycDocumentId",
",",
"$",
"filePath",
",",
"$",
"idempotencyKey",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"\\",
"MangoPa... | Create page for Kyc document from file
@param string $userId User Id
@param int $kycDocumentId KYC Document Id
@param string $filePath File path
@return bool `true` if the upload was successful, `false` otherwise
@throws \MangoPay\Libraries\Exception | [
"Create",
"page",
"for",
"Kyc",
"document",
"from",
"file"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L317-L335 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.GetPreAuthorizations | public function GetPreAuthorizations($userId, $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('preauthorizations_get_for_user', $pagination, '\MangoPay\CardPreAuthorization', $userId, $filter, $sorting);
} | php | public function GetPreAuthorizations($userId, $pagination = null, $filter = null, $sorting = null)
{
return $this->GetList('preauthorizations_get_for_user', $pagination, '\MangoPay\CardPreAuthorization', $userId, $filter, $sorting);
} | [
"public",
"function",
"GetPreAuthorizations",
"(",
"$",
"userId",
",",
"$",
"pagination",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"sorting",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetList",
"(",
"'preauthorizations_get_for_user'... | Gets a list with PreAuthorizations belonging to a specific user
@param string $userId ID of the user whose PreAuthorizations to retrieve
@param \MangoPay\Pagination $pagination Pagination object
@param \MangoPay\FilterPreAuthorizations $filter Filtering object
@param \MangoPay\Sorting $sorting Sorting object
@return \MangoPay\CardPreAuthorization[] The user's PreAuthorizations | [
"Gets",
"a",
"list",
"with",
"PreAuthorizations",
"belonging",
"to",
"a",
"specific",
"user"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L367-L370 | train |
Mangopay/mangopay2-php-sdk | MangoPay/ApiUsers.php | ApiUsers.GetUserResponse | private function GetUserResponse($response)
{
if (isset($response->PersonType)) {
switch ($response->PersonType) {
case PersonType::Natural:
return $this->CastResponseToEntity($response, '\MangoPay\UserNatural');
case PersonType::Legal:
return $this->CastResponseToEntity($response, '\MangoPay\UserLegal');
default:
throw new Libraries\Exception('Unexpected response. Wrong PersonType value');
}
} else {
throw new Libraries\Exception('Unexpected response. Missing PersonType property');
}
} | php | private function GetUserResponse($response)
{
if (isset($response->PersonType)) {
switch ($response->PersonType) {
case PersonType::Natural:
return $this->CastResponseToEntity($response, '\MangoPay\UserNatural');
case PersonType::Legal:
return $this->CastResponseToEntity($response, '\MangoPay\UserLegal');
default:
throw new Libraries\Exception('Unexpected response. Wrong PersonType value');
}
} else {
throw new Libraries\Exception('Unexpected response. Missing PersonType property');
}
} | [
"private",
"function",
"GetUserResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"PersonType",
")",
")",
"{",
"switch",
"(",
"$",
"response",
"->",
"PersonType",
")",
"{",
"case",
"PersonType",
"::",
"Natural",
":... | Get correct user object
@param object $response Response from API
@return UserLegal|UserNatural User object returned from API
@throws \MangoPay\Libraries\Exception If occur unexpected response from API | [
"Get",
"correct",
"user",
"object"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/ApiUsers.php#L378-L392 | train |
Mangopay/mangopay2-php-sdk | MangoPay/PayIn.php | PayIn.GetDependsObjects | public function GetDependsObjects()
{
return array(
'PaymentType' => array(
'_property_name' => 'PaymentDetails',
PayInPaymentType::Card => '\MangoPay\PayInPaymentDetailsCard',
PayInPaymentType::Preauthorized => '\MangoPay\PayInPaymentDetailsPreAuthorized',
PayInPaymentType::BankWire => '\MangoPay\PayInPaymentDetailsBankWire',
PayInPaymentType::DirectDebit => '\MangoPay\PayInPaymentDetailsDirectDebit',
PayInPaymentType::DirectDebitDirect => '\MangoPay\PayInPaymentDetailsDirectDebitDirect',
PayInPaymentType::PayPal => '\MangoPay\PayInPaymentDetailsPaypal',
// ...and more in future...
),
'ExecutionType' => array(
'_property_name' => 'ExecutionDetails',
PayInExecutionType::Web => '\MangoPay\PayInExecutionDetailsWeb',
PayInExecutionType::Direct => '\MangoPay\PayInExecutionDetailsDirect',
PayInExecutionType::ExternalInstruction => '\MangoPay\PayInExecutionDetailsExternalInstruction',
// ...and more in future...
)
);
} | php | public function GetDependsObjects()
{
return array(
'PaymentType' => array(
'_property_name' => 'PaymentDetails',
PayInPaymentType::Card => '\MangoPay\PayInPaymentDetailsCard',
PayInPaymentType::Preauthorized => '\MangoPay\PayInPaymentDetailsPreAuthorized',
PayInPaymentType::BankWire => '\MangoPay\PayInPaymentDetailsBankWire',
PayInPaymentType::DirectDebit => '\MangoPay\PayInPaymentDetailsDirectDebit',
PayInPaymentType::DirectDebitDirect => '\MangoPay\PayInPaymentDetailsDirectDebitDirect',
PayInPaymentType::PayPal => '\MangoPay\PayInPaymentDetailsPaypal',
// ...and more in future...
),
'ExecutionType' => array(
'_property_name' => 'ExecutionDetails',
PayInExecutionType::Web => '\MangoPay\PayInExecutionDetailsWeb',
PayInExecutionType::Direct => '\MangoPay\PayInExecutionDetailsDirect',
PayInExecutionType::ExternalInstruction => '\MangoPay\PayInExecutionDetailsExternalInstruction',
// ...and more in future...
)
);
} | [
"public",
"function",
"GetDependsObjects",
"(",
")",
"{",
"return",
"array",
"(",
"'PaymentType'",
"=>",
"array",
"(",
"'_property_name'",
"=>",
"'PaymentDetails'",
",",
"PayInPaymentType",
"::",
"Card",
"=>",
"'\\MangoPay\\PayInPaymentDetailsCard'",
",",
"PayInPaymentT... | Get array with mapping which property depends on other property
@return array | [
"Get",
"array",
"with",
"mapping",
"which",
"property",
"depends",
"on",
"other",
"property"
] | 4955b6ffa0251754c52ce6ce14bc43a19dada200 | https://github.com/Mangopay/mangopay2-php-sdk/blob/4955b6ffa0251754c52ce6ce14bc43a19dada200/MangoPay/PayIn.php#L43-L64 | train |
yiisoft/log | src/Target.php | Target.filterMessages | public static function filterMessages($messages, array $levels = [], array $categories = [], array $except = []): array
{
foreach ($messages as $i => $message) {
if (!empty($levels) && !in_array($message[0], $levels, true)) {
unset($messages[$i]);
continue;
}
$matched = empty($categories);
foreach ($categories as $category) {
if ($message[2]['category'] === $category || !empty($category) && substr_compare($category, '*', -1, 1) === 0 && strpos($message[2]['category'], rtrim($category, '*')) === 0) {
$matched = true;
break;
}
}
if ($matched) {
foreach ($except as $category) {
$prefix = rtrim($category, '*');
if (($message[2]['category'] === $category || $prefix !== $category) && strpos($message[2]['category'], $prefix) === 0) {
$matched = false;
break;
}
}
}
if (!$matched) {
unset($messages[$i]);
}
}
return $messages;
} | php | public static function filterMessages($messages, array $levels = [], array $categories = [], array $except = []): array
{
foreach ($messages as $i => $message) {
if (!empty($levels) && !in_array($message[0], $levels, true)) {
unset($messages[$i]);
continue;
}
$matched = empty($categories);
foreach ($categories as $category) {
if ($message[2]['category'] === $category || !empty($category) && substr_compare($category, '*', -1, 1) === 0 && strpos($message[2]['category'], rtrim($category, '*')) === 0) {
$matched = true;
break;
}
}
if ($matched) {
foreach ($except as $category) {
$prefix = rtrim($category, '*');
if (($message[2]['category'] === $category || $prefix !== $category) && strpos($message[2]['category'], $prefix) === 0) {
$matched = false;
break;
}
}
}
if (!$matched) {
unset($messages[$i]);
}
}
return $messages;
} | [
"public",
"static",
"function",
"filterMessages",
"(",
"$",
"messages",
",",
"array",
"$",
"levels",
"=",
"[",
"]",
",",
"array",
"$",
"categories",
"=",
"[",
"]",
",",
"array",
"$",
"except",
"=",
"[",
"]",
")",
":",
"array",
"{",
"foreach",
"(",
... | Filters the given messages according to their categories and levels.
@param array $messages messages to be filtered.
The message structure follows that in [[Logger::messages]].
@param array $levels the message levels to filter by. Empty value means allowing all levels.
@param array $categories the message categories to filter by. If empty, it means all categories are allowed.
@param array $except the message categories to exclude. If empty, it means all categories are allowed.
@return array the filtered messages. | [
"Filters",
"the",
"given",
"messages",
"according",
"to",
"their",
"categories",
"and",
"levels",
"."
] | 29bb5daf6e7d70b68569d64528b6557cbfe1d88b | https://github.com/yiisoft/log/blob/29bb5daf6e7d70b68569d64528b6557cbfe1d88b/src/Target.php#L171-L203 | train |
yiisoft/log | src/Logger.php | Logger.prepareMessage | public static function prepareMessage($message)
{
if (method_exists($message, '__toString')) {
return $message->__toString();
}
if (is_scalar($message)) {
return (string)$message;
}
if (class_exists(VarDumper::class)) {
return VarDumper::export($message);
}
throw new InvalidArgumentException('The log message MUST be a string or object implementing __toString()');
} | php | public static function prepareMessage($message)
{
if (method_exists($message, '__toString')) {
return $message->__toString();
}
if (is_scalar($message)) {
return (string)$message;
}
if (class_exists(VarDumper::class)) {
return VarDumper::export($message);
}
throw new InvalidArgumentException('The log message MUST be a string or object implementing __toString()');
} | [
"public",
"static",
"function",
"prepareMessage",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"message",
",",
"'__toString'",
")",
")",
"{",
"return",
"$",
"message",
"->",
"__toString",
"(",
")",
";",
"}",
"if",
"(",
"is_scalar"... | Prepares message for logging. | [
"Prepares",
"message",
"for",
"logging",
"."
] | 29bb5daf6e7d70b68569d64528b6557cbfe1d88b | https://github.com/yiisoft/log/blob/29bb5daf6e7d70b68569d64528b6557cbfe1d88b/src/Logger.php#L149-L164 | train |
yiisoft/log | src/Logger.php | Logger.flush | public function flush(bool $final = false): void
{
$messages = $this->messages;
// https://github.com/yiisoft/yii2/issues/5619
// new messages could be logged while the existing ones are being handled by targets
$this->messages = [];
$this->dispatch($messages, $final);
} | php | public function flush(bool $final = false): void
{
$messages = $this->messages;
// https://github.com/yiisoft/yii2/issues/5619
// new messages could be logged while the existing ones are being handled by targets
$this->messages = [];
$this->dispatch($messages, $final);
} | [
"public",
"function",
"flush",
"(",
"bool",
"$",
"final",
"=",
"false",
")",
":",
"void",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"messages",
";",
"// https://github.com/yiisoft/yii2/issues/5619",
"// new messages could be logged while the existing ones are being ha... | Flushes log messages from memory to targets.
@param bool $final whether this is a final call during a request. | [
"Flushes",
"log",
"messages",
"from",
"memory",
"to",
"targets",
"."
] | 29bb5daf6e7d70b68569d64528b6557cbfe1d88b | https://github.com/yiisoft/log/blob/29bb5daf6e7d70b68569d64528b6557cbfe1d88b/src/Logger.php#L223-L231 | train |
imalhasaranga/PDFLib | src/PDFLib.php | PDFLib.setPageRange | public function setPageRange($start, $end){
$this->page_start = $start;
$this->page_end = $end;
return $this;
} | php | public function setPageRange($start, $end){
$this->page_start = $start;
$this->page_end = $end;
return $this;
} | [
"public",
"function",
"setPageRange",
"(",
"$",
"start",
",",
"$",
"end",
")",
"{",
"$",
"this",
"->",
"page_start",
"=",
"$",
"start",
";",
"$",
"this",
"->",
"page_end",
"=",
"$",
"end",
";",
"return",
"$",
"this",
";",
"}"
] | Set a start and end page to process.
@param integer $start
@param integer $end
@return self | [
"Set",
"a",
"start",
"and",
"end",
"page",
"to",
"process",
"."
] | 894527b25bcf41295d7744002cd6422031267662 | https://github.com/imalhasaranga/PDFLib/blob/894527b25bcf41295d7744002cd6422031267662/src/PDFLib.php#L106-L110 | train |
imalhasaranga/PDFLib | src/PDFLib.php | PDFLib.setImageFormat | public function setImageFormat($imageformat,$pngScaleFactor = null){
if($imageformat == self::$IMAGE_FORMAT_JPEG){
$this->imageDeviceCommand = "jpeg";
$this->imageExtention="jpg";
$this->pngDownScaleFactor = isset($pngScaleFactor) ? "-dDownScaleFactor=".$pngScaleFactor : "";
}else if($imageformat == self::$IMAGE_FORMAT_PNG){
$this->imageDeviceCommand = "png16m";
$this->imageExtention="png";
$this->pngDownScaleFactor = "";
}
return $this;
} | php | public function setImageFormat($imageformat,$pngScaleFactor = null){
if($imageformat == self::$IMAGE_FORMAT_JPEG){
$this->imageDeviceCommand = "jpeg";
$this->imageExtention="jpg";
$this->pngDownScaleFactor = isset($pngScaleFactor) ? "-dDownScaleFactor=".$pngScaleFactor : "";
}else if($imageformat == self::$IMAGE_FORMAT_PNG){
$this->imageDeviceCommand = "png16m";
$this->imageExtention="png";
$this->pngDownScaleFactor = "";
}
return $this;
} | [
"public",
"function",
"setImageFormat",
"(",
"$",
"imageformat",
",",
"$",
"pngScaleFactor",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"imageformat",
"==",
"self",
"::",
"$",
"IMAGE_FORMAT_JPEG",
")",
"{",
"$",
"this",
"->",
"imageDeviceCommand",
"=",
"\"jpeg\"... | Change the image format to PNG or JPEG
@param string $imageformat
@param float $pngScaleFactor
@return self | [
"Change",
"the",
"image",
"format",
"to",
"PNG",
"or",
"JPEG"
] | 894527b25bcf41295d7744002cd6422031267662 | https://github.com/imalhasaranga/PDFLib/blob/894527b25bcf41295d7744002cd6422031267662/src/PDFLib.php#L138-L149 | train |
yiimaker/yii2-social-share | src/widgets/SocialShare.php | SocialShare.getLinkLabel | protected function getLinkLabel($driverConfig, $defaultLabel)
{
return $this->isIconsEnabled()
? Html::tag('i', '', ['class' => $this->configurator->getIconSelector($driverConfig['class'])])
: (isset($driverConfig['label']) ? $driverConfig['label'] : $defaultLabel);
} | php | protected function getLinkLabel($driverConfig, $defaultLabel)
{
return $this->isIconsEnabled()
? Html::tag('i', '', ['class' => $this->configurator->getIconSelector($driverConfig['class'])])
: (isset($driverConfig['label']) ? $driverConfig['label'] : $defaultLabel);
} | [
"protected",
"function",
"getLinkLabel",
"(",
"$",
"driverConfig",
",",
"$",
"defaultLabel",
")",
"{",
"return",
"$",
"this",
"->",
"isIconsEnabled",
"(",
")",
"?",
"Html",
"::",
"tag",
"(",
"'i'",
",",
"''",
",",
"[",
"'class'",
"=>",
"$",
"this",
"->... | Build label for driver.
@param array $driverConfig
@param string $defaultLabel
@return string | [
"Build",
"label",
"for",
"driver",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/widgets/SocialShare.php#L177-L182 | train |
yiimaker/yii2-social-share | src/widgets/SocialShare.php | SocialShare.createDriver | private function createDriver($config)
{
$fullConfig = ArrayHelper::merge(
[
'class' => $config['class'],
'url' => $this->url,
'title' => $this->title,
'description' => $this->description,
'imageUrl' => $this->imageUrl,
'registerMetaTags' => $this->registerMetaTags(),
],
isset($config['config']) ? $config['config'] : [],
isset($this->driverProperties[$config['class']]) ? $this->driverProperties[$config['class']] : []
);
return Yii::createObject($fullConfig);
} | php | private function createDriver($config)
{
$fullConfig = ArrayHelper::merge(
[
'class' => $config['class'],
'url' => $this->url,
'title' => $this->title,
'description' => $this->description,
'imageUrl' => $this->imageUrl,
'registerMetaTags' => $this->registerMetaTags(),
],
isset($config['config']) ? $config['config'] : [],
isset($this->driverProperties[$config['class']]) ? $this->driverProperties[$config['class']] : []
);
return Yii::createObject($fullConfig);
} | [
"private",
"function",
"createDriver",
"(",
"$",
"config",
")",
"{",
"$",
"fullConfig",
"=",
"ArrayHelper",
"::",
"merge",
"(",
"[",
"'class'",
"=>",
"$",
"config",
"[",
"'class'",
"]",
",",
"'url'",
"=>",
"$",
"this",
"->",
"url",
",",
"'title'",
"=>"... | Creates driver instance.
@param array $config Configuration for driver.
@return \ymaker\social\share\base\AbstractDriver
@throws \yii\base\InvalidConfigException | [
"Creates",
"driver",
"instance",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/widgets/SocialShare.php#L193-L209 | train |
yiimaker/yii2-social-share | src/widgets/SocialShare.php | SocialShare.combineOptions | private function combineOptions($driverConfig)
{
$options = isset($driverConfig['options']) ? $driverConfig['options'] : [];
$globalOptions = $this->configurator->getOptions();
if (empty($globalOptions)) {
return $options;
}
if (isset($options['class'])) {
Html::addCssClass($globalOptions, $options['class']);
unset($options['class']);
}
return ArrayHelper::merge($globalOptions, $options);
} | php | private function combineOptions($driverConfig)
{
$options = isset($driverConfig['options']) ? $driverConfig['options'] : [];
$globalOptions = $this->configurator->getOptions();
if (empty($globalOptions)) {
return $options;
}
if (isset($options['class'])) {
Html::addCssClass($globalOptions, $options['class']);
unset($options['class']);
}
return ArrayHelper::merge($globalOptions, $options);
} | [
"private",
"function",
"combineOptions",
"(",
"$",
"driverConfig",
")",
"{",
"$",
"options",
"=",
"isset",
"(",
"$",
"driverConfig",
"[",
"'options'",
"]",
")",
"?",
"$",
"driverConfig",
"[",
"'options'",
"]",
":",
"[",
"]",
";",
"$",
"globalOptions",
"=... | Combine global and custom HTML options.
@param array $driverConfig
@return array | [
"Combine",
"global",
"and",
"custom",
"HTML",
"options",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/widgets/SocialShare.php#L218-L234 | train |
yiimaker/yii2-social-share | src/base/AbstractDriver.php | AbstractDriver.encodeData | public static function encodeData($data)
{
if (\is_array($data)) {
foreach ($data as $key => $value) {
$data[$key] = \urlencode($value);
}
return $data;
}
return \urlencode($data);
} | php | public static function encodeData($data)
{
if (\is_array($data)) {
foreach ($data as $key => $value) {
$data[$key] = \urlencode($value);
}
return $data;
}
return \urlencode($data);
} | [
"public",
"static",
"function",
"encodeData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"$",
"key",
"... | Encode data for URL.
@param array|string $data
@return array|string | [
"Encode",
"data",
"for",
"URL",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/base/AbstractDriver.php#L90-L101 | train |
yiimaker/yii2-social-share | src/base/AbstractDriver.php | AbstractDriver.decodeData | public static function decodeData($data)
{
if (\is_array($data)) {
foreach ($data as $key => $value) {
$data[$key] = \urldecode($value);
}
return $data;
}
return \urldecode($data);
} | php | public static function decodeData($data)
{
if (\is_array($data)) {
foreach ($data as $key => $value) {
$data[$key] = \urldecode($value);
}
return $data;
}
return \urldecode($data);
} | [
"public",
"static",
"function",
"decodeData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"$",
"key",
"... | Decode the encoded data.
@param array|string $data
@return array|string | [
"Decode",
"the",
"encoded",
"data",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/base/AbstractDriver.php#L110-L121 | train |
yiimaker/yii2-social-share | src/base/AbstractDriver.php | AbstractDriver.appendToData | public function appendToData($key, $value, $urlEncode = true)
{
$key = '{' . $key . '}';
$this->_data[$key] = $urlEncode ? static::encodeData($value) : $value;
} | php | public function appendToData($key, $value, $urlEncode = true)
{
$key = '{' . $key . '}';
$this->_data[$key] = $urlEncode ? static::encodeData($value) : $value;
} | [
"public",
"function",
"appendToData",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"urlEncode",
"=",
"true",
")",
"{",
"$",
"key",
"=",
"'{'",
".",
"$",
"key",
".",
"'}'",
";",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
"=",
"$",
"urlEn... | Append value to data array.
@param string $key
@param string $value
@param bool $urlEncode
@since 2.0 | [
"Append",
"value",
"to",
"data",
"array",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/base/AbstractDriver.php#L182-L186 | train |
yiimaker/yii2-social-share | src/base/AbstractDriver.php | AbstractDriver.init | public function init()
{
$this->processShareData();
$this->_data = ArrayHelper::merge([
'{url}' => $this->url,
'{title}' => $this->title,
'{description}' => $this->description,
'{imageUrl}' => $this->imageUrl,
], $this->_data);
$metaTags = $this->getMetaTags();
if ($this->registerMetaTags && !empty($metaTags)) {
$rawData = static::decodeData($this->_data);
$view = Yii::$app->getView();
foreach ($metaTags as $metaTag) {
$metaTag['content'] = \strtr($metaTag['content'], $rawData);
$view->registerMetaTag($metaTag, \md5(\implode(';', $metaTag)));
}
}
} | php | public function init()
{
$this->processShareData();
$this->_data = ArrayHelper::merge([
'{url}' => $this->url,
'{title}' => $this->title,
'{description}' => $this->description,
'{imageUrl}' => $this->imageUrl,
], $this->_data);
$metaTags = $this->getMetaTags();
if ($this->registerMetaTags && !empty($metaTags)) {
$rawData = static::decodeData($this->_data);
$view = Yii::$app->getView();
foreach ($metaTags as $metaTag) {
$metaTag['content'] = \strtr($metaTag['content'], $rawData);
$view->registerMetaTag($metaTag, \md5(\implode(';', $metaTag)));
}
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"processShareData",
"(",
")",
";",
"$",
"this",
"->",
"_data",
"=",
"ArrayHelper",
"::",
"merge",
"(",
"[",
"'{url}'",
"=>",
"$",
"this",
"->",
"url",
",",
"'{title}'",
"=>",
"$",
"this"... | Prepare data data to insert into the link. | [
"Prepare",
"data",
"data",
"to",
"insert",
"into",
"the",
"link",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/base/AbstractDriver.php#L191-L213 | train |
yiimaker/yii2-social-share | src/base/AbstractDriver.php | AbstractDriver.addUrlParam | final protected function addUrlParam(&$link, $name, $value)
{
$base = $name . '=' . $value;
if (false !== \strpos($link, '?')) {
$last = \substr($link, -1);
if ('?' === $last || '&' === $last) {
$link .= $base;
} else {
$link .= '&' . $base;
}
} else {
$link .= '?' . $base;
}
} | php | final protected function addUrlParam(&$link, $name, $value)
{
$base = $name . '=' . $value;
if (false !== \strpos($link, '?')) {
$last = \substr($link, -1);
if ('?' === $last || '&' === $last) {
$link .= $base;
} else {
$link .= '&' . $base;
}
} else {
$link .= '?' . $base;
}
} | [
"final",
"protected",
"function",
"addUrlParam",
"(",
"&",
"$",
"link",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"base",
"=",
"$",
"name",
".",
"'='",
".",
"$",
"value",
";",
"if",
"(",
"false",
"!==",
"\\",
"strpos",
"(",
"$",
"link",... | Adds URL param to link.
@param string $link
@param string $name Param name.
@param string $value Param value.
@since 1.4.0 | [
"Adds",
"URL",
"param",
"to",
"link",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/base/AbstractDriver.php#L234-L249 | train |
yiimaker/yii2-social-share | src/configurators/Configurator.php | Configurator.init | public function init()
{
if ($this->isSeoEnabled() && empty($this->seoOptions)) {
$this->seoOptions = [
'target' => '_blank',
'rel' => 'noopener',
];
}
if ($this->enableIcons || $this->enableDefaultIcons) {
$this->icons = ArrayHelper::merge(self::DEFAULT_ICONS_MAP, $this->icons);
}
} | php | public function init()
{
if ($this->isSeoEnabled() && empty($this->seoOptions)) {
$this->seoOptions = [
'target' => '_blank',
'rel' => 'noopener',
];
}
if ($this->enableIcons || $this->enableDefaultIcons) {
$this->icons = ArrayHelper::merge(self::DEFAULT_ICONS_MAP, $this->icons);
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSeoEnabled",
"(",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"seoOptions",
")",
")",
"{",
"$",
"this",
"->",
"seoOptions",
"=",
"[",
"'target'",
"=>",
"'_blank'",
",",
"... | Set default values for special link options. | [
"Set",
"default",
"values",
"for",
"special",
"link",
"options",
"."
] | b88ae113c6f51903f64bf0d594cd4fca46885280 | https://github.com/yiimaker/yii2-social-share/blob/b88ae113c6f51903f64bf0d594cd4fca46885280/src/configurators/Configurator.php#L117-L129 | train |
joomla/coding-standards | Joomla/Sniffs/Commenting/FunctionCommentSniff.php | Joomla_Sniffs_Commenting_FunctionCommentSniff.paramCommentsAlign | private function paramCommentsAlign($param, $previousParam)
{
$paramLength = strlen($param['type']) + $param['type_space'] + strlen($param['var']) + $param['var_space'];
$prevLength = strlen($previousParam['type']) + $previousParam['type_space'] + strlen($previousParam['var']) + $previousParam['var_space'];
return $paramLength === $prevLength;
} | php | private function paramCommentsAlign($param, $previousParam)
{
$paramLength = strlen($param['type']) + $param['type_space'] + strlen($param['var']) + $param['var_space'];
$prevLength = strlen($previousParam['type']) + $previousParam['type_space'] + strlen($previousParam['var']) + $previousParam['var_space'];
return $paramLength === $prevLength;
} | [
"private",
"function",
"paramCommentsAlign",
"(",
"$",
"param",
",",
"$",
"previousParam",
")",
"{",
"$",
"paramLength",
"=",
"strlen",
"(",
"$",
"param",
"[",
"'type'",
"]",
")",
"+",
"$",
"param",
"[",
"'type_space'",
"]",
"+",
"strlen",
"(",
"$",
"p... | Ensure the method's parameter comments align
@param array $param The current parameter being checked
@param array $previousParam The previous parameter that was checked
@return boolean | [
"Ensure",
"the",
"method",
"s",
"parameter",
"comments",
"align"
] | 8a70e4dd303b6b89165986a3cecccde094a71c30 | https://github.com/joomla/coding-standards/blob/8a70e4dd303b6b89165986a3cecccde094a71c30/Joomla/Sniffs/Commenting/FunctionCommentSniff.php#L491-L497 | train |
joomla/coding-standards | Joomla/Sniffs/Commenting/FunctionCommentSniff.php | Joomla_Sniffs_Commenting_FunctionCommentSniff.paramVarsAlign | private function paramVarsAlign($param, $previousParam)
{
$paramStringLength = strlen($param['type']) + $param['type_space'];
$previousParamStringLength = strlen($previousParam['type']) + $previousParam['type_space'];
return $paramStringLength === $previousParamStringLength;
} | php | private function paramVarsAlign($param, $previousParam)
{
$paramStringLength = strlen($param['type']) + $param['type_space'];
$previousParamStringLength = strlen($previousParam['type']) + $previousParam['type_space'];
return $paramStringLength === $previousParamStringLength;
} | [
"private",
"function",
"paramVarsAlign",
"(",
"$",
"param",
",",
"$",
"previousParam",
")",
"{",
"$",
"paramStringLength",
"=",
"strlen",
"(",
"$",
"param",
"[",
"'type'",
"]",
")",
"+",
"$",
"param",
"[",
"'type_space'",
"]",
";",
"$",
"previousParamStrin... | Ensure the method's parameter variable names align
@param array $param The current parameter being checked
@param array $previousParam The previous parameter that was checked
@return boolean | [
"Ensure",
"the",
"method",
"s",
"parameter",
"variable",
"names",
"align"
] | 8a70e4dd303b6b89165986a3cecccde094a71c30 | https://github.com/joomla/coding-standards/blob/8a70e4dd303b6b89165986a3cecccde094a71c30/Joomla/Sniffs/Commenting/FunctionCommentSniff.php#L507-L513 | train |
joomla/coding-standards | Joomla/Sniffs/Commenting/FileCommentSniff.php | Joomla_Sniffs_Commenting_FileCommentSniff.processSubpackage | protected function processSubpackage(PHP_CodeSniffer_File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
foreach ($tags as $tag)
{
if ($tokens[($tag + 2)]['code'] !== T_DOC_COMMENT_STRING)
{
// No content.
continue;
}
$content = $tokens[($tag + 2)]['content'];
// Is the subpackage included and empty.
if (empty($content) || $content == '')
{
$error = 'if included, @subpackage tag must contain a name';
$phpcsFile->addError($error, $tag, 'EmptySubpackage');
}
}//end foreach
} | php | protected function processSubpackage(PHP_CodeSniffer_File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
foreach ($tags as $tag)
{
if ($tokens[($tag + 2)]['code'] !== T_DOC_COMMENT_STRING)
{
// No content.
continue;
}
$content = $tokens[($tag + 2)]['content'];
// Is the subpackage included and empty.
if (empty($content) || $content == '')
{
$error = 'if included, @subpackage tag must contain a name';
$phpcsFile->addError($error, $tag, 'EmptySubpackage');
}
}//end foreach
} | [
"protected",
"function",
"processSubpackage",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"array",
"$",
"tags",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"tag",
")",
... | Process the subpackage tag.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param array $tags The tokens for these tags.
@return void | [
"Process",
"the",
"subpackage",
"tag",
"."
] | 8a70e4dd303b6b89165986a3cecccde094a71c30 | https://github.com/joomla/coding-standards/blob/8a70e4dd303b6b89165986a3cecccde094a71c30/Joomla/Sniffs/Commenting/FileCommentSniff.php#L447-L468 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.