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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wirecardBrasil/moip-sdk-php | src/Resource/MoipResource.php | MoipResource.getByPath | public function getByPath($path, $headers = [])
{
$response = $this->httpRequest($path, Requests::GET, null, $headers);
if (is_array($response)) {
$response = (object) $response;
}
return $this->populate($response);
} | php | public function getByPath($path, $headers = [])
{
$response = $this->httpRequest($path, Requests::GET, null, $headers);
if (is_array($response)) {
$response = (object) $response;
}
return $this->populate($response);
} | [
"public",
"function",
"getByPath",
"(",
"$",
"path",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpRequest",
"(",
"$",
"path",
",",
"Requests",
"::",
"GET",
",",
"null",
",",
"$",
"headers",
")",
";",
... | Find by path.
@param string $path resource path
@param array $headers request headers
@return stdClass | [
"Find",
"by",
"path",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/MoipResource.php#L273-L282 | train |
wirecardBrasil/moip-sdk-php | src/Resource/MoipResource.php | MoipResource.createResource | public function createResource($path)
{
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | php | public function createResource($path)
{
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | [
"public",
"function",
"createResource",
"(",
"$",
"path",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpRequest",
"(",
"$",
"path",
",",
"Requests",
"::",
"POST",
",",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"populate",
"(",
"$"... | Create a new item in Moip.
@param string $path
@return stdClass | [
"Create",
"a",
"new",
"item",
"in",
"Moip",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/MoipResource.php#L303-L308 | train |
wirecardBrasil/moip-sdk-php | src/Resource/MoipResource.php | MoipResource.updateByPath | public function updateByPath($path)
{
$response = $this->httpRequest($path, Requests::PUT, $this);
return $this->populate($response);
} | php | public function updateByPath($path)
{
$response = $this->httpRequest($path, Requests::PUT, $this);
return $this->populate($response);
} | [
"public",
"function",
"updateByPath",
"(",
"$",
"path",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpRequest",
"(",
"$",
"path",
",",
"Requests",
"::",
"PUT",
",",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"populate",
"(",
"$",
... | Update an item in Moip.
@param string $path
@return stdClass | [
"Update",
"an",
"item",
"in",
"Moip",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/MoipResource.php#L317-L322 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Transfers.php | Transfers.setTransfers | public function setTransfers(
$amount,
$bankNumber,
$agencyNumber,
$agencyCheckNumber,
$accountNumber,
$accountCheckNumber
) {
$this->data->amount = $amount;
$this->data->transferInstrument->method = self::METHOD;
$this->data->transferInstrument->bankAccount->type = self::TYPE;
$this->data->transferInstrument->bankAccount->bankNumber = $bankNumber;
$this->data->transferInstrument->bankAccount->agencyNumber = $agencyNumber;
$this->data->transferInstrument->bankAccount->agencyCheckNumber = $agencyCheckNumber;
$this->data->transferInstrument->bankAccount->accountNumber = $accountNumber;
$this->data->transferInstrument->bankAccount->accountCheckNumber = $accountCheckNumber;
return $this;
} | php | public function setTransfers(
$amount,
$bankNumber,
$agencyNumber,
$agencyCheckNumber,
$accountNumber,
$accountCheckNumber
) {
$this->data->amount = $amount;
$this->data->transferInstrument->method = self::METHOD;
$this->data->transferInstrument->bankAccount->type = self::TYPE;
$this->data->transferInstrument->bankAccount->bankNumber = $bankNumber;
$this->data->transferInstrument->bankAccount->agencyNumber = $agencyNumber;
$this->data->transferInstrument->bankAccount->agencyCheckNumber = $agencyCheckNumber;
$this->data->transferInstrument->bankAccount->accountNumber = $accountNumber;
$this->data->transferInstrument->bankAccount->accountCheckNumber = $accountCheckNumber;
return $this;
} | [
"public",
"function",
"setTransfers",
"(",
"$",
"amount",
",",
"$",
"bankNumber",
",",
"$",
"agencyNumber",
",",
"$",
"agencyCheckNumber",
",",
"$",
"accountNumber",
",",
"$",
"accountCheckNumber",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"amount",
"=",
... | Set info of transfers.
@param int $amount
@param string $bankNumber Bank number. possible values: 001, 237, 341, 041.
@param int $agencyNumber
@param int $agencyCheckNumber
@param int $accountNumber
@param int $accountCheckNumber
@return $this | [
"Set",
"info",
"of",
"transfers",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Transfers.php#L98-L116 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Transfers.php | Transfers.setTransfersToBankAccount | public function setTransfersToBankAccount($amount, $bankAccountId)
{
$this->data->amount = $amount;
$this->data->transferInstrument->method = self::METHOD;
$this->data->transferInstrument->bankAccount->id = $bankAccountId;
return $this;
} | php | public function setTransfersToBankAccount($amount, $bankAccountId)
{
$this->data->amount = $amount;
$this->data->transferInstrument->method = self::METHOD;
$this->data->transferInstrument->bankAccount->id = $bankAccountId;
return $this;
} | [
"public",
"function",
"setTransfersToBankAccount",
"(",
"$",
"amount",
",",
"$",
"bankAccountId",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"amount",
"=",
"$",
"amount",
";",
"$",
"this",
"->",
"data",
"->",
"transferInstrument",
"->",
"method",
"=",
"sel... | Set info of transfers to a saved bank account.
@param int $amount Amount
@param string $bankAccountId Saved bank account id.
@return $this | [
"Set",
"info",
"of",
"transfers",
"to",
"a",
"saved",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Transfers.php#L126-L133 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Transfers.php | Transfers.setHolder | public function setHolder($fullname, $taxDocument)
{
$this->data->transferInstrument->bankAccount->holder->fullname = $fullname;
$this->data->transferInstrument->bankAccount->holder->taxDocument->type = self::TYPE_HOLD;
$this->data->transferInstrument->bankAccount->holder->taxDocument->number = $taxDocument;
return $this;
} | php | public function setHolder($fullname, $taxDocument)
{
$this->data->transferInstrument->bankAccount->holder->fullname = $fullname;
$this->data->transferInstrument->bankAccount->holder->taxDocument->type = self::TYPE_HOLD;
$this->data->transferInstrument->bankAccount->holder->taxDocument->number = $taxDocument;
return $this;
} | [
"public",
"function",
"setHolder",
"(",
"$",
"fullname",
",",
"$",
"taxDocument",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"transferInstrument",
"->",
"bankAccount",
"->",
"holder",
"->",
"fullname",
"=",
"$",
"fullname",
";",
"$",
"this",
"->",
"data",
... | Set info of holder.
@param string $fullname
@param int $taxDocument
@return $this | [
"Set",
"info",
"of",
"holder",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Transfers.php#L167-L174 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Transfers.php | Transfers.get | public function get($id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id));
} | php | public function get($id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id));
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"getByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"id",
")",
")",
";",
"}"
] | Get a Transfer.
@param string $id Transfer id.
@return stdClass | [
"Get",
"a",
"Transfer",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Transfers.php#L223-L226 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Transfers.php | Transfers.getList | public function getList(Pagination $pagination = null, Filters $filters = null, $qParam = '')
{
$transfersList = new TransfersList($this->moip);
return $transfersList->get($pagination, $filters, $qParam);
} | php | public function getList(Pagination $pagination = null, Filters $filters = null, $qParam = '')
{
$transfersList = new TransfersList($this->moip);
return $transfersList->get($pagination, $filters, $qParam);
} | [
"public",
"function",
"getList",
"(",
"Pagination",
"$",
"pagination",
"=",
"null",
",",
"Filters",
"$",
"filters",
"=",
"null",
",",
"$",
"qParam",
"=",
"''",
")",
"{",
"$",
"transfersList",
"=",
"new",
"TransfersList",
"(",
"$",
"this",
"->",
"moip",
... | Create a new Transfers list instance.
@return \Moip\Resource\TransfersList | [
"Create",
"a",
"new",
"Transfers",
"list",
"instance",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Transfers.php#L233-L238 | train |
wirecardBrasil/moip-sdk-php | src/Exceptions/Error.php | Error.parseErrors | public static function parseErrors($json_string)
{
$error_obj = json_decode($json_string);
$errors = [];
if (!empty($error_obj->errors)) {
foreach ($error_obj->errors as $error) {
$errors[] = new self($error->code, $error->path, $error->description);
}
} elseif (!empty($error_obj->error)) {
$errors[] = new self('', '', $error_obj->error);
}
return $errors;
} | php | public static function parseErrors($json_string)
{
$error_obj = json_decode($json_string);
$errors = [];
if (!empty($error_obj->errors)) {
foreach ($error_obj->errors as $error) {
$errors[] = new self($error->code, $error->path, $error->description);
}
} elseif (!empty($error_obj->error)) {
$errors[] = new self('', '', $error_obj->error);
}
return $errors;
} | [
"public",
"static",
"function",
"parseErrors",
"(",
"$",
"json_string",
")",
"{",
"$",
"error_obj",
"=",
"json_decode",
"(",
"$",
"json_string",
")",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"error_obj",
"->",
"errors"... | Creates an Error array from a json string.
@param string $json_string string returned by the Moip API
@return array | [
"Creates",
"an",
"Error",
"array",
"from",
"a",
"json",
"string",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Exceptions/Error.php#L85-L98 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.execute | public function execute()
{
if ($this->order !== null) {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Orders::PATH, $this->order->getId(), self::PATH);
} else {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Multiorders::PATH, $this->multiorder->getId(), self::MULTI_PAYMENTS_PATH);
}
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | php | public function execute()
{
if ($this->order !== null) {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Orders::PATH, $this->order->getId(), self::PATH);
} else {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Multiorders::PATH, $this->multiorder->getId(), self::MULTI_PAYMENTS_PATH);
}
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"order",
"!==",
"null",
")",
"{",
"$",
"path",
"=",
"sprintf",
"(",
"'/%s/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"Orders",
"::",
"PATH",
",",
"$",
"this",
"... | Create a new payment in api MoIP.
@return $this | [
"Create",
"a",
"new",
"payment",
"in",
"api",
"MoIP",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L133-L144 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.get | public function get($id_moip)
{
if ($this->isMultipayment($id_moip)) {
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::MULTI_PAYMENTS_PATH, $id_moip));
}
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id_moip));
} | php | public function get($id_moip)
{
if ($this->isMultipayment($id_moip)) {
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::MULTI_PAYMENTS_PATH, $id_moip));
}
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id_moip));
} | [
"public",
"function",
"get",
"(",
"$",
"id_moip",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isMultipayment",
"(",
"$",
"id_moip",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s'",
",",
"MoipResource",
"::",
"VE... | Get an payment and multipayment in MoIP.
@param string $id_moip Id MoIP payment
@return stdClass | [
"Get",
"an",
"payment",
"and",
"multipayment",
"in",
"MoIP",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L153-L160 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.populate | protected function populate(stdClass $response)
{
$payment = clone $this;
$payment->data->id = $this->getIfSet('id', $response);
$payment->data->status = $this->getIfSet('status', $response);
$payment->data->delayCapture = $this->getIfSet('delayCapture', $response);
$payment->data->amount = new stdClass();
$payment->data->amount->total = $this->getIfSet('total', $response->amount);
$payment->data->amount->currency = $this->getIfSet('currency', $response->amount);
$payment->data->installmentCount = $this->getIfSet('installmentCount', $response);
$payment->data->fundingInstrument = $this->getIfSet('fundingInstrument', $response);
$payment->data->payments = $this->getIfSet('payments', $response);
$payment->data->escrows = $this->getIfSet('escrows', $response);
$payment->data->fees = $this->getIfSet('fees', $response);
$payment->data->refunds = $this->getIfSet('refunds', $response);
$payment->data->_links = $this->getIfSet('_links', $response);
$payment->data->createdAt = $this->getIfSetDateTime('createdAt', $response);
$payment->data->updatedAt = $this->getIfSetDateTime('updatedAt', $response);
return $payment;
} | php | protected function populate(stdClass $response)
{
$payment = clone $this;
$payment->data->id = $this->getIfSet('id', $response);
$payment->data->status = $this->getIfSet('status', $response);
$payment->data->delayCapture = $this->getIfSet('delayCapture', $response);
$payment->data->amount = new stdClass();
$payment->data->amount->total = $this->getIfSet('total', $response->amount);
$payment->data->amount->currency = $this->getIfSet('currency', $response->amount);
$payment->data->installmentCount = $this->getIfSet('installmentCount', $response);
$payment->data->fundingInstrument = $this->getIfSet('fundingInstrument', $response);
$payment->data->payments = $this->getIfSet('payments', $response);
$payment->data->escrows = $this->getIfSet('escrows', $response);
$payment->data->fees = $this->getIfSet('fees', $response);
$payment->data->refunds = $this->getIfSet('refunds', $response);
$payment->data->_links = $this->getIfSet('_links', $response);
$payment->data->createdAt = $this->getIfSetDateTime('createdAt', $response);
$payment->data->updatedAt = $this->getIfSetDateTime('updatedAt', $response);
return $payment;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"payment",
"=",
"clone",
"$",
"this",
";",
"$",
"payment",
"->",
"data",
"->",
"id",
"=",
"$",
"this",
"->",
"getIfSet",
"(",
"'id'",
",",
"$",
"response",
")",
";"... | Mount payment structure.
@param \stdClass $response
@return Payment | [
"Mount",
"payment",
"structure",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L180-L201 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setBoleto | public function setBoleto($expirationDate, $logoUri, array $instructionLines = [])
{
$keys = ['first', 'second', 'third'];
if (empty($instructionLines)) {
//Avoid warning in array_combine
$instructionLines = ['', '', ''];
}
if ($expirationDate instanceof \DateTime) {
$expirationDate = $expirationDate->format('Y-m-d');
}
$this->data->fundingInstrument->method = self::METHOD_BOLETO;
$this->data->fundingInstrument->boleto = new stdClass();
$this->data->fundingInstrument->boleto->expirationDate = $expirationDate;
$this->data->fundingInstrument->boleto->instructionLines = array_combine($keys, $instructionLines);
$this->data->fundingInstrument->boleto->logoUri = $logoUri;
return $this;
} | php | public function setBoleto($expirationDate, $logoUri, array $instructionLines = [])
{
$keys = ['first', 'second', 'third'];
if (empty($instructionLines)) {
//Avoid warning in array_combine
$instructionLines = ['', '', ''];
}
if ($expirationDate instanceof \DateTime) {
$expirationDate = $expirationDate->format('Y-m-d');
}
$this->data->fundingInstrument->method = self::METHOD_BOLETO;
$this->data->fundingInstrument->boleto = new stdClass();
$this->data->fundingInstrument->boleto->expirationDate = $expirationDate;
$this->data->fundingInstrument->boleto->instructionLines = array_combine($keys, $instructionLines);
$this->data->fundingInstrument->boleto->logoUri = $logoUri;
return $this;
} | [
"public",
"function",
"setBoleto",
"(",
"$",
"expirationDate",
",",
"$",
"logoUri",
",",
"array",
"$",
"instructionLines",
"=",
"[",
"]",
")",
"{",
"$",
"keys",
"=",
"[",
"'first'",
",",
"'second'",
",",
"'third'",
"]",
";",
"if",
"(",
"empty",
"(",
... | Set billet.
@param \DateTime|string $expirationDate Expiration date of a billet.
@param string $logoUri Logo of billet.
@param array $instructionLines Instructions billet.
@return $this | [
"Set",
"billet",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L387-L407 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setCreditCardHash | public function setCreditCardHash($hash, Holder $holder, $store = true)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->hash = $hash;
$this->data->fundingInstrument->creditCard->store = $store;
$this->setCreditCardHolder($holder);
return $this;
} | php | public function setCreditCardHash($hash, Holder $holder, $store = true)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->hash = $hash;
$this->data->fundingInstrument->creditCard->store = $store;
$this->setCreditCardHolder($holder);
return $this;
} | [
"public",
"function",
"setCreditCardHash",
"(",
"$",
"hash",
",",
"Holder",
"$",
"holder",
",",
"$",
"store",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"->",
"method",
"=",
"self",
"::",
"METHOD_CREDIT_CARD",
";",
"$",
... | Set credit cardHash.
@param string $hash Credit card hash encripted using Moip.js
@param \Moip\Resource\Customer $holder
@param bool $store Flag to know if credit card should be saved.
@return $this | [
"Set",
"credit",
"cardHash",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L442-L451 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setCreditCard | public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder, $store = true)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->expirationMonth = $expirationMonth;
$this->data->fundingInstrument->creditCard->expirationYear = $expirationYear;
$this->data->fundingInstrument->creditCard->number = $number;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
$this->data->fundingInstrument->creditCard->store = $store;
$this->setCreditCardHolder($holder);
return $this;
} | php | public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder, $store = true)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->expirationMonth = $expirationMonth;
$this->data->fundingInstrument->creditCard->expirationYear = $expirationYear;
$this->data->fundingInstrument->creditCard->number = $number;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
$this->data->fundingInstrument->creditCard->store = $store;
$this->setCreditCardHolder($holder);
return $this;
} | [
"public",
"function",
"setCreditCard",
"(",
"$",
"expirationMonth",
",",
"$",
"expirationYear",
",",
"$",
"number",
",",
"$",
"cvc",
",",
"Holder",
"$",
"holder",
",",
"$",
"store",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"fundingInstrume... | Set credit card
Credit card used in a payment.
The card when returned within a parent resource is presented in its minimum representation.
@param int $expirationMonth Card expiration month
@param int $expirationYear Year of card expiration.
@param string $number Card number.
@param int $cvc Card Security Code.
@param \Moip\Resource\Customer $holder
@param bool $store Flag to know if credit card should be saved.
@return $this | [
"Set",
"credit",
"card",
"Credit",
"card",
"used",
"in",
"a",
"payment",
".",
"The",
"card",
"when",
"returned",
"within",
"a",
"parent",
"resource",
"is",
"presented",
"in",
"its",
"minimum",
"representation",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L467-L479 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setCreditCardSaved | public function setCreditCardSaved($creditCardId, $cvc)
{
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->id = $creditCardId;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
return $this;
} | php | public function setCreditCardSaved($creditCardId, $cvc)
{
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->id = $creditCardId;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
return $this;
} | [
"public",
"function",
"setCreditCardSaved",
"(",
"$",
"creditCardId",
",",
"$",
"cvc",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"->",
"metho... | Sets data from a previously saved credit card
Credit card used in a payment.
Used when the credit card was saved with the customer and the payment made in a future date.
@param string $creditCardId MoIP's Credit Card Id.
@param int $cvc Card Security Code.
@return $this | [
"Sets",
"data",
"from",
"a",
"previously",
"saved",
"credit",
"card",
"Credit",
"card",
"used",
"in",
"a",
"payment",
".",
"Used",
"when",
"the",
"credit",
"card",
"was",
"saved",
"with",
"the",
"customer",
"and",
"the",
"payment",
"made",
"in",
"a",
"fu... | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L491-L500 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setOnlineBankDebit | public function setOnlineBankDebit($bankNumber, $expirationDate, $returnUri)
{
if ($expirationDate instanceof \DateTime) {
$expirationDate = $expirationDate->format('Y-m-d');
}
$this->data->fundingInstrument->method = self::METHOD_ONLINE_BANK_DEBIT;
$this->data->fundingInstrument->onlineBankDebit = new stdClass();
$this->data->fundingInstrument->onlineBankDebit->bankNumber = $bankNumber;
$this->data->fundingInstrument->onlineBankDebit->expirationDate = $expirationDate;
$this->data->fundingInstrument->onlineBankDebit->returnUri = $returnUri;
return $this;
} | php | public function setOnlineBankDebit($bankNumber, $expirationDate, $returnUri)
{
if ($expirationDate instanceof \DateTime) {
$expirationDate = $expirationDate->format('Y-m-d');
}
$this->data->fundingInstrument->method = self::METHOD_ONLINE_BANK_DEBIT;
$this->data->fundingInstrument->onlineBankDebit = new stdClass();
$this->data->fundingInstrument->onlineBankDebit->bankNumber = $bankNumber;
$this->data->fundingInstrument->onlineBankDebit->expirationDate = $expirationDate;
$this->data->fundingInstrument->onlineBankDebit->returnUri = $returnUri;
return $this;
} | [
"public",
"function",
"setOnlineBankDebit",
"(",
"$",
"bankNumber",
",",
"$",
"expirationDate",
",",
"$",
"returnUri",
")",
"{",
"if",
"(",
"$",
"expirationDate",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"expirationDate",
"=",
"$",
"expirationDate",
"->"... | Set payment means made available by banks.
@param string $bankNumber Bank number. Possible values: 001, 237, 341, 041.
@param \DateTime|string $expirationDate Date of expiration debit.
@param string $returnUri Return Uri.
@return $this | [
"Set",
"payment",
"means",
"made",
"available",
"by",
"banks",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L539-L551 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.setEscrow | public function setEscrow($description)
{
$this->data->escrow = new stdClass();
$this->data->escrow->description = $description;
return $this;
} | php | public function setEscrow($description)
{
$this->data->escrow = new stdClass();
$this->data->escrow->description = $description;
return $this;
} | [
"public",
"function",
"setEscrow",
"(",
"$",
"description",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"escrow",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"escrow",
"->",
"description",
"=",
"$",
"description",
";",
"retur... | Set escrow to a payment.
@param string $description
@return $this | [
"Set",
"escrow",
"to",
"a",
"payment",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L600-L606 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Payment.php | Payment.capture | public function capture()
{
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH, $this->getId(), 'capture');
if ($this->isMultipayment($this->getId())) {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::MULTI_PAYMENTS_PATH, $this->getId(), 'capture');
}
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | php | public function capture()
{
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH, $this->getId(), 'capture');
if ($this->isMultipayment($this->getId())) {
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::MULTI_PAYMENTS_PATH, $this->getId(), 'capture');
}
$response = $this->httpRequest($path, Requests::POST, $this);
return $this->populate($response);
} | [
"public",
"function",
"capture",
"(",
")",
"{",
"$",
"path",
"=",
"sprintf",
"(",
"'/%s/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'capture'",
")",
";",
"if",
"(",
"$"... | Capture a pre-authorized amount on a credit card payment.
@throws \Exception
@return Payment | [
"Capture",
"a",
"pre",
"-",
"authorized",
"amount",
"on",
"a",
"credit",
"card",
"payment",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Payment.php#L615-L625 | train |
wirecardBrasil/moip-sdk-php | src/Helper/Filters.php | Filters.between | public function between($field, $value1, $value2)
{
$this->filters[] = sprintf('%s::bt(%s,%s)', $field, $value1, $value2);
} | php | public function between($field, $value1, $value2)
{
$this->filters[] = sprintf('%s::bt(%s,%s)', $field, $value1, $value2);
} | [
"public",
"function",
"between",
"(",
"$",
"field",
",",
"$",
"value1",
",",
"$",
"value2",
")",
"{",
"$",
"this",
"->",
"filters",
"[",
"]",
"=",
"sprintf",
"(",
"'%s::bt(%s,%s)'",
",",
"$",
"field",
",",
"$",
"value1",
",",
"$",
"value2",
")",
";... | Set filter to compare if field is between both values.
@param string $field field to setup filter.
@param string $value1 first value to setup filter.
@param string $value2 second value to setup filter. | [
"Set",
"filter",
"to",
"compare",
"if",
"field",
"is",
"between",
"both",
"values",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Helper/Filters.php#L55-L58 | train |
wirecardBrasil/moip-sdk-php | src/Resource/NotificationPreferences.php | NotificationPreferences.populate | protected function populate(stdClass $response)
{
$account = clone $this;
$account->data->events = $this->getIfSet('events', $response);
$account->data->target = $this->getIfSet('target', $response);
$account->data->media = $this->getIfSet('media', $response);
$account->data->token = $this->getIfSet('token', $response);
$account->data->id = $this->getIfSet('id', $response);
return $account;
} | php | protected function populate(stdClass $response)
{
$account = clone $this;
$account->data->events = $this->getIfSet('events', $response);
$account->data->target = $this->getIfSet('target', $response);
$account->data->media = $this->getIfSet('media', $response);
$account->data->token = $this->getIfSet('token', $response);
$account->data->id = $this->getIfSet('id', $response);
return $account;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"account",
"=",
"clone",
"$",
"this",
";",
"$",
"account",
"->",
"data",
"->",
"events",
"=",
"$",
"this",
"->",
"getIfSet",
"(",
"'events'",
",",
"$",
"response",
")... | Mount the notification preference structure.
@param \stdClass $response
@return \Moip\Resource\NotificationPreferences data | [
"Mount",
"the",
"notification",
"preference",
"structure",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/NotificationPreferences.php#L167-L177 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Escrow.php | Escrow.release | public function release()
{
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH, $this->getId(), 'release');
$response = $this->httpRequest($path, Requests::POST, []);
return $this->populate($response);
} | php | public function release()
{
$path = sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH, $this->getId(), 'release');
$response = $this->httpRequest($path, Requests::POST, []);
return $this->populate($response);
} | [
"public",
"function",
"release",
"(",
")",
"{",
"$",
"path",
"=",
"sprintf",
"(",
"'/%s/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'release'",
")",
";",
"$",
"response",... | Release a escrow payment.
@return Payment | [
"Release",
"a",
"escrow",
"payment",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Escrow.php#L95-L102 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Escrow.php | Escrow.populate | protected function populate(stdClass $response)
{
$escrow = clone $this;
$escrow->data->id = $this->getIfSet('id', $response);
$escrow->data->status = $this->getIfSet('status', $response);
$escrow->data->description = $this->getIfSet('description', $response);
$escrow->data->amount = $this->getIfSet('amount', $response);
$escrow->data->_links = $this->getIfSet('_links', $response);
$escrow->data->createdAt = $this->getIfSetDateTime('createdAt', $response);
$escrow->data->updatedAt = $this->getIfSetDateTime('updatedAt', $response);
return $escrow;
} | php | protected function populate(stdClass $response)
{
$escrow = clone $this;
$escrow->data->id = $this->getIfSet('id', $response);
$escrow->data->status = $this->getIfSet('status', $response);
$escrow->data->description = $this->getIfSet('description', $response);
$escrow->data->amount = $this->getIfSet('amount', $response);
$escrow->data->_links = $this->getIfSet('_links', $response);
$escrow->data->createdAt = $this->getIfSetDateTime('createdAt', $response);
$escrow->data->updatedAt = $this->getIfSetDateTime('updatedAt', $response);
return $escrow;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"escrow",
"=",
"clone",
"$",
"this",
";",
"$",
"escrow",
"->",
"data",
"->",
"id",
"=",
"$",
"this",
"->",
"getIfSet",
"(",
"'id'",
",",
"$",
"response",
")",
";",
... | Mount escrow structure.
@param \stdClass $response
@return Escrow | [
"Mount",
"escrow",
"structure",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Escrow.php#L111-L124 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Keys.php | Keys.populate | protected function populate(stdClass $response)
{
$keys = clone $this;
$resp = $response->keys;
$keys->data->basicAuth = $this->getIfSet('basicAuth', $resp);
$keys->data->encryption = $this->getIfSet('encryption', $resp);
return $keys;
} | php | protected function populate(stdClass $response)
{
$keys = clone $this;
$resp = $response->keys;
$keys->data->basicAuth = $this->getIfSet('basicAuth', $resp);
$keys->data->encryption = $this->getIfSet('encryption', $resp);
return $keys;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"keys",
"=",
"clone",
"$",
"this",
";",
"$",
"resp",
"=",
"$",
"response",
"->",
"keys",
";",
"$",
"keys",
"->",
"data",
"->",
"basicAuth",
"=",
"$",
"this",
"->",
... | Mount keys structure.
@param \stdClass $response
@return $this | [
"Mount",
"keys",
"structure",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Keys.php#L32-L41 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.setHolder | public function setHolder($fullname, $number, $type)
{
$this->data->holder->fullname = $fullname;
$this->data->holder->taxDocument->type = $type;
$this->data->holder->taxDocument->number = $number;
return $this;
} | php | public function setHolder($fullname, $number, $type)
{
$this->data->holder->fullname = $fullname;
$this->data->holder->taxDocument->type = $type;
$this->data->holder->taxDocument->number = $number;
return $this;
} | [
"public",
"function",
"setHolder",
"(",
"$",
"fullname",
",",
"$",
"number",
",",
"$",
"type",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"holder",
"->",
"fullname",
"=",
"$",
"fullname",
";",
"$",
"this",
"->",
"data",
"->",
"holder",
"->",
"taxDocu... | Set holder.
@param string $fullname Holder full name.
@param string $number Document number.
@param string $type Document type (CPF or CNPJ).
@return $this | [
"Set",
"holder",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L213-L221 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.get | public function get($bank_account_id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | php | public function get($bank_account_id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | [
"public",
"function",
"get",
"(",
"$",
"bank_account_id",
")",
"{",
"return",
"$",
"this",
"->",
"getByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"bank_account_id",
")",
")",
";",
... | Get a bank account.
@param string $bank_account_id Bank account id.
@return stdClass | [
"Get",
"a",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L260-L263 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.create | public function create($account_id)
{
return $this->createResource(sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH_ACCOUNT, $account_id, self::PATH));
} | php | public function create($account_id)
{
return $this->createResource(sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH_ACCOUNT, $account_id, self::PATH));
} | [
"public",
"function",
"create",
"(",
"$",
"account_id",
")",
"{",
"return",
"$",
"this",
"->",
"createResource",
"(",
"sprintf",
"(",
"'/%s/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH_ACCOUNT",
",",
"$",
"account_id",
",",
"sel... | Create a new bank account.
@param string Account id.
@return stdClass | [
"Create",
"a",
"new",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L286-L289 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.update | public function update($bank_account_id = null)
{
$bank_account_id = (!empty($bank_account_id) ? $bank_account_id : $this->getId());
return $this->updateByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | php | public function update($bank_account_id = null)
{
$bank_account_id = (!empty($bank_account_id) ? $bank_account_id : $this->getId());
return $this->updateByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | [
"public",
"function",
"update",
"(",
"$",
"bank_account_id",
"=",
"null",
")",
"{",
"$",
"bank_account_id",
"=",
"(",
"!",
"empty",
"(",
"$",
"bank_account_id",
")",
"?",
"$",
"bank_account_id",
":",
"$",
"this",
"->",
"getId",
"(",
")",
")",
";",
"ret... | Update a bank account.
@param string|null $bank_account_id Bank account id.
@return stdClass | [
"Update",
"a",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L298-L303 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.delete | public function delete($bank_account_id)
{
return $this->deleteByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | php | public function delete($bank_account_id)
{
return $this->deleteByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $bank_account_id));
} | [
"public",
"function",
"delete",
"(",
"$",
"bank_account_id",
")",
"{",
"return",
"$",
"this",
"->",
"deleteByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"bank_account_id",
")",
")",
... | Delete a bank account.
@param string $bank_account_id Bank account id.
@return mixed | [
"Delete",
"a",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L312-L315 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccount.php | BankAccount.populate | protected function populate(stdClass $response)
{
$bank_account = clone $this;
$bank_account->data->id = $this->getIfSet('id', $response);
$bank_account->data->agencyNumber = $this->getIfSet('agencyNumber', $response);
$bank_account->data->accountNumber = $this->getIfSet('accountNumber', $response);
$bank_account->data->status = $this->getIfSet('status', $response);
$bank_account->data->accountCheckNumber = $this->getIfSet('accountCheckNumber', $response);
$bank_account->data->bankName = $this->getIfSet('bankName', $response);
$bank_account->data->type = $this->getIfSet('type', $response);
$bank_account->data->agencyCheckNumber = $this->getIfSet('agencyCheckNumber', $response);
$bank_account->data->bankNumber = $this->getIfSet('bankNumber', $response);
$holder = $this->getIfSet('holder', $response);
$bank_account->data->holder = new stdClass();
$bank_account->data->holder->fullname = $this->getIfSet('fullname', $holder);
$tax_document = $this->getIfSet('taxDocument', $holder);
$bank_account->data->holder->taxDocument = new stdClass();
$bank_account->data->holder->taxDocument->number = $this->getIfSet('number', $tax_document);
$bank_account->data->holder->taxDocument->type = $this->getIfSet('type', $tax_document);
$bank_account->data->_links = $this->getIfSet('_links', $response);
$bank_account->data->createdAt = $this->getIfSet('createdAt', $response);
return $bank_account;
} | php | protected function populate(stdClass $response)
{
$bank_account = clone $this;
$bank_account->data->id = $this->getIfSet('id', $response);
$bank_account->data->agencyNumber = $this->getIfSet('agencyNumber', $response);
$bank_account->data->accountNumber = $this->getIfSet('accountNumber', $response);
$bank_account->data->status = $this->getIfSet('status', $response);
$bank_account->data->accountCheckNumber = $this->getIfSet('accountCheckNumber', $response);
$bank_account->data->bankName = $this->getIfSet('bankName', $response);
$bank_account->data->type = $this->getIfSet('type', $response);
$bank_account->data->agencyCheckNumber = $this->getIfSet('agencyCheckNumber', $response);
$bank_account->data->bankNumber = $this->getIfSet('bankNumber', $response);
$holder = $this->getIfSet('holder', $response);
$bank_account->data->holder = new stdClass();
$bank_account->data->holder->fullname = $this->getIfSet('fullname', $holder);
$tax_document = $this->getIfSet('taxDocument', $holder);
$bank_account->data->holder->taxDocument = new stdClass();
$bank_account->data->holder->taxDocument->number = $this->getIfSet('number', $tax_document);
$bank_account->data->holder->taxDocument->type = $this->getIfSet('type', $tax_document);
$bank_account->data->_links = $this->getIfSet('_links', $response);
$bank_account->data->createdAt = $this->getIfSet('createdAt', $response);
return $bank_account;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"bank_account",
"=",
"clone",
"$",
"this",
";",
"$",
"bank_account",
"->",
"data",
"->",
"id",
"=",
"$",
"this",
"->",
"getIfSet",
"(",
"'id'",
",",
"$",
"response",
... | Mount the bank account structure.
@param stdClass $response
@return \Moip\Resource\BankAccount | [
"Mount",
"the",
"bank",
"account",
"structure",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccount.php#L324-L350 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Webhook.php | Webhook.populate | protected function populate(stdClass $response)
{
$webhook = clone $this;
$webhook->data = new stdClass();
$webhook->data->id = $response->id;
$webhook->data->event = $response->event;
$webhook->data->url = $response->url;
$webhook->data->resourceId = $response->resourceId;
$webhook->data->status = $response->status;
return $webhook;
} | php | protected function populate(stdClass $response)
{
$webhook = clone $this;
$webhook->data = new stdClass();
$webhook->data->id = $response->id;
$webhook->data->event = $response->event;
$webhook->data->url = $response->url;
$webhook->data->resourceId = $response->resourceId;
$webhook->data->status = $response->status;
return $webhook;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"webhook",
"=",
"clone",
"$",
"this",
";",
"$",
"webhook",
"->",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"webhook",
"->",
"data",
"->",
"id",
"=",
"$",
... | Mount structure of Webhook.
@param \stdClass $response
@return \Moip\Resource\Webhook Webhook | [
"Mount",
"structure",
"of",
"Webhook",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Webhook.php#L74-L86 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Customer.php | Customer.get | public function get($moip_id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $moip_id));
} | php | public function get($moip_id)
{
return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $moip_id));
} | [
"public",
"function",
"get",
"(",
"$",
"moip_id",
")",
"{",
"return",
"$",
"this",
"->",
"getByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"$",
"moip_id",
")",
")",
";",
"}"
] | Find a customer.
@param string $moip_id
@return \Moip\Resource\Customer|stdClass | [
"Find",
"a",
"customer",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Customer.php#L122-L125 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Customer.php | Customer.populate | protected function populate(stdClass $response)
{
$customer = clone $this;
$customer->data = new stdClass();
$customer->data->id = $this->getIfSet('id', $response);
$customer->data->ownId = $this->getIfSet('ownId', $response);
$customer->data->fullname = $this->getIfSet('fullname', $response);
$customer->data->email = $this->getIfSet('email', $response);
$customer->data->phone = new stdClass();
$phone = $this->getIfSet('phone', $response);
$customer->data->phone->countryCode = $this->getIfSet('countryCode', $phone);
$customer->data->phone->areaCode = $this->getIfSet('areaCode', $phone);
$customer->data->phone->number = $this->getIfSet('number', $phone);
$customer->data->birthDate = $this->getIfSet('birthDate', $response);
$customer->data->taxDocument = new stdClass();
$customer->data->taxDocument->type = $this->getIfSet('type', $this->getIfSet('taxDocument', $response));
$customer->data->taxDocument->number = $this->getIfSet('number', $this->getIfSet('taxDocument', $response));
$customer->data->addresses = [];
$customer->data->shippingAddress = $this->getIfSet('shippingAddress', $response);
$customer->data->billingAddress = $this->getIfSet('billingAddress', $response);
$customer->data->fundingInstrument = $this->getIfSet('fundingInstrument', $response);
$customer->data->_links = $this->getIfSet('_links', $response);
return $customer;
} | php | protected function populate(stdClass $response)
{
$customer = clone $this;
$customer->data = new stdClass();
$customer->data->id = $this->getIfSet('id', $response);
$customer->data->ownId = $this->getIfSet('ownId', $response);
$customer->data->fullname = $this->getIfSet('fullname', $response);
$customer->data->email = $this->getIfSet('email', $response);
$customer->data->phone = new stdClass();
$phone = $this->getIfSet('phone', $response);
$customer->data->phone->countryCode = $this->getIfSet('countryCode', $phone);
$customer->data->phone->areaCode = $this->getIfSet('areaCode', $phone);
$customer->data->phone->number = $this->getIfSet('number', $phone);
$customer->data->birthDate = $this->getIfSet('birthDate', $response);
$customer->data->taxDocument = new stdClass();
$customer->data->taxDocument->type = $this->getIfSet('type', $this->getIfSet('taxDocument', $response));
$customer->data->taxDocument->number = $this->getIfSet('number', $this->getIfSet('taxDocument', $response));
$customer->data->addresses = [];
$customer->data->shippingAddress = $this->getIfSet('shippingAddress', $response);
$customer->data->billingAddress = $this->getIfSet('billingAddress', $response);
$customer->data->fundingInstrument = $this->getIfSet('fundingInstrument', $response);
$customer->data->_links = $this->getIfSet('_links', $response);
return $customer;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"customer",
"=",
"clone",
"$",
"this",
";",
"$",
"customer",
"->",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"customer",
"->",
"data",
"->",
"id",
"=",
"$... | Mount the buyer structure from customer.
@param \stdClass $response
@return Customer Customer information. | [
"Mount",
"the",
"buyer",
"structure",
"from",
"customer",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Customer.php#L244-L271 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Customer.php | Customer.setCreditCard | public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder = null)
{
if ($holder === null) {
$holder = $this;
}
$birthdate = $holder->getBirthDate();
if ($birthdate instanceof \DateTime) {
$birthdate = $birthdate->format('Y-m-d');
}
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = Payment::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->expirationMonth = $expirationMonth;
$this->data->fundingInstrument->creditCard->expirationYear = $expirationYear;
$this->data->fundingInstrument->creditCard->number = $number;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
$this->data->fundingInstrument->creditCard->holder = new stdClass();
$this->data->fundingInstrument->creditCard->holder->fullname = $holder->getFullname();
$this->data->fundingInstrument->creditCard->holder->birthdate = $birthdate;
$this->data->fundingInstrument->creditCard->holder->taxDocument = new stdClass();
$this->data->fundingInstrument->creditCard->holder->taxDocument->type = $holder->getTaxDocumentType();
$this->data->fundingInstrument->creditCard->holder->taxDocument->number = $holder->getTaxDocumentNumber();
$this->data->fundingInstrument->creditCard->holder->phone = new stdClass();
$this->data->fundingInstrument->creditCard->holder->phone->countryCode = $holder->getPhoneCountryCode();
$this->data->fundingInstrument->creditCard->holder->phone->areaCode = $holder->getPhoneAreaCode();
$this->data->fundingInstrument->creditCard->holder->phone->number = $holder->getPhoneNumber();
return $this;
} | php | public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder = null)
{
if ($holder === null) {
$holder = $this;
}
$birthdate = $holder->getBirthDate();
if ($birthdate instanceof \DateTime) {
$birthdate = $birthdate->format('Y-m-d');
}
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = Payment::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->expirationMonth = $expirationMonth;
$this->data->fundingInstrument->creditCard->expirationYear = $expirationYear;
$this->data->fundingInstrument->creditCard->number = $number;
$this->data->fundingInstrument->creditCard->cvc = $cvc;
$this->data->fundingInstrument->creditCard->holder = new stdClass();
$this->data->fundingInstrument->creditCard->holder->fullname = $holder->getFullname();
$this->data->fundingInstrument->creditCard->holder->birthdate = $birthdate;
$this->data->fundingInstrument->creditCard->holder->taxDocument = new stdClass();
$this->data->fundingInstrument->creditCard->holder->taxDocument->type = $holder->getTaxDocumentType();
$this->data->fundingInstrument->creditCard->holder->taxDocument->number = $holder->getTaxDocumentNumber();
$this->data->fundingInstrument->creditCard->holder->phone = new stdClass();
$this->data->fundingInstrument->creditCard->holder->phone->countryCode = $holder->getPhoneCountryCode();
$this->data->fundingInstrument->creditCard->holder->phone->areaCode = $holder->getPhoneAreaCode();
$this->data->fundingInstrument->creditCard->holder->phone->number = $holder->getPhoneNumber();
return $this;
} | [
"public",
"function",
"setCreditCard",
"(",
"$",
"expirationMonth",
",",
"$",
"expirationYear",
",",
"$",
"number",
",",
"$",
"cvc",
",",
"Holder",
"$",
"holder",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"holder",
"===",
"null",
")",
"{",
"$",
"holder",
... | Set credit card from customer.
@param int $expirationMonth Card expiration month.
@param int $expirationYear Year card expiration.
@param int $number Card number.
@param int $cvc Card Security Code.
@param \Moip\Resource\Customer|null $holder Cardholder.
@return $this | [
"Set",
"credit",
"card",
"from",
"customer",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Customer.php#L326-L355 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.addAddress | public function addAddress($street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)
{
$address = new stdClass();
$address->street = $street;
$address->streetNumber = $number;
$address->complement = $complement;
$address->district = $district;
$address->city = $city;
$address->state = $state;
$address->country = $country;
$address->zipCode = $zip;
$this->data->person->address = $address;
return $this;
} | php | public function addAddress($street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)
{
$address = new stdClass();
$address->street = $street;
$address->streetNumber = $number;
$address->complement = $complement;
$address->district = $district;
$address->city = $city;
$address->state = $state;
$address->country = $country;
$address->zipCode = $zip;
$this->data->person->address = $address;
return $this;
} | [
"public",
"function",
"addAddress",
"(",
"$",
"street",
",",
"$",
"number",
",",
"$",
"district",
",",
"$",
"city",
",",
"$",
"state",
",",
"$",
"zip",
",",
"$",
"complement",
"=",
"null",
",",
"$",
"country",
"=",
"self",
"::",
"ADDRESS_COUNTRY",
")... | Add a new address to the account.
@param string $street Street address.
@param string $number Number address.
@param string $district Neighborhood address.
@param string $city City address.
@param string $state State address.
@param string $zip The zip code billing address.
@param string $complement Address complement.
@param string $country Country ISO-alpha3 format, BRA example.
@return $this | [
"Add",
"a",
"new",
"address",
"to",
"the",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L75-L90 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.addAlternativePhone | public function addAlternativePhone($areaCode, $number, $countryCode = 55)
{
$alternativePhone = new stdClass();
$alternativePhone->countryCode = $countryCode;
$alternativePhone->areaCode = $areaCode;
$alternativePhone->number = $number;
$this->data->person->alternativePhones[] = $alternativePhone;
return $this;
} | php | public function addAlternativePhone($areaCode, $number, $countryCode = 55)
{
$alternativePhone = new stdClass();
$alternativePhone->countryCode = $countryCode;
$alternativePhone->areaCode = $areaCode;
$alternativePhone->number = $number;
$this->data->person->alternativePhones[] = $alternativePhone;
return $this;
} | [
"public",
"function",
"addAlternativePhone",
"(",
"$",
"areaCode",
",",
"$",
"number",
",",
"$",
"countryCode",
"=",
"55",
")",
"{",
"$",
"alternativePhone",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"alternativePhone",
"->",
"countryCode",
"=",
"$",
"co... | Add alternative phone to an account.
@param int $areaCode DDD telephone.
@param int $number Telephone number.
@param int $countryCode Country code.
@return \Moip\Resource\Account | [
"Add",
"alternative",
"phone",
"to",
"an",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L101-L111 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.checkExistence | public function checkExistence($tax_document)
{
try {
$this->getByPathNoPopulate(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $tax_document));
return true;
} catch (ValidationException $e) {
if ($e->getStatusCode() != 404) {
throw new ValidationException($e->getStatusCode(), $e->getErrors());
}
}
return false;
} | php | public function checkExistence($tax_document)
{
try {
$this->getByPathNoPopulate(sprintf('/%s/%s/%s?tax_document=%s', MoipResource::VERSION, self::PATH, 'exists', $tax_document));
return true;
} catch (ValidationException $e) {
if ($e->getStatusCode() != 404) {
throw new ValidationException($e->getStatusCode(), $e->getErrors());
}
}
return false;
} | [
"public",
"function",
"checkExistence",
"(",
"$",
"tax_document",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"getByPathNoPopulate",
"(",
"sprintf",
"(",
"'/%s/%s/%s?tax_document=%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH",
",",
"'exists'"... | Check if an account exists.
@param string $tax_document
@return bool | [
"Check",
"if",
"an",
"account",
"exists",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L142-L155 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.getFullname | public function getFullname()
{
return $this->getIfSet('name', $this->data->person).' '.$this->getIfSet('lastName', $this->data->person);
} | php | public function getFullname()
{
return $this->getIfSet('name', $this->data->person).' '.$this->getIfSet('lastName', $this->data->person);
} | [
"public",
"function",
"getFullname",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getIfSet",
"(",
"'name'",
",",
"$",
"this",
"->",
"data",
"->",
"person",
")",
".",
"' '",
".",
"$",
"this",
"->",
"getIfSet",
"(",
"'lastName'",
",",
"$",
"this",
"->"... | Get account fullname.
@return string Account's full name. | [
"Get",
"account",
"fullname",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L212-L215 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setPhone | public function setPhone($areaCode, $number, $countryCode = 55)
{
$this->data->person->phone = new stdClass();
$this->data->person->phone->countryCode = $countryCode;
$this->data->person->phone->areaCode = $areaCode;
$this->data->person->phone->number = $number;
return $this;
} | php | public function setPhone($areaCode, $number, $countryCode = 55)
{
$this->data->person->phone = new stdClass();
$this->data->person->phone->countryCode = $countryCode;
$this->data->person->phone->areaCode = $areaCode;
$this->data->person->phone->number = $number;
return $this;
} | [
"public",
"function",
"setPhone",
"(",
"$",
"areaCode",
",",
"$",
"number",
",",
"$",
"countryCode",
"=",
"55",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"person",
"->",
"phone",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"data",
"-... | Set phone from account.
@param int $areaCode DDD telephone.
@param int $number Telephone number.
@param int $countryCode Country code.
@return \Moip\Resource\Account | [
"Set",
"phone",
"from",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L589-L597 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setIdentityDocument | public function setIdentityDocument($number, $issuer, $issueDate, $type = 'RG')
{
$this->data->person->identityDocument = new stdClass();
$this->data->person->identityDocument->type = $type;
$this->data->person->identityDocument->number = $number;
$this->data->person->identityDocument->issuer = $issuer;
$this->data->person->identityDocument->issueDate = $issueDate;
return $this;
} | php | public function setIdentityDocument($number, $issuer, $issueDate, $type = 'RG')
{
$this->data->person->identityDocument = new stdClass();
$this->data->person->identityDocument->type = $type;
$this->data->person->identityDocument->number = $number;
$this->data->person->identityDocument->issuer = $issuer;
$this->data->person->identityDocument->issueDate = $issueDate;
return $this;
} | [
"public",
"function",
"setIdentityDocument",
"(",
"$",
"number",
",",
"$",
"issuer",
",",
"$",
"issueDate",
",",
"$",
"type",
"=",
"'RG'",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"person",
"->",
"identityDocument",
"=",
"new",
"stdClass",
"(",
")",
... | Set identity document from account.
@param string $number Número do documento.
@param string $issuer Emissor do documento.
@param $issueDate
@param string $type Tipo do documento. Valores possíveis: RG.
@return Account | [
"Set",
"identity",
"document",
"from",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L609-L618 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setNationality | public function setNationality($nationality = self::ADDRESS_COUNTRY)
{
$this->data->person->nationality = $nationality;
return $this;
} | php | public function setNationality($nationality = self::ADDRESS_COUNTRY)
{
$this->data->person->nationality = $nationality;
return $this;
} | [
"public",
"function",
"setNationality",
"(",
"$",
"nationality",
"=",
"self",
"::",
"ADDRESS_COUNTRY",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"person",
"->",
"nationality",
"=",
"$",
"nationality",
";",
"return",
"$",
"this",
";",
"}"
] | Set person nationality.
@param string $nationality Abbreviation for nationality (3 max length).
@return $this | [
"Set",
"person",
"nationality",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L627-L632 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setParentsName | public function setParentsName($motherName, $fatherName)
{
$this->data->person->parentsName = new stdClass();
$this->data->person->parentsName->mother = $motherName;
$this->data->person->parentsName->father = $fatherName;
return $this;
} | php | public function setParentsName($motherName, $fatherName)
{
$this->data->person->parentsName = new stdClass();
$this->data->person->parentsName->mother = $motherName;
$this->data->person->parentsName->father = $fatherName;
return $this;
} | [
"public",
"function",
"setParentsName",
"(",
"$",
"motherName",
",",
"$",
"fatherName",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"person",
"->",
"parentsName",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"person",
"->",
"p... | Set parents name.
@param string $motherName Mother name.
@param string $fatherName Father name.
@return $this | [
"Set",
"parents",
"name",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L656-L663 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setCompanyName | public function setCompanyName($name, $businessName)
{
$this->initializeCompany();
$this->data->company->name = $name;
$this->data->company->businessName = $businessName;
return $this;
} | php | public function setCompanyName($name, $businessName)
{
$this->initializeCompany();
$this->data->company->name = $name;
$this->data->company->businessName = $businessName;
return $this;
} | [
"public",
"function",
"setCompanyName",
"(",
"$",
"name",
",",
"$",
"businessName",
")",
"{",
"$",
"this",
"->",
"initializeCompany",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"company",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"... | Set company name.
@param string $name Trading Name.
@param string $businessName Company Name.
@return $this | [
"Set",
"company",
"name",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L715-L722 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setCompanyOpeningDate | public function setCompanyOpeningDate($openingDate)
{
if ($openingDate instanceof \DateTime) {
$openingDate = $openingDate->format('Y-m-d');
}
$this->initializeCompany();
$this->data->company->openingDate = $openingDate;
return $this;
} | php | public function setCompanyOpeningDate($openingDate)
{
if ($openingDate instanceof \DateTime) {
$openingDate = $openingDate->format('Y-m-d');
}
$this->initializeCompany();
$this->data->company->openingDate = $openingDate;
return $this;
} | [
"public",
"function",
"setCompanyOpeningDate",
"(",
"$",
"openingDate",
")",
"{",
"if",
"(",
"$",
"openingDate",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"openingDate",
"=",
"$",
"openingDate",
"->",
"format",
"(",
"'Y-m-d'",
")",
";",
"}",
"$",
"thi... | Set company opening date.
@param \DateTime|string $openingDate .
@return $this | [
"Set",
"company",
"opening",
"date",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L741-L750 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setCompanyAddress | public function setCompanyAddress($street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)
{
$address = new stdClass();
$address->street = $street;
$address->streetNumber = $number;
$address->complement = $complement;
$address->district = $district;
$address->city = $city;
$address->state = $state;
$address->country = $country;
$address->zipCode = $zip;
$this->initializeCompany();
$this->data->company->address = $address;
return $this;
} | php | public function setCompanyAddress($street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)
{
$address = new stdClass();
$address->street = $street;
$address->streetNumber = $number;
$address->complement = $complement;
$address->district = $district;
$address->city = $city;
$address->state = $state;
$address->country = $country;
$address->zipCode = $zip;
$this->initializeCompany();
$this->data->company->address = $address;
return $this;
} | [
"public",
"function",
"setCompanyAddress",
"(",
"$",
"street",
",",
"$",
"number",
",",
"$",
"district",
",",
"$",
"city",
",",
"$",
"state",
",",
"$",
"zip",
",",
"$",
"complement",
"=",
"null",
",",
"$",
"country",
"=",
"self",
"::",
"ADDRESS_COUNTRY... | Set address to company.
@param string $street Street address.
@param string $number Number address.
@param string $district Neighborhood address.
@param string $city City address.
@param string $state State address.
@param string $zip The zip code billing address.
@param string $complement Address complement.
@param string $country Country ISO-alpha3 format, BRA example.
@return $this | [
"Set",
"address",
"to",
"company",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L800-L816 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Account.php | Account.setCompanyPhone | public function setCompanyPhone($areaCode, $number, $countryCode = 55)
{
$this->initializeCompany();
$this->data->company->phone = new stdClass();
$this->data->company->phone->countryCode = $countryCode;
$this->data->company->phone->areaCode = $areaCode;
$this->data->company->phone->number = $number;
return $this;
} | php | public function setCompanyPhone($areaCode, $number, $countryCode = 55)
{
$this->initializeCompany();
$this->data->company->phone = new stdClass();
$this->data->company->phone->countryCode = $countryCode;
$this->data->company->phone->areaCode = $areaCode;
$this->data->company->phone->number = $number;
return $this;
} | [
"public",
"function",
"setCompanyPhone",
"(",
"$",
"areaCode",
",",
"$",
"number",
",",
"$",
"countryCode",
"=",
"55",
")",
"{",
"$",
"this",
"->",
"initializeCompany",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"company",
"->",
"phone",
"=",
"new... | Set company phone.
@param int $areaCode DDD telephone.
@param int $number Telephone number.
@param int $countryCode Country code.
@return \Moip\Resource\Account | [
"Set",
"company",
"phone",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Account.php#L827-L836 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.getAuthUrl | public function getAuthUrl($endpoint = null)
{
if ($endpoint !== null) {
$this->endpoint = $endpoint;
}
$query_string = [
'response_type' => self::RESPONSE_TYPE,
'client_id' => $this->client_id,
'redirect_uri' => $this->redirect_uri,
'scope' => implode(',', $this->scope),
];
return $this->endpoint.self::OAUTH_AUTHORIZE.'?'.http_build_query($query_string);
} | php | public function getAuthUrl($endpoint = null)
{
if ($endpoint !== null) {
$this->endpoint = $endpoint;
}
$query_string = [
'response_type' => self::RESPONSE_TYPE,
'client_id' => $this->client_id,
'redirect_uri' => $this->redirect_uri,
'scope' => implode(',', $this->scope),
];
return $this->endpoint.self::OAUTH_AUTHORIZE.'?'.http_build_query($query_string);
} | [
"public",
"function",
"getAuthUrl",
"(",
"$",
"endpoint",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"endpoint",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"endpoint",
"=",
"$",
"endpoint",
";",
"}",
"$",
"query_string",
"=",
"[",
"'response_type'",
"=>",... | URI of oauth.
@param $endpoint
@return string | [
"URI",
"of",
"oauth",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L213-L226 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.authorize | public function authorize()
{
$path = $this->endpoint.self::OAUTH_TOKEN;
$headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
$body = [
'client_id' => $this->client_id,
'client_secret' => $this->client_secret,
'grant_type' => self::GRANT_TYPE,
'code' => $this->code,
'redirect_uri' => $this->redirect_uri,
];
try {
$http_response = $this->createNewSession()->request($path, $headers, $body, 'POST');
} catch (Requests_Exception $e) {
throw new UnexpectedException($e);
}
if ($http_response->status_code >= 200 && $http_response->status_code < 300) {
return json_decode($http_response->body);
} elseif ($http_response->status_code >= 400 && $http_response->status_code <= 499) {
throw new ValidationException($http_response->status_code, $http_response->body);
}
throw new UnexpectedException();
} | php | public function authorize()
{
$path = $this->endpoint.self::OAUTH_TOKEN;
$headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
$body = [
'client_id' => $this->client_id,
'client_secret' => $this->client_secret,
'grant_type' => self::GRANT_TYPE,
'code' => $this->code,
'redirect_uri' => $this->redirect_uri,
];
try {
$http_response = $this->createNewSession()->request($path, $headers, $body, 'POST');
} catch (Requests_Exception $e) {
throw new UnexpectedException($e);
}
if ($http_response->status_code >= 200 && $http_response->status_code < 300) {
return json_decode($http_response->body);
} elseif ($http_response->status_code >= 400 && $http_response->status_code <= 499) {
throw new ValidationException($http_response->status_code, $http_response->body);
}
throw new UnexpectedException();
} | [
"public",
"function",
"authorize",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"endpoint",
".",
"self",
"::",
"OAUTH_TOKEN",
";",
"$",
"headers",
"=",
"[",
"'Content-Type'",
"=>",
"'application/x-www-form-urlencoded'",
"]",
";",
"$",
"body",
"=",
"... | With the permission granted, you will receive a code that will allow you to retrieve the authentication accessToken and process requests involving another user.
@return mixed | [
"With",
"the",
"permission",
"granted",
"you",
"will",
"receive",
"a",
"code",
"that",
"will",
"allow",
"you",
"to",
"retrieve",
"the",
"authentication",
"accessToken",
"and",
"process",
"requests",
"involving",
"another",
"user",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L233-L258 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setReceiveFunds | public function setReceiveFunds($receive_funds)
{
if (!is_bool($receive_funds)) {
throw new InvalidArgumentException('$receive_funds deve ser boolean, foi passado '.gettype($receive_funds));
}
if ($receive_funds === true) {
$this->setScope(self::RECEIVE_FUNDS);
}
return $this;
} | php | public function setReceiveFunds($receive_funds)
{
if (!is_bool($receive_funds)) {
throw new InvalidArgumentException('$receive_funds deve ser boolean, foi passado '.gettype($receive_funds));
}
if ($receive_funds === true) {
$this->setScope(self::RECEIVE_FUNDS);
}
return $this;
} | [
"public",
"function",
"setReceiveFunds",
"(",
"$",
"receive_funds",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"receive_funds",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$receive_funds deve ser boolean, foi passado '",
".",
"gettype",
"("... | Permission for creation and consultation of ORDERS, PAYMENTS, MULTI ORDERS, MULTI PAYMENTS, CUSTOMERS and consultation of LAUNCHES.
@param bool $receive_funds
@throws \Moip\Exceptions\InvalidArgumentException
@return \Moip\Auth\Connect $this | [
"Permission",
"for",
"creation",
"and",
"consultation",
"of",
"ORDERS",
"PAYMENTS",
"MULTI",
"ORDERS",
"MULTI",
"PAYMENTS",
"CUSTOMERS",
"and",
"consultation",
"of",
"LAUNCHES",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L295-L306 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setRefund | public function setRefund($refund)
{
if (!is_bool($refund)) {
throw new InvalidArgumentException('$refund deve ser boolean, foi passado '.gettype($refund));
}
if ($refund === true) {
$this->setScope(self::REFUND);
}
return $this;
} | php | public function setRefund($refund)
{
if (!is_bool($refund)) {
throw new InvalidArgumentException('$refund deve ser boolean, foi passado '.gettype($refund));
}
if ($refund === true) {
$this->setScope(self::REFUND);
}
return $this;
} | [
"public",
"function",
"setRefund",
"(",
"$",
"refund",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"refund",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$refund deve ser boolean, foi passado '",
".",
"gettype",
"(",
"$",
"refund",
")",... | Permission to create and consult reimbursements ofORDERS, PAYMENTS.
@param bool $refund
@throws \Moip\Exceptions\InvalidArgumentException
@return \Moip\Auth\Connect $this | [
"Permission",
"to",
"create",
"and",
"consult",
"reimbursements",
"ofORDERS",
"PAYMENTS",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L317-L328 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setManageAccountInfo | public function setManageAccountInfo($manage_account_info)
{
if (!is_bool($manage_account_info)) {
throw new InvalidArgumentException('$manage_account_info deve ser boolean, foi passado '.gettype($manage_account_info));
}
if ($manage_account_info === true) {
$this->setScope(self::MANAGE_ACCOUNT_INFO);
}
return $this;
} | php | public function setManageAccountInfo($manage_account_info)
{
if (!is_bool($manage_account_info)) {
throw new InvalidArgumentException('$manage_account_info deve ser boolean, foi passado '.gettype($manage_account_info));
}
if ($manage_account_info === true) {
$this->setScope(self::MANAGE_ACCOUNT_INFO);
}
return $this;
} | [
"public",
"function",
"setManageAccountInfo",
"(",
"$",
"manage_account_info",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"manage_account_info",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$manage_account_info deve ser boolean, foi passado '",
... | Permission to consult ACCOUNTS registration information.
@param bool $manage_account_info
@throws \Moip\Exceptions\InvalidArgumentException
@return \Moip\Auth\Connect $this | [
"Permission",
"to",
"consult",
"ACCOUNTS",
"registration",
"information",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L339-L350 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setRetrieveFinancialInfo | public function setRetrieveFinancialInfo($retrieve_financial_info)
{
if (!is_bool($retrieve_financial_info)) {
throw new InvalidArgumentException('$retrieve_financial_info deve ser boolean, foi passado '.gettype($retrieve_financial_info));
}
if ($retrieve_financial_info === true) {
$this->setScope(self::RETRIEVE_FINANCIAL_INFO);
}
return $this;
} | php | public function setRetrieveFinancialInfo($retrieve_financial_info)
{
if (!is_bool($retrieve_financial_info)) {
throw new InvalidArgumentException('$retrieve_financial_info deve ser boolean, foi passado '.gettype($retrieve_financial_info));
}
if ($retrieve_financial_info === true) {
$this->setScope(self::RETRIEVE_FINANCIAL_INFO);
}
return $this;
} | [
"public",
"function",
"setRetrieveFinancialInfo",
"(",
"$",
"retrieve_financial_info",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"retrieve_financial_info",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$retrieve_financial_info deve ser boolean, fo... | Permission to query balance through the ACCOUNTS endpoint.
@param bool $retrieve_financial_info
@throws \Moip\Exceptions\InvalidArgumentException
@return \Moip\Auth\Connect $this | [
"Permission",
"to",
"query",
"balance",
"through",
"the",
"ACCOUNTS",
"endpoint",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L361-L372 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setTransferFunds | public function setTransferFunds($transfer_funds)
{
if (!is_bool($transfer_funds)) {
throw new InvalidArgumentException('$transfer_funds deve ser boolean, foi passado '.gettype($transfer_funds));
}
if ($transfer_funds === true) {
$this->setScope(self::TRANSFER_FUNDS);
}
return $this;
} | php | public function setTransferFunds($transfer_funds)
{
if (!is_bool($transfer_funds)) {
throw new InvalidArgumentException('$transfer_funds deve ser boolean, foi passado '.gettype($transfer_funds));
}
if ($transfer_funds === true) {
$this->setScope(self::TRANSFER_FUNDS);
}
return $this;
} | [
"public",
"function",
"setTransferFunds",
"(",
"$",
"transfer_funds",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"transfer_funds",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$transfer_funds deve ser boolean, foi passado '",
".",
"gettype",
... | Permission for bank transfers or for Moip accounts through the TRANSFERS endpoint.
@param bool $transfer_funds
@throws \Moip\Exceptions\InvalidArgumentException
@return \Moip\Auth\Connect $this | [
"Permission",
"for",
"bank",
"transfers",
"or",
"for",
"Moip",
"accounts",
"through",
"the",
"TRANSFERS",
"endpoint",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L383-L394 | train |
wirecardBrasil/moip-sdk-php | src/Auth/Connect.php | Connect.setDefinePreferences | public function setDefinePreferences($define_preferences)
{
if (!is_bool($define_preferences)) {
throw new InvalidArgumentException('$define_preferences deve ser boolean, foi passado '.gettype($define_preferences));
}
if ($define_preferences === true) {
$this->setScope(self::DEFINE_PREFERENCES);
}
return $this;
} | php | public function setDefinePreferences($define_preferences)
{
if (!is_bool($define_preferences)) {
throw new InvalidArgumentException('$define_preferences deve ser boolean, foi passado '.gettype($define_preferences));
}
if ($define_preferences === true) {
$this->setScope(self::DEFINE_PREFERENCES);
}
return $this;
} | [
"public",
"function",
"setDefinePreferences",
"(",
"$",
"define_preferences",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"define_preferences",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$define_preferences deve ser boolean, foi passado '",
"."... | Permission to create, change, and delete notification preferences through the PREFERENCES endpoint.
@param bool $define_preferences
@throws \Moip\Exceptions\InvalidArgumentException
@return $this | [
"Permission",
"to",
"create",
"change",
"and",
"delete",
"notification",
"preferences",
"through",
"the",
"PREFERENCES",
"endpoint",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Auth/Connect.php#L405-L416 | train |
wirecardBrasil/moip-sdk-php | src/Resource/CustomerCreditCard.php | CustomerCreditCard.populate | protected function populate(stdClass $response)
{
$funding = clone $this;
$funding->data->method = self::METHOD_CREDIT_CARD;
$funding->data->creditCard = new stdClass();
$funding->data->creditCard->id = $response->creditCard->id;
$funding->data->creditCard->brand = $response->creditCard->brand;
$funding->data->creditCard->first6 = $response->creditCard->first6;
$funding->data->creditCard->last4 = $response->creditCard->last4;
$funding->data->creditCard->store = $response->creditCard->store;
$funding->data->card = new stdClass();
$funding->data->card->brand = $response->card->brand;
$funding->data->card->store = $response->card->store;
return $funding;
} | php | protected function populate(stdClass $response)
{
$funding = clone $this;
$funding->data->method = self::METHOD_CREDIT_CARD;
$funding->data->creditCard = new stdClass();
$funding->data->creditCard->id = $response->creditCard->id;
$funding->data->creditCard->brand = $response->creditCard->brand;
$funding->data->creditCard->first6 = $response->creditCard->first6;
$funding->data->creditCard->last4 = $response->creditCard->last4;
$funding->data->creditCard->store = $response->creditCard->store;
$funding->data->card = new stdClass();
$funding->data->card->brand = $response->card->brand;
$funding->data->card->store = $response->card->store;
return $funding;
} | [
"protected",
"function",
"populate",
"(",
"stdClass",
"$",
"response",
")",
"{",
"$",
"funding",
"=",
"clone",
"$",
"this",
";",
"$",
"funding",
"->",
"data",
"->",
"method",
"=",
"self",
"::",
"METHOD_CREDIT_CARD",
";",
"$",
"funding",
"->",
"data",
"->... | Mount information of a determined object.
@param \stdClass $response
@return mixed | [
"Mount",
"information",
"of",
"a",
"determined",
"object",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/CustomerCreditCard.php#L54-L69 | train |
wirecardBrasil/moip-sdk-php | src/Resource/CustomerCreditCard.php | CustomerCreditCard.setTaxDocument | public function setTaxDocument($type, $number)
{
$this->data->creditCard->holder->taxDocument->type = $type;
$this->data->creditCard->holder->taxDocument->number = $number;
return $this;
} | php | public function setTaxDocument($type, $number)
{
$this->data->creditCard->holder->taxDocument->type = $type;
$this->data->creditCard->holder->taxDocument->number = $number;
return $this;
} | [
"public",
"function",
"setTaxDocument",
"(",
"$",
"type",
",",
"$",
"number",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"creditCard",
"->",
"holder",
"->",
"taxDocument",
"->",
"type",
"=",
"$",
"type",
";",
"$",
"this",
"->",
"data",
"->",
"creditCar... | Documento fiscal.
@param string $type Tipo do documento. Valores possíveis: CPF.
@param string $number Número do documento.
@return $this | [
"Documento",
"fiscal",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/CustomerCreditCard.php#L191-L197 | train |
wirecardBrasil/moip-sdk-php | src/Resource/CustomerCreditCard.php | CustomerCreditCard.setPhone | public function setPhone($country_code, $area_code, $number)
{
$this->data->creditCard->holder->phone->countryCode = $country_code;
$this->data->creditCard->holder->phone->areaCode = $area_code;
$this->data->creditCard->holder->phone->number = $number;
return $this;
} | php | public function setPhone($country_code, $area_code, $number)
{
$this->data->creditCard->holder->phone->countryCode = $country_code;
$this->data->creditCard->holder->phone->areaCode = $area_code;
$this->data->creditCard->holder->phone->number = $number;
return $this;
} | [
"public",
"function",
"setPhone",
"(",
"$",
"country_code",
",",
"$",
"area_code",
",",
"$",
"number",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"creditCard",
"->",
"holder",
"->",
"phone",
"->",
"countryCode",
"=",
"$",
"country_code",
";",
"$",
"this"... | Telefone do cliente.
@param int $country_code DDI (código internacional) do telefone. Valores possíveis: 55.
@param int $area_code Código de área do cliente. Limite de caracteres: (2).
@param int $number Número de telefone do cliente. Limite de caracteres: 9
@return $this | [
"Telefone",
"do",
"cliente",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/CustomerCreditCard.php#L208-L215 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.addItem | public function addItem($product, $quantity, $detail, $price, $category = 'OTHER_CATEGORIES')
{
if (!is_int($price)) {
throw new \UnexpectedValueException('Informe o valor do item como inteiro');
}
if (!is_int($quantity) || $quantity < 1) {
throw new \UnexpectedValueException('A quantidade do item deve ser um valor inteiro maior que 0');
}
$item = new stdClass();
$item->product = $product;
$item->quantity = $quantity;
$item->detail = $detail;
$item->price = $price;
$item->category = $category;
$this->data->items[] = $item;
return $this;
} | php | public function addItem($product, $quantity, $detail, $price, $category = 'OTHER_CATEGORIES')
{
if (!is_int($price)) {
throw new \UnexpectedValueException('Informe o valor do item como inteiro');
}
if (!is_int($quantity) || $quantity < 1) {
throw new \UnexpectedValueException('A quantidade do item deve ser um valor inteiro maior que 0');
}
$item = new stdClass();
$item->product = $product;
$item->quantity = $quantity;
$item->detail = $detail;
$item->price = $price;
$item->category = $category;
$this->data->items[] = $item;
return $this;
} | [
"public",
"function",
"addItem",
"(",
"$",
"product",
",",
"$",
"quantity",
",",
"$",
"detail",
",",
"$",
"price",
",",
"$",
"category",
"=",
"'OTHER_CATEGORIES'",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"price",
")",
")",
"{",
"throw",
"new",
... | Adds a new item to order.
@param string $product Name of the product.
@param int $quantity Product Quantity.
@param string $detail Additional product description.
@param int $price Initial value of the item.
@param string category Product category. see: https://dev.moip.com.br/v2.1/reference#tabela-de-categorias-de-produtos.
@return $this | [
"Adds",
"a",
"new",
"item",
"to",
"order",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L57-L76 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.addReceiver | public function addReceiver($moipAccount, $type, $fixed = null, $percentual = null, $feePayor = false)
{
$receiver = new stdClass();
$receiver->moipAccount = new stdClass();
$receiver->moipAccount->id = $moipAccount;
if (!empty($fixed)) {
$receiver->amount = new stdClass();
$receiver->amount->fixed = $fixed;
}
if (!empty($percentual)) {
$receiver->amount = new stdClass();
$receiver->amount->percentual = $percentual;
}
$receiver->feePayor = $feePayor;
$receiver->type = $type;
$this->data->receivers[] = $receiver;
return $this;
} | php | public function addReceiver($moipAccount, $type, $fixed = null, $percentual = null, $feePayor = false)
{
$receiver = new stdClass();
$receiver->moipAccount = new stdClass();
$receiver->moipAccount->id = $moipAccount;
if (!empty($fixed)) {
$receiver->amount = new stdClass();
$receiver->amount->fixed = $fixed;
}
if (!empty($percentual)) {
$receiver->amount = new stdClass();
$receiver->amount->percentual = $percentual;
}
$receiver->feePayor = $feePayor;
$receiver->type = $type;
$this->data->receivers[] = $receiver;
return $this;
} | [
"public",
"function",
"addReceiver",
"(",
"$",
"moipAccount",
",",
"$",
"type",
",",
"$",
"fixed",
"=",
"null",
",",
"$",
"percentual",
"=",
"null",
",",
"$",
"feePayor",
"=",
"false",
")",
"{",
"$",
"receiver",
"=",
"new",
"stdClass",
"(",
")",
";",... | Adds a new receiver to order.
@param string $moipAccount Id MoIP MoIP account that will receive payment values.
@param string $type Define qual o tipo de recebedor do pagamento, valores possíveis: PRIMARY, SECONDARY.
@param int $fixed Value that the receiver will receive.
@param int $percentual Percentual value that the receiver will receive. Possible values: 0 - 100
@param bool $feePayor Flag to know if receiver is the payer of Moip tax.
@return $this | [
"Adds",
"a",
"new",
"receiver",
"to",
"order",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L89-L108 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.initialize | protected function initialize()
{
$this->data = new stdClass();
$this->data->ownId = null;
$this->data->amount = new stdClass();
$this->data->amount->currency = self::AMOUNT_CURRENCY;
$this->data->amount->subtotals = new stdClass();
$this->data->items = [];
$this->data->receivers = [];
$this->data->checkoutPreferences = new stdClass();
$this->data->checkoutPreferences->redirectUrls = new stdClass();
$this->data->checkoutPreferences->installments = [];
} | php | protected function initialize()
{
$this->data = new stdClass();
$this->data->ownId = null;
$this->data->amount = new stdClass();
$this->data->amount->currency = self::AMOUNT_CURRENCY;
$this->data->amount->subtotals = new stdClass();
$this->data->items = [];
$this->data->receivers = [];
$this->data->checkoutPreferences = new stdClass();
$this->data->checkoutPreferences->redirectUrls = new stdClass();
$this->data->checkoutPreferences->installments = [];
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"ownId",
"=",
"null",
";",
"$",
"this",
"->",
"data",
"->",
"amount",
"=",
"new",
"stdClass",
"... | Initialize necessary used in some functions. | [
"Initialize",
"necessary",
"used",
"in",
"some",
"functions",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L113-L125 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.structure | private function structure(stdClass $response, $resource, $class)
{
$structures = [];
foreach ($response->$resource as $responseResource) {
$structure = new $class($this->orders->moip);
$structure->populate($responseResource);
$structures[] = $structure;
}
return $structures;
} | php | private function structure(stdClass $response, $resource, $class)
{
$structures = [];
foreach ($response->$resource as $responseResource) {
$structure = new $class($this->orders->moip);
$structure->populate($responseResource);
$structures[] = $structure;
}
return $structures;
} | [
"private",
"function",
"structure",
"(",
"stdClass",
"$",
"response",
",",
"$",
"resource",
",",
"$",
"class",
")",
"{",
"$",
"structures",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"response",
"->",
"$",
"resource",
"as",
"$",
"responseResource",
")",
... | Structure resource.
@param stdClass $response
@param string $resource
@param \Moip\Resource\Payment|\Moip\Resource\Refund|\Moip\Resource\Entry|\Moip\Resource\Event $class
@return array | [
"Structure",
"resource",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L185-L197 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.getList | public function getList(Pagination $pagination = null, Filters $filters = null, $qParam = '')
{
$orderList = new OrdersList($this->moip);
return $orderList->get($pagination, $filters, $qParam);
} | php | public function getList(Pagination $pagination = null, Filters $filters = null, $qParam = '')
{
$orderList = new OrdersList($this->moip);
return $orderList->get($pagination, $filters, $qParam);
} | [
"public",
"function",
"getList",
"(",
"Pagination",
"$",
"pagination",
"=",
"null",
",",
"Filters",
"$",
"filters",
"=",
"null",
",",
"$",
"qParam",
"=",
"''",
")",
"{",
"$",
"orderList",
"=",
"new",
"OrdersList",
"(",
"$",
"this",
"->",
"moip",
")",
... | Create a new Orders list instance.
@return \Moip\Resource\OrdersList | [
"Create",
"a",
"new",
"Orders",
"list",
"instance",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L565-L570 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.setAddition | public function setAddition($value)
{
if (!isset($this->data->amount->subtotals)) {
$this->data->amount->subtotals = new stdClass();
}
$this->data->amount->subtotals->addition = (float) $value;
return $this;
} | php | public function setAddition($value)
{
if (!isset($this->data->amount->subtotals)) {
$this->data->amount->subtotals = new stdClass();
}
$this->data->amount->subtotals->addition = (float) $value;
return $this;
} | [
"public",
"function",
"setAddition",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"->",
"amount",
"->",
"subtotals",
")",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"amount",
"->",
"subtotals",
"=",
"new",
"... | Set additional value to the item will be added to the value of the items.
@param int|float $value additional value to the item.
@return $this | [
"Set",
"additional",
"value",
"to",
"the",
"item",
"will",
"be",
"added",
"to",
"the",
"value",
"of",
"the",
"items",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L605-L613 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.setCustomerId | public function setCustomerId($id)
{
if (!isset($this->data->customer)) {
$this->data->customer = new stdClass();
}
$this->data->customer->id = $id;
return $this;
} | php | public function setCustomerId($id)
{
if (!isset($this->data->customer)) {
$this->data->customer = new stdClass();
}
$this->data->customer->id = $id;
return $this;
} | [
"public",
"function",
"setCustomerId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"->",
"customer",
")",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"customer",
"=",
"new",
"stdClass",
"(",
")",
";",
"}",
"$... | Set customer id associated with the order.
@param string $id Customer's id.
@return $this | [
"Set",
"customer",
"id",
"associated",
"with",
"the",
"order",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L636-L644 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.setDiscount | public function setDiscount($value)
{
$this->data->amount->subtotals->discount = (float) $value;
return $this;
} | php | public function setDiscount($value)
{
$this->data->amount->subtotals->discount = (float) $value;
return $this;
} | [
"public",
"function",
"setDiscount",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"amount",
"->",
"subtotals",
"->",
"discount",
"=",
"(",
"float",
")",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Set discounted value of the item will be subtracted from the total value of the items.
@param int|float $value discounted value.
@return $this | [
"Set",
"discounted",
"value",
"of",
"the",
"item",
"will",
"be",
"subtracted",
"from",
"the",
"total",
"value",
"of",
"the",
"items",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L653-L658 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.setShippingAmount | public function setShippingAmount($value)
{
$this->data->amount->subtotals->shipping = (float) $value;
return $this;
} | php | public function setShippingAmount($value)
{
$this->data->amount->subtotals->shipping = (float) $value;
return $this;
} | [
"public",
"function",
"setShippingAmount",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"amount",
"->",
"subtotals",
"->",
"shipping",
"=",
"(",
"float",
")",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Set shipping Amount.
@param float $value shipping Amount.
@return $this | [
"Set",
"shipping",
"Amount",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L697-L702 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Orders.php | Orders.addInstallmentCheckoutPreferences | public function addInstallmentCheckoutPreferences($quantity, $discountValue = 0, $additionalValue = 0)
{
$installmentPreferences = new stdClass();
$installmentPreferences->quantity = $quantity;
$installmentPreferences->discount = $discountValue;
$installmentPreferences->addition = $additionalValue;
$this->data->checkoutPreferences->installments[] = $installmentPreferences;
return $this;
} | php | public function addInstallmentCheckoutPreferences($quantity, $discountValue = 0, $additionalValue = 0)
{
$installmentPreferences = new stdClass();
$installmentPreferences->quantity = $quantity;
$installmentPreferences->discount = $discountValue;
$installmentPreferences->addition = $additionalValue;
$this->data->checkoutPreferences->installments[] = $installmentPreferences;
return $this;
} | [
"public",
"function",
"addInstallmentCheckoutPreferences",
"(",
"$",
"quantity",
",",
"$",
"discountValue",
"=",
"0",
",",
"$",
"additionalValue",
"=",
"0",
")",
"{",
"$",
"installmentPreferences",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"installmentPreferen... | Set installment settings for checkout preferences.
@param array $quantity
@param int $discountValue
@param int $additionalValue
@return $this | [
"Set",
"installment",
"settings",
"for",
"checkout",
"preferences",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Orders.php#L741-L751 | train |
wirecardBrasil/moip-sdk-php | src/Resource/BankAccountList.php | BankAccountList.get | public function get($account_id)
{
return $this->getByPath(sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH_ACCOUNT, $account_id, self::PATH));
} | php | public function get($account_id)
{
return $this->getByPath(sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH_ACCOUNT, $account_id, self::PATH));
} | [
"public",
"function",
"get",
"(",
"$",
"account_id",
")",
"{",
"return",
"$",
"this",
"->",
"getByPath",
"(",
"sprintf",
"(",
"'/%s/%s/%s/%s'",
",",
"MoipResource",
"::",
"VERSION",
",",
"self",
"::",
"PATH_ACCOUNT",
",",
"$",
"account_id",
",",
"self",
":... | Get a bank accounts list.
@param string Account id.
@return stdClass | [
"Get",
"a",
"bank",
"accounts",
"list",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/BankAccountList.php#L48-L51 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Refund.php | Refund.execute | private function execute(stdClass $data = null, $resourceId = null)
{
$body = empty($data) ? new stdClass() : $data;
$response = $this->httpRequest($this->getPath($resourceId), Requests::POST, $body);
return $this->populate($response);
} | php | private function execute(stdClass $data = null, $resourceId = null)
{
$body = empty($data) ? new stdClass() : $data;
$response = $this->httpRequest($this->getPath($resourceId), Requests::POST, $body);
return $this->populate($response);
} | [
"private",
"function",
"execute",
"(",
"stdClass",
"$",
"data",
"=",
"null",
",",
"$",
"resourceId",
"=",
"null",
")",
"{",
"$",
"body",
"=",
"empty",
"(",
"$",
"data",
")",
"?",
"new",
"stdClass",
"(",
")",
":",
"$",
"data",
";",
"$",
"response",
... | Create a new refund in api MoIP.
@param stdClass $data
@return $this | [
"Create",
"a",
"new",
"refund",
"in",
"api",
"MoIP",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Refund.php#L159-L165 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Refund.php | Refund.getPath | private function getPath($resourceId = null)
{
if (!is_null($resourceId)) {
$endpoint = ($this->isOrder($resourceId) ? Orders::PATH : Payment::PATH);
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, $endpoint, $resourceId, self::PATH);
}
if ($this->order !== null) {
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Orders::PATH, $this->order->getId(), self::PATH);
}
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Payment::PATH, $this->payment->getId(), self::PATH);
} | php | private function getPath($resourceId = null)
{
if (!is_null($resourceId)) {
$endpoint = ($this->isOrder($resourceId) ? Orders::PATH : Payment::PATH);
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, $endpoint, $resourceId, self::PATH);
}
if ($this->order !== null) {
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Orders::PATH, $this->order->getId(), self::PATH);
}
return sprintf('/%s/%s/%s/%s', MoipResource::VERSION, Payment::PATH, $this->payment->getId(), self::PATH);
} | [
"private",
"function",
"getPath",
"(",
"$",
"resourceId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"resourceId",
")",
")",
"{",
"$",
"endpoint",
"=",
"(",
"$",
"this",
"->",
"isOrder",
"(",
"$",
"resourceId",
")",
"?",
"Orders",
... | Checks path that will be the request.
@return string | [
"Checks",
"path",
"that",
"will",
"be",
"the",
"request",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Refund.php#L172-L185 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Refund.php | Refund.bankAccountPartial | public function bankAccountPartial($amount, $type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder)
{
$data = $this->bankAccountDataCustomer($type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, $holder);
$data->amount = $amount;
return $this->execute($data);
} | php | public function bankAccountPartial($amount, $type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, Customer $holder)
{
$data = $this->bankAccountDataCustomer($type, $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, $holder);
$data->amount = $amount;
return $this->execute($data);
} | [
"public",
"function",
"bankAccountPartial",
"(",
"$",
"amount",
",",
"$",
"type",
",",
"$",
"bankNumber",
",",
"$",
"agencyNumber",
",",
"$",
"agencyCheckNumber",
",",
"$",
"accountNumber",
",",
"$",
"accountCheckNumber",
",",
"Customer",
"$",
"holder",
")",
... | Making a partial refund in the bank account.
@param string $type Kind of bank account. possible values: CHECKING, SAVING.
@param string $bankNumber Bank number. possible values: 001, 237, 341, 041.
@param int $agencyNumber Branch number.
@param int $agencyCheckNumber Checksum of the agency.
@param int $accountNumber Account number.
@param int $accountCheckNumber Digit account checker.
@param \Moip\Resource\Customer $holder
@return Refund | [
"Making",
"a",
"partial",
"refund",
"in",
"the",
"bank",
"account",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Refund.php#L282-L288 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Refund.php | Refund.creditCardPartial | public function creditCardPartial($amount)
{
$data = new stdClass();
$data->amount = $amount;
return $this->execute($data);
} | php | public function creditCardPartial($amount)
{
$data = new stdClass();
$data->amount = $amount;
return $this->execute($data);
} | [
"public",
"function",
"creditCardPartial",
"(",
"$",
"amount",
")",
"{",
"$",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"data",
"->",
"amount",
"=",
"$",
"amount",
";",
"return",
"$",
"this",
"->",
"execute",
"(",
"$",
"data",
")",
";",
"... | Making a partial refund in credit card.
@param int|float $amount value of refund.
@return \Moip\Resource\Refund | [
"Making",
"a",
"partial",
"refund",
"in",
"credit",
"card",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Refund.php#L307-L313 | train |
wirecardBrasil/moip-sdk-php | src/Resource/Refund.php | Refund.getIterator | public function getIterator()
{
$refunds = [];
$response = $this->httpRequest($this->getPath(), Requests::GET);
foreach ($response->refunds as $refund) {
$refunds[] = $this->populate($refund);
}
return new ArrayIterator($refunds);
} | php | public function getIterator()
{
$refunds = [];
$response = $this->httpRequest($this->getPath(), Requests::GET);
foreach ($response->refunds as $refund) {
$refunds[] = $this->populate($refund);
}
return new ArrayIterator($refunds);
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"refunds",
"=",
"[",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"httpRequest",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"Requests",
"::",
"GET",
")",
";",
"foreach",
"(",
"$"... | Get iterator.
@return \ArrayIterator | [
"Get",
"iterator",
"."
] | 28610a664c0058fa77d1b956a6506591376d39f2 | https://github.com/wirecardBrasil/moip-sdk-php/blob/28610a664c0058fa77d1b956a6506591376d39f2/src/Resource/Refund.php#L320-L329 | train |
ezsystems/ezplatform-richtext | src/bundle/DependencyInjection/EzPlatformRichTextExtension.php | EzPlatformRichTextExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$ezLoader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../../lib/eZ/settings')
);
$ezLoader->load('fieldtypes.yml');
$ezLoader->load('fieldtype_services.yml');
$ezLoader->load('fieldtype_external_storages.yml');
$ezLoader->load('indexable_fieldtypes.yml');
$ezLoader->load('storage_engines/legacy/external_storage_gateways.yml');
$ezLoader->load('storage_engines/legacy/field_value_converters.yml');
$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
);
$loader->load('fieldtype_services.yml');
$loader->load('rest.yml');
$loader->load('templating.yml');
$loader->load('form.yml');
// load Kernel BC layer
$loader->load('bc/aliases.yml');
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$this->registerRichTextConfiguration($config, $container);
} | php | public function load(array $configs, ContainerBuilder $container)
{
$ezLoader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../../lib/eZ/settings')
);
$ezLoader->load('fieldtypes.yml');
$ezLoader->load('fieldtype_services.yml');
$ezLoader->load('fieldtype_external_storages.yml');
$ezLoader->load('indexable_fieldtypes.yml');
$ezLoader->load('storage_engines/legacy/external_storage_gateways.yml');
$ezLoader->load('storage_engines/legacy/field_value_converters.yml');
$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
);
$loader->load('fieldtype_services.yml');
$loader->load('rest.yml');
$loader->load('templating.yml');
$loader->load('form.yml');
// load Kernel BC layer
$loader->load('bc/aliases.yml');
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$this->registerRichTextConfiguration($config, $container);
} | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"ezLoader",
"=",
"new",
"Loader",
"\\",
"YamlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../../li... | Load eZ Platform RichText Field Type Bundle configuration.
@param array $configs
@param \Symfony\Component\DependencyInjection\ContainerBuilder $container | [
"Load",
"eZ",
"Platform",
"RichText",
"Field",
"Type",
"Bundle",
"configuration",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/bundle/DependencyInjection/EzPlatformRichTextExtension.php#L53-L81 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/Converter/Render/Template.php | Template.extractTemplateConfiguration | protected function extractTemplateConfiguration(DOMElement $template, DOMXPath $xpath)
{
$configElements = $xpath->query('./docbook:ezconfig', $template);
if (0 === $configElements->length) {
return [];
}
return $this->extractHash($configElements->item(0));
} | php | protected function extractTemplateConfiguration(DOMElement $template, DOMXPath $xpath)
{
$configElements = $xpath->query('./docbook:ezconfig', $template);
if (0 === $configElements->length) {
return [];
}
return $this->extractHash($configElements->item(0));
} | [
"protected",
"function",
"extractTemplateConfiguration",
"(",
"DOMElement",
"$",
"template",
",",
"DOMXPath",
"$",
"xpath",
")",
"{",
"$",
"configElements",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'./docbook:ezconfig'",
",",
"$",
"template",
")",
";",
"if",
"(... | Extract configuration hash from a template.
@param \DOMElement $template
@param \DOMXPath $xpath
@return array | [
"Extract",
"configuration",
"hash",
"from",
"a",
"template",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/Converter/Render/Template.php#L215-L223 | train |
ezsystems/ezplatform-richtext | src/bundle/DependencyInjection/Configuration.php | Configuration.addCustomTagsSection | private function addCustomTagsSection(NodeBuilder $ezRichTextNode)
{
return $ezRichTextNode
->arrayNode('custom_tags')
// workaround: take into account Custom Tag names when merging configs
->useAttributeAsKey('tag')
->arrayPrototype()
->children()
->scalarNode('template')
->isRequired()
->end()
->scalarNode('icon')
->defaultNull()
->end()
->scalarNode('is_inline')
->defaultFalse()
->end()
->arrayNode('attributes')
->useAttributeAsKey('attribute')
->arrayPrototype()
->beforeNormalization()
->always(
function ($v) {
// Workaround: set empty value to be able to unset it later on (see validation for "choices")
if (!isset($v['choices'])) {
$v['choices'] = [];
}
return $v;
}
)
->end()
->validate()
->ifTrue(
function ($v) {
return $v['type'] === 'choice' && !empty($v['required']) && empty($v['choices']);
}
)
->thenInvalid('List of choices for required choice type attribute has to be non-empty')
->end()
->validate()
->ifTrue(
function ($v) {
return !empty($v['choices']) && $v['type'] !== 'choice';
}
)
->thenInvalid('List of choices is supported by choices type only.')
->end()
->children()
->enumNode('type')
->isRequired()
->values(static::CUSTOM_TAG_ATTRIBUTE_TYPES)
->end()
->booleanNode('required')
->defaultFalse()
->end()
->scalarNode('default_value')
->defaultNull()
->end()
->arrayNode('choices')
->scalarPrototype()->end()
->performNoDeepMerging()
->validate()
->ifEmpty()->thenUnset()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
;
} | php | private function addCustomTagsSection(NodeBuilder $ezRichTextNode)
{
return $ezRichTextNode
->arrayNode('custom_tags')
// workaround: take into account Custom Tag names when merging configs
->useAttributeAsKey('tag')
->arrayPrototype()
->children()
->scalarNode('template')
->isRequired()
->end()
->scalarNode('icon')
->defaultNull()
->end()
->scalarNode('is_inline')
->defaultFalse()
->end()
->arrayNode('attributes')
->useAttributeAsKey('attribute')
->arrayPrototype()
->beforeNormalization()
->always(
function ($v) {
// Workaround: set empty value to be able to unset it later on (see validation for "choices")
if (!isset($v['choices'])) {
$v['choices'] = [];
}
return $v;
}
)
->end()
->validate()
->ifTrue(
function ($v) {
return $v['type'] === 'choice' && !empty($v['required']) && empty($v['choices']);
}
)
->thenInvalid('List of choices for required choice type attribute has to be non-empty')
->end()
->validate()
->ifTrue(
function ($v) {
return !empty($v['choices']) && $v['type'] !== 'choice';
}
)
->thenInvalid('List of choices is supported by choices type only.')
->end()
->children()
->enumNode('type')
->isRequired()
->values(static::CUSTOM_TAG_ATTRIBUTE_TYPES)
->end()
->booleanNode('required')
->defaultFalse()
->end()
->scalarNode('default_value')
->defaultNull()
->end()
->arrayNode('choices')
->scalarPrototype()->end()
->performNoDeepMerging()
->validate()
->ifEmpty()->thenUnset()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
;
} | [
"private",
"function",
"addCustomTagsSection",
"(",
"NodeBuilder",
"$",
"ezRichTextNode",
")",
"{",
"return",
"$",
"ezRichTextNode",
"->",
"arrayNode",
"(",
"'custom_tags'",
")",
"// workaround: take into account Custom Tag names when merging configs",
"->",
"useAttributeAsKey"... | Define RichText Custom Tags Semantic Configuration.
The configuration is available at:
<code>
ezrichtext:
custom_tags:
</code>
@param \Symfony\Component\Config\Definition\Builder\NodeBuilder $ezRichTextNode
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Define",
"RichText",
"Custom",
"Tags",
"Semantic",
"Configuration",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/bundle/DependencyInjection/Configuration.php#L54-L127 | train |
ezsystems/ezplatform-richtext | src/bundle/DependencyInjection/Configuration.php | Configuration.addAlloyEditorSection | private function addAlloyEditorSection(NodeBuilder $ezRichTextNode)
{
return $ezRichTextNode
->arrayNode('alloy_editor')
->children()
->arrayNode('extra_plugins')
->example(['plugin1', 'plugin2'])
->prototype('scalar')->end()
->end()
->arrayNode('extra_buttons')
->arrayPrototype()
->example(['button1', 'button2'])
->prototype('scalar')->end()
->end()
->end()
->end()
->end()
;
} | php | private function addAlloyEditorSection(NodeBuilder $ezRichTextNode)
{
return $ezRichTextNode
->arrayNode('alloy_editor')
->children()
->arrayNode('extra_plugins')
->example(['plugin1', 'plugin2'])
->prototype('scalar')->end()
->end()
->arrayNode('extra_buttons')
->arrayPrototype()
->example(['button1', 'button2'])
->prototype('scalar')->end()
->end()
->end()
->end()
->end()
;
} | [
"private",
"function",
"addAlloyEditorSection",
"(",
"NodeBuilder",
"$",
"ezRichTextNode",
")",
"{",
"return",
"$",
"ezRichTextNode",
"->",
"arrayNode",
"(",
"'alloy_editor'",
")",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'extra_plugins'",
")",
"->",
... | Define RichText AlloyEditor Semantic Configuration.
The configuration is available at:
<code>
ezpublish:
ezrichtext:
alloy_editor:
extra_plugins: [plugin1, plugin2]
extra_buttons:
paragraph: [button1, button2]
embed: [button1]
</code>
Please note extra_buttons setting will be deprecated in eZ Platform 3.x.
The alternative and more flexible solution will be introduced.
So you will need to update Online Editor Extra Buttons as part of eZ Platform 3.x upgrade.
@param \Symfony\Component\Config\Definition\Builder\NodeBuilder $ezRichTextNode
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Define",
"RichText",
"AlloyEditor",
"Semantic",
"Configuration",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/bundle/DependencyInjection/Configuration.php#L185-L203 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/Converter/Render.php | Render.extractConfiguration | protected function extractConfiguration(DOMElement $embed)
{
$hash = [];
$configElements = $embed->getElementsByTagName('ezconfig');
if ($configElements->length) {
$hash = $this->extractHash($configElements->item(0));
}
return $hash;
} | php | protected function extractConfiguration(DOMElement $embed)
{
$hash = [];
$configElements = $embed->getElementsByTagName('ezconfig');
if ($configElements->length) {
$hash = $this->extractHash($configElements->item(0));
}
return $hash;
} | [
"protected",
"function",
"extractConfiguration",
"(",
"DOMElement",
"$",
"embed",
")",
"{",
"$",
"hash",
"=",
"[",
"]",
";",
"$",
"configElements",
"=",
"$",
"embed",
"->",
"getElementsByTagName",
"(",
"'ezconfig'",
")",
";",
"if",
"(",
"$",
"configElements"... | Extracts configuration hash from embed element.
@param \DOMElement $embed
@return array | [
"Extracts",
"configuration",
"hash",
"from",
"embed",
"element",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/Converter/Render.php#L37-L47 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/Converter/Render.php | Render.extractHash | protected function extractHash(DOMNode $configHash)
{
$hash = [];
foreach ($configHash->childNodes as $node) {
/** @var \DOMText|\DOMElement $node */
if ($node->nodeType === XML_ELEMENT_NODE) {
$hash[$node->getAttribute('key')] = $this->extractHash($node);
} elseif ($node->nodeType === XML_TEXT_NODE && !$node->isWhitespaceInElementContent()) {
return $node->wholeText;
}
}
return $hash;
} | php | protected function extractHash(DOMNode $configHash)
{
$hash = [];
foreach ($configHash->childNodes as $node) {
/** @var \DOMText|\DOMElement $node */
if ($node->nodeType === XML_ELEMENT_NODE) {
$hash[$node->getAttribute('key')] = $this->extractHash($node);
} elseif ($node->nodeType === XML_TEXT_NODE && !$node->isWhitespaceInElementContent()) {
return $node->wholeText;
}
}
return $hash;
} | [
"protected",
"function",
"extractHash",
"(",
"DOMNode",
"$",
"configHash",
")",
"{",
"$",
"hash",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"configHash",
"->",
"childNodes",
"as",
"$",
"node",
")",
"{",
"/** @var \\DOMText|\\DOMElement $node */",
"if",
"(",
"... | Recursively extracts data from XML hash structure.
@param \DOMNode $configHash
@return array | [
"Recursively",
"extracts",
"data",
"from",
"XML",
"hash",
"structure",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/Converter/Render.php#L56-L70 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/Converter/Render/Embed.php | Embed.extractLinkParameters | protected function extractLinkParameters(DOMElement $embed)
{
$links = $embed->getElementsByTagName('ezlink');
if ($links->length !== 1) {
return null;
}
/** @var \DOMElement $link */
$link = $links->item(0);
$hrefResolved = $link->getAttribute('href_resolved');
if (empty($hrefResolved)) {
$this->logger->error('Could not create link parameters: resolved embed link is missing');
return null;
}
$href = $link->getAttribute('xlink:href');
$target = $link->getAttribute('xlink:show');
$target = $this->mapLinkTarget($target);
$title = $link->getAttribute('xlink:title');
$id = $link->getAttribute('xml:id');
$class = $link->getAttribute('ezxhtml:class');
if (strpos($href, 'ezcontent://') === 0) {
$resourceType = 'CONTENT';
$resourceId = substr($href, strlen('ezcontent://'));
} elseif (strpos($href, 'ezlocation://') === 0) {
$resourceType = 'LOCATION';
$resourceId = substr($href, strlen('ezlocation://'));
} else {
// If link is not Content or Location based, it must be an URL (Url field type) link
$resourceType = 'URL';
// ATM there is no way to find out the URL's ID here.
// The whole implementation is actually lacking:
// UrlService which would be used here and in Url and RichText field type's external storage,
// but also for admin UI.
// With it resolving Url links in the RichText external storage when loading should be removed.
// Data should be returned as is, and resolving should happen when needed, which is:
// - in Link converter for links
// - here for embeds
$resourceId = null;
}
$fragmentPosition = isset($resourceId) ? strpos($resourceId, '#') : false;
if ($fragmentPosition !== false) {
$resourceFragmentIdentifier = substr($resourceId, $fragmentPosition + 1);
$resourceId = substr($resourceId, 0, $fragmentPosition);
}
$parameters = [
'href' => $hrefResolved,
'resourceType' => $resourceType,
'resourceId' => $resourceId,
'wrapped' => $this->isLinkWrapped($embed),
];
if (!empty($resourceFragmentIdentifier)) {
$parameters['resourceFragmentIdentifier'] = $resourceFragmentIdentifier;
}
if (!empty($target)) {
$parameters['target'] = $target;
}
if (!empty($title)) {
$parameters['title'] = $title;
}
if (!empty($id)) {
$parameters['id'] = $id;
}
if (!empty($class)) {
$parameters['class'] = $class;
}
return $parameters;
} | php | protected function extractLinkParameters(DOMElement $embed)
{
$links = $embed->getElementsByTagName('ezlink');
if ($links->length !== 1) {
return null;
}
/** @var \DOMElement $link */
$link = $links->item(0);
$hrefResolved = $link->getAttribute('href_resolved');
if (empty($hrefResolved)) {
$this->logger->error('Could not create link parameters: resolved embed link is missing');
return null;
}
$href = $link->getAttribute('xlink:href');
$target = $link->getAttribute('xlink:show');
$target = $this->mapLinkTarget($target);
$title = $link->getAttribute('xlink:title');
$id = $link->getAttribute('xml:id');
$class = $link->getAttribute('ezxhtml:class');
if (strpos($href, 'ezcontent://') === 0) {
$resourceType = 'CONTENT';
$resourceId = substr($href, strlen('ezcontent://'));
} elseif (strpos($href, 'ezlocation://') === 0) {
$resourceType = 'LOCATION';
$resourceId = substr($href, strlen('ezlocation://'));
} else {
// If link is not Content or Location based, it must be an URL (Url field type) link
$resourceType = 'URL';
// ATM there is no way to find out the URL's ID here.
// The whole implementation is actually lacking:
// UrlService which would be used here and in Url and RichText field type's external storage,
// but also for admin UI.
// With it resolving Url links in the RichText external storage when loading should be removed.
// Data should be returned as is, and resolving should happen when needed, which is:
// - in Link converter for links
// - here for embeds
$resourceId = null;
}
$fragmentPosition = isset($resourceId) ? strpos($resourceId, '#') : false;
if ($fragmentPosition !== false) {
$resourceFragmentIdentifier = substr($resourceId, $fragmentPosition + 1);
$resourceId = substr($resourceId, 0, $fragmentPosition);
}
$parameters = [
'href' => $hrefResolved,
'resourceType' => $resourceType,
'resourceId' => $resourceId,
'wrapped' => $this->isLinkWrapped($embed),
];
if (!empty($resourceFragmentIdentifier)) {
$parameters['resourceFragmentIdentifier'] = $resourceFragmentIdentifier;
}
if (!empty($target)) {
$parameters['target'] = $target;
}
if (!empty($title)) {
$parameters['title'] = $title;
}
if (!empty($id)) {
$parameters['id'] = $id;
}
if (!empty($class)) {
$parameters['class'] = $class;
}
return $parameters;
} | [
"protected",
"function",
"extractLinkParameters",
"(",
"DOMElement",
"$",
"embed",
")",
"{",
"$",
"links",
"=",
"$",
"embed",
"->",
"getElementsByTagName",
"(",
"'ezlink'",
")",
";",
"if",
"(",
"$",
"links",
"->",
"length",
"!==",
"1",
")",
"{",
"return",
... | Extracts link parameters from embed element.
@param \DOMElement $embed
@return array | [
"Extracts",
"link",
"parameters",
"from",
"embed",
"element",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/Converter/Render/Embed.php#L164-L245 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/Converter/Render/Embed.php | Embed.isLinkWrapped | protected function isLinkWrapped(DOMElement $element)
{
$parentNode = $element->parentNode;
if ($parentNode instanceof DOMDocument) {
return false;
} elseif ($parentNode->localName === 'link') {
$childCount = 0;
/** @var \DOMText|\DOMElement $node */
foreach ($parentNode->childNodes as $node) {
if (!($node->nodeType === XML_TEXT_NODE && $node->isWhitespaceInElementContent())) {
++$childCount;
}
}
if ($childCount === 1) {
return false;
} else {
return true;
}
}
return $this->isLinkWrapped($parentNode);
} | php | protected function isLinkWrapped(DOMElement $element)
{
$parentNode = $element->parentNode;
if ($parentNode instanceof DOMDocument) {
return false;
} elseif ($parentNode->localName === 'link') {
$childCount = 0;
/** @var \DOMText|\DOMElement $node */
foreach ($parentNode->childNodes as $node) {
if (!($node->nodeType === XML_TEXT_NODE && $node->isWhitespaceInElementContent())) {
++$childCount;
}
}
if ($childCount === 1) {
return false;
} else {
return true;
}
}
return $this->isLinkWrapped($parentNode);
} | [
"protected",
"function",
"isLinkWrapped",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"parentNode",
"=",
"$",
"element",
"->",
"parentNode",
";",
"if",
"(",
"$",
"parentNode",
"instanceof",
"DOMDocument",
")",
"{",
"return",
"false",
";",
"}",
"elseif"... | Returns boolean signifying if the embed is contained in a link element of not.
After EmbedLinking converter pass this should be possible only for inline level embeds.
@param \DOMElement $element
@return bool | [
"Returns",
"boolean",
"signifying",
"if",
"the",
"embed",
"is",
"contained",
"in",
"a",
"link",
"element",
"of",
"not",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/Converter/Render/Embed.php#L270-L294 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/FieldType/RichText/RichTextStorage/Gateway/LegacyStorage.php | LegacyStorage.getContentIds | public function getContentIds(array $remoteIds)
{
$objectRemoteIdMap = [];
if (!empty($remoteIds)) {
$q = $this->getConnection()->createSelectQuery();
$q
->select('id', 'remote_id')
->from('ezcontentobject')
->where($q->expr->in('remote_id', $remoteIds));
$statement = $q->prepare();
$statement->execute();
foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$objectRemoteIdMap[$row['remote_id']] = $row['id'];
}
}
return $objectRemoteIdMap;
} | php | public function getContentIds(array $remoteIds)
{
$objectRemoteIdMap = [];
if (!empty($remoteIds)) {
$q = $this->getConnection()->createSelectQuery();
$q
->select('id', 'remote_id')
->from('ezcontentobject')
->where($q->expr->in('remote_id', $remoteIds));
$statement = $q->prepare();
$statement->execute();
foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$objectRemoteIdMap[$row['remote_id']] = $row['id'];
}
}
return $objectRemoteIdMap;
} | [
"public",
"function",
"getContentIds",
"(",
"array",
"$",
"remoteIds",
")",
"{",
"$",
"objectRemoteIdMap",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"remoteIds",
")",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",... | Returns a list of Content ids for a list of remote ids.
Non-existent ids are ignored.
@param array $remoteIds An array of Content remote ids
@return array An array of Content ids, with remote ids as keys | [
"Returns",
"a",
"list",
"of",
"Content",
"ids",
"for",
"a",
"list",
"of",
"remote",
"ids",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/FieldType/RichText/RichTextStorage/Gateway/LegacyStorage.php#L54-L73 | train |
ezsystems/ezplatform-richtext | src/bundle/eZ/RichText/Renderer.php | Renderer.checkContentPermissions | protected function checkContentPermissions(Content $content)
{
// Check both 'content/read' and 'content/view_embed'.
if (
!$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'read', ['valueObject' => $content])
)
&& !$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'view_embed', ['valueObject' => $content])
)
) {
throw new AccessDeniedException();
}
// Check that Content is published, since sudo allows loading unpublished content.
if (
!$content->getVersionInfo()->isPublished()
&& !$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'versionread', ['valueObject' => $content])
)
) {
throw new AccessDeniedException();
}
} | php | protected function checkContentPermissions(Content $content)
{
// Check both 'content/read' and 'content/view_embed'.
if (
!$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'read', ['valueObject' => $content])
)
&& !$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'view_embed', ['valueObject' => $content])
)
) {
throw new AccessDeniedException();
}
// Check that Content is published, since sudo allows loading unpublished content.
if (
!$content->getVersionInfo()->isPublished()
&& !$this->authorizationChecker->isGranted(
new AuthorizationAttribute('content', 'versionread', ['valueObject' => $content])
)
) {
throw new AccessDeniedException();
}
} | [
"protected",
"function",
"checkContentPermissions",
"(",
"Content",
"$",
"content",
")",
"{",
"// Check both 'content/read' and 'content/view_embed'.",
"if",
"(",
"!",
"$",
"this",
"->",
"authorizationChecker",
"->",
"isGranted",
"(",
"new",
"AuthorizationAttribute",
"(",... | Check embed permissions for the given Content.
@throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
@param \eZ\Publish\API\Repository\Values\Content\Content $content | [
"Check",
"embed",
"permissions",
"for",
"the",
"given",
"Content",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/bundle/eZ/RichText/Renderer.php#L488-L511 | train |
ezsystems/ezplatform-richtext | src/lib/eZ/RichText/XmlBase.php | XmlBase.collectErrors | protected function collectErrors()
{
if ($this->useInternalErrors === null) {
throw new RuntimeException('Error recording not started');
}
$xmlErrors = libxml_get_errors();
$errors = [];
foreach ($xmlErrors as $error) {
$errors[] = $this->formatLibXmlError($error);
}
libxml_clear_errors();
libxml_use_internal_errors($this->useInternalErrors);
$this->useInternalErrors = null;
return $errors;
} | php | protected function collectErrors()
{
if ($this->useInternalErrors === null) {
throw new RuntimeException('Error recording not started');
}
$xmlErrors = libxml_get_errors();
$errors = [];
foreach ($xmlErrors as $error) {
$errors[] = $this->formatLibXmlError($error);
}
libxml_clear_errors();
libxml_use_internal_errors($this->useInternalErrors);
$this->useInternalErrors = null;
return $errors;
} | [
"protected",
"function",
"collectErrors",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useInternalErrors",
"===",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Error recording not started'",
")",
";",
"}",
"$",
"xmlErrors",
"=",
"libxml_get_error... | Returns formatted errors from libxml error buffer and restores previous setting
for libxml error handling.
Before calling this method error recording must be started by calling {@link startRecordingErrors()}.
@see startRecordingErrors()
@uses ::formatLibXmlError()
@throws \RuntimeException If error recording is not started
@return string[] | [
"Returns",
"formatted",
"errors",
"from",
"libxml",
"error",
"buffer",
"and",
"restores",
"previous",
"setting",
"for",
"libxml",
"error",
"handling",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/lib/eZ/RichText/XmlBase.php#L100-L116 | train |
ezsystems/ezplatform-richtext | src/bundle/DependencyInjection/Configuration/Parser/FieldType/RichText.php | RichText.setupDeprecatedConfiguration | private function setupDeprecatedConfiguration(NodeBuilder $nodeBuilder)
{
$nodeBuilder
->arrayNode('output_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('edit_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('input_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('RichText template tags configuration.')
->useAttributeAsKey('key')
->normalizeKeys(false)
->prototype('array')
->info(
"Name of RichText template tag.\n" .
"'default' and 'default_inline' tag names are reserved for fallback."
)
->example('math_equation')
->children()
->append(
$this->getTemplateNodeDefinition(
'Template used for rendering RichText template tag.',
'MyBundle:FieldType/RichText/tag:math_equation.html.twig'
)
)
->variableNode('config')
->info('Tag configuration, arbitrary configuration is allowed here.')
->end()
->end()
->end()
->end()
;
} | php | private function setupDeprecatedConfiguration(NodeBuilder $nodeBuilder)
{
$nodeBuilder
->arrayNode('output_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('edit_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('input_custom_tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".')
->example(
[
'path' => '%kernel.root_dir%/../src/Acme/TestBundle/Resources/myTag.xsl',
'priority' => 10,
]
)
->prototype('array')
->children()
->scalarNode('path')
->info('Path of the XSL stylesheet to load.')
->isRequired()
->end()
->integerNode('priority')
->info('Priority in the loading order. A high value will have higher precedence in overriding XSL templates.')
->defaultValue(0)
->end()
->end()
->end()
->end()
->arrayNode('tags')
->setDeprecated('DEPRECATED. Configure custom tags using custom_tags node')
->info('RichText template tags configuration.')
->useAttributeAsKey('key')
->normalizeKeys(false)
->prototype('array')
->info(
"Name of RichText template tag.\n" .
"'default' and 'default_inline' tag names are reserved for fallback."
)
->example('math_equation')
->children()
->append(
$this->getTemplateNodeDefinition(
'Template used for rendering RichText template tag.',
'MyBundle:FieldType/RichText/tag:math_equation.html.twig'
)
)
->variableNode('config')
->info('Tag configuration, arbitrary configuration is allowed here.')
->end()
->end()
->end()
->end()
;
} | [
"private",
"function",
"setupDeprecatedConfiguration",
"(",
"NodeBuilder",
"$",
"nodeBuilder",
")",
"{",
"$",
"nodeBuilder",
"->",
"arrayNode",
"(",
"'output_custom_tags'",
")",
"->",
"setDeprecated",
"(",
"'DEPRECATED. Configure custom tags using custom_tags node'",
")",
"... | Add BC setup for deprecated configuration.
Note: kept in separate method for readability.
@param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder | [
"Add",
"BC",
"setup",
"for",
"deprecated",
"configuration",
"."
] | d5662994c6768b3c9a3a51307ebbdb1370e3228c | https://github.com/ezsystems/ezplatform-richtext/blob/d5662994c6768b3c9a3a51307ebbdb1370e3228c/src/bundle/DependencyInjection/Configuration/Parser/FieldType/RichText.php#L261-L355 | train |
coenjacobs/mozart | src/Console/Commands/Compose.php | Compose.movePackage | public function movePackage($package)
{
if (! empty($package->dependencies)) {
foreach ($package->dependencies as $dependency) {
$this->movePackage($dependency);
}
}
$this->mover->movePackage($package);
} | php | public function movePackage($package)
{
if (! empty($package->dependencies)) {
foreach ($package->dependencies as $dependency) {
$this->movePackage($dependency);
}
}
$this->mover->movePackage($package);
} | [
"public",
"function",
"movePackage",
"(",
"$",
"package",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"package",
"->",
"dependencies",
")",
")",
"{",
"foreach",
"(",
"$",
"package",
"->",
"dependencies",
"as",
"$",
"dependency",
")",
"{",
"$",
"this",... | Move all the packages over, one by one, starting on the deepest level of dependencies. | [
"Move",
"all",
"the",
"packages",
"over",
"one",
"by",
"one",
"starting",
"on",
"the",
"deepest",
"level",
"of",
"dependencies",
"."
] | bcdc1a1253824accca1b244f98e4e652e0911262 | https://github.com/coenjacobs/mozart/blob/bcdc1a1253824accca1b244f98e4e652e0911262/src/Console/Commands/Compose.php#L86-L95 | train |
coenjacobs/mozart | src/Console/Commands/Compose.php | Compose.replacePackage | public function replacePackage($package)
{
if (! empty($package->dependencies)) {
foreach ($package->dependencies as $dependency) {
$this->replacePackage($dependency);
}
}
$this->replacer->replacePackage($package);
} | php | public function replacePackage($package)
{
if (! empty($package->dependencies)) {
foreach ($package->dependencies as $dependency) {
$this->replacePackage($dependency);
}
}
$this->replacer->replacePackage($package);
} | [
"public",
"function",
"replacePackage",
"(",
"$",
"package",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"package",
"->",
"dependencies",
")",
")",
"{",
"foreach",
"(",
"$",
"package",
"->",
"dependencies",
"as",
"$",
"dependency",
")",
"{",
"$",
"thi... | Replace contents of all the packages, one by one, starting on the deepest level of dependencies. | [
"Replace",
"contents",
"of",
"all",
"the",
"packages",
"one",
"by",
"one",
"starting",
"on",
"the",
"deepest",
"level",
"of",
"dependencies",
"."
] | bcdc1a1253824accca1b244f98e4e652e0911262 | https://github.com/coenjacobs/mozart/blob/bcdc1a1253824accca1b244f98e4e652e0911262/src/Console/Commands/Compose.php#L100-L109 | train |
coenjacobs/mozart | src/Console/Commands/Compose.php | Compose.findPackages | private function findPackages($slugs)
{
$packages = [];
foreach ($slugs as $package_slug) {
$packageDir = $this->workingDir . '/vendor/' . $package_slug .'/';
if (! is_dir($packageDir)) {
continue;
}
$package = new Package($packageDir);
$package->findAutoloaders();
$config = json_decode(file_get_contents($packageDir . 'composer.json'));
$dependencies = [];
if (isset($config->require)) {
$dependencies = array_keys((array)$config->require);
}
$package->dependencies = $this->findPackages($dependencies);
$packages[] = $package;
}
return $packages;
} | php | private function findPackages($slugs)
{
$packages = [];
foreach ($slugs as $package_slug) {
$packageDir = $this->workingDir . '/vendor/' . $package_slug .'/';
if (! is_dir($packageDir)) {
continue;
}
$package = new Package($packageDir);
$package->findAutoloaders();
$config = json_decode(file_get_contents($packageDir . 'composer.json'));
$dependencies = [];
if (isset($config->require)) {
$dependencies = array_keys((array)$config->require);
}
$package->dependencies = $this->findPackages($dependencies);
$packages[] = $package;
}
return $packages;
} | [
"private",
"function",
"findPackages",
"(",
"$",
"slugs",
")",
"{",
"$",
"packages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"slugs",
"as",
"$",
"package_slug",
")",
"{",
"$",
"packageDir",
"=",
"$",
"this",
"->",
"workingDir",
".",
"'/vendor/'",
".",... | Loops through all dependencies and their dependencies and so on...
will eventually return a list of all packages required by the full tree. | [
"Loops",
"through",
"all",
"dependencies",
"and",
"their",
"dependencies",
"and",
"so",
"on",
"...",
"will",
"eventually",
"return",
"a",
"list",
"of",
"all",
"packages",
"required",
"by",
"the",
"full",
"tree",
"."
] | bcdc1a1253824accca1b244f98e4e652e0911262 | https://github.com/coenjacobs/mozart/blob/bcdc1a1253824accca1b244f98e4e652e0911262/src/Console/Commands/Compose.php#L115-L141 | train |
yiisoft/yii2-bootstrap | src/Tabs.php | Tabs.renderDropdown | protected function renderDropdown($itemNumber, &$items, &$panes)
{
$itemActive = false;
foreach ($items as $n => &$item) {
if (is_string($item)) {
continue;
}
if (isset($item['visible']) && !$item['visible']) {
continue;
}
if (!(array_key_exists('content', $item) xor array_key_exists('url', $item))) {
throw new InvalidConfigException("Either the 'content' or the 'url' option is required, but only one can be set.");
}
if (array_key_exists('url', $item)) {
continue;
}
$content = ArrayHelper::remove($item, 'content');
$options = ArrayHelper::remove($item, 'contentOptions', []);
Html::addCssClass($options, ['widget' => 'tab-pane']);
if (ArrayHelper::remove($item, 'active')) {
Html::addCssClass($options, 'active');
Html::addCssClass($item['options'], 'active');
$itemActive = true;
}
$options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n);
$item['url'] = '#' . $options['id'];
if (!isset($item['linkOptions']['data-toggle'])) {
$item['linkOptions']['data-toggle'] = 'tab';
}
$panes[] = Html::tag('div', $content, $options);
unset($item);
}
return $itemActive;
} | php | protected function renderDropdown($itemNumber, &$items, &$panes)
{
$itemActive = false;
foreach ($items as $n => &$item) {
if (is_string($item)) {
continue;
}
if (isset($item['visible']) && !$item['visible']) {
continue;
}
if (!(array_key_exists('content', $item) xor array_key_exists('url', $item))) {
throw new InvalidConfigException("Either the 'content' or the 'url' option is required, but only one can be set.");
}
if (array_key_exists('url', $item)) {
continue;
}
$content = ArrayHelper::remove($item, 'content');
$options = ArrayHelper::remove($item, 'contentOptions', []);
Html::addCssClass($options, ['widget' => 'tab-pane']);
if (ArrayHelper::remove($item, 'active')) {
Html::addCssClass($options, 'active');
Html::addCssClass($item['options'], 'active');
$itemActive = true;
}
$options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n);
$item['url'] = '#' . $options['id'];
if (!isset($item['linkOptions']['data-toggle'])) {
$item['linkOptions']['data-toggle'] = 'tab';
}
$panes[] = Html::tag('div', $content, $options);
unset($item);
}
return $itemActive;
} | [
"protected",
"function",
"renderDropdown",
"(",
"$",
"itemNumber",
",",
"&",
"$",
"items",
",",
"&",
"$",
"panes",
")",
"{",
"$",
"itemActive",
"=",
"false",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"n",
"=>",
"&",
"$",
"item",
")",
"{",
"if",... | Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
configure `panes` accordingly.
@param string $itemNumber number of the item
@param array $items the dropdown items configuration.
@param array $panes the panes reference array.
@return bool whether any of the dropdown items is `active` or not.
@throws InvalidConfigException | [
"Normalizes",
"dropdown",
"item",
"options",
"by",
"removing",
"tab",
"specific",
"keys",
"content",
"and",
"contentOptions",
"and",
"also",
"configure",
"panes",
"accordingly",
"."
] | fa476cf19c5637a8a497ad2222149be1569fad80 | https://github.com/yiisoft/yii2-bootstrap/blob/fa476cf19c5637a8a497ad2222149be1569fad80/src/Tabs.php#L268-L306 | train |
yiisoft/yii2-bootstrap | src/Carousel.php | Carousel.renderControls | public function renderControls()
{
if (isset($this->controls[0], $this->controls[1])) {
return Html::a($this->controls[0], '#' . $this->options['id'], [
'class' => 'left carousel-control',
'data-slide' => 'prev',
]) . "\n"
. Html::a($this->controls[1], '#' . $this->options['id'], [
'class' => 'right carousel-control',
'data-slide' => 'next',
]);
} elseif ($this->controls === false) {
return '';
} else {
throw new InvalidConfigException('The "controls" property must be either false or an array of two elements.');
}
} | php | public function renderControls()
{
if (isset($this->controls[0], $this->controls[1])) {
return Html::a($this->controls[0], '#' . $this->options['id'], [
'class' => 'left carousel-control',
'data-slide' => 'prev',
]) . "\n"
. Html::a($this->controls[1], '#' . $this->options['id'], [
'class' => 'right carousel-control',
'data-slide' => 'next',
]);
} elseif ($this->controls === false) {
return '';
} else {
throw new InvalidConfigException('The "controls" property must be either false or an array of two elements.');
}
} | [
"public",
"function",
"renderControls",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"controls",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"controls",
"[",
"1",
"]",
")",
")",
"{",
"return",
"Html",
"::",
"a",
"(",
"$",
"this",
"->",
... | Renders previous and next control buttons.
@throws InvalidConfigException if [[controls]] is invalid. | [
"Renders",
"previous",
"and",
"next",
"control",
"buttons",
"."
] | fa476cf19c5637a8a497ad2222149be1569fad80 | https://github.com/yiisoft/yii2-bootstrap/blob/fa476cf19c5637a8a497ad2222149be1569fad80/src/Carousel.php#L163-L179 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.get | public function get($modelId, $params = array())
{
$resource = 'model/' . $modelId . '.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getModelResponse = new Models\ResponseModelGet($response);
return $getModelResponse->getModel();
} | php | public function get($modelId, $params = array())
{
$resource = 'model/' . $modelId . '.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getModelResponse = new Models\ResponseModelGet($response);
return $getModelResponse->getModel();
} | [
"public",
"function",
"get",
"(",
"$",
"modelId",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'.json'",
";",
"$",
"resource",
".=",
"'?'",
".",
"$",
"this",
"->",
"buildQueryStrin... | Get model information
Returns model of Yandex.Market service according to params.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-docpage/
@param int $modelId
@param array $params
@return Models\ResponseModelGet | [
"Get",
"model",
"information"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L40-L49 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.getInfo | public function getInfo($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/info.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getModelInfoResponse = new Models\ResponseModelInfoGet($response);
return $getModelInfoResponse;
} | php | public function getInfo($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/info.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getModelInfoResponse = new Models\ResponseModelInfoGet($response);
return $getModelInfoResponse;
} | [
"public",
"function",
"getInfo",
"(",
"$",
"modelId",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'/info.json'",
";",
"$",
"resource",
".=",
"'?'",
".",
"$",
"this",
"->",
"buildQ... | Get model short information
Returns short model of Yandex.Market service according to params.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-info-docpage/
@param int $modelId
@param array $params
@return Models\ResponseModelInfoGet | [
"Get",
"model",
"short",
"information"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L63-L72 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.getOffers | public function getOffers($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/offers.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getOffersResponse = new Models\ResponseModelOffersGet($response);
return $getOffersResponse;
} | php | public function getOffers($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/offers.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getOffersResponse = new Models\ResponseModelOffersGet($response);
return $getOffersResponse;
} | [
"public",
"function",
"getOffers",
"(",
"$",
"modelId",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'/offers.json'",
";",
"$",
"resource",
".=",
"'?'",
".",
"$",
"this",
"->",
"bu... | Get offers in model
Returns offers list represented in model of Yandex.Market service according to params.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-offers-docpage/
@param int $modelId
@param array $params
@return Models\ResponseModelOffersGet | [
"Get",
"offers",
"in",
"model"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L86-L95 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.getOutlets | public function getOutlets($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/outlets.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getOutletsResponse = new Models\ResponseModelOutletsGet($response);
return $getOutletsResponse;
} | php | public function getOutlets($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/outlets.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$getOutletsResponse = new Models\ResponseModelOutletsGet($response);
return $getOutletsResponse;
} | [
"public",
"function",
"getOutlets",
"(",
"$",
"modelId",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'/outlets.json'",
";",
"$",
"resource",
".=",
"'?'",
".",
"$",
"this",
"->",
"... | Get outlets of model
Returns outlets list where model of Yandex.Market service represented according to params.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-outlets-docpage/
@param int $modelId
@param array $params
@return Models\ResponseModelOutletsGet | [
"Get",
"outlets",
"of",
"model"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L109-L118 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.getReviews | public function getReviews($modelId)
{
$resource = 'model/' . $modelId . '/reviews.json';
$response = $this->getServiceResponse($resource);
$getReviewsResponse = new Models\ResponseModelReviewsGet($response);
return $getReviewsResponse;
} | php | public function getReviews($modelId)
{
$resource = 'model/' . $modelId . '/reviews.json';
$response = $this->getServiceResponse($resource);
$getReviewsResponse = new Models\ResponseModelReviewsGet($response);
return $getReviewsResponse;
} | [
"public",
"function",
"getReviews",
"(",
"$",
"modelId",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'/reviews.json'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"getServiceResponse",
"(",
"$",
"resource",
")",
";",
"$",
"ge... | Get reviews of model
Returns reviews list where model of Yandex.Market service represented.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-reviews-docpage/
@param int $modelId
@return Models\ResponseModelReviewsGet | [
"Get",
"reviews",
"of",
"model"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L131-L139 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Clients/ModelClient.php | ModelClient.getOpinions | public function getOpinions($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/opinion.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$modelOpinions = new Models\ResponseModelOpinionsGet($response);
return $modelOpinions;
} | php | public function getOpinions($modelId, $params = array())
{
$resource = 'model/' . $modelId . '/opinion.json';
$resource .= '?' . $this->buildQueryString($params);
$response = $this->getServiceResponse($resource);
$modelOpinions = new Models\ResponseModelOpinionsGet($response);
return $modelOpinions;
} | [
"public",
"function",
"getOpinions",
"(",
"$",
"modelId",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'model/'",
".",
"$",
"modelId",
".",
"'/opinion.json'",
";",
"$",
"resource",
".=",
"'?'",
".",
"$",
"this",
"->",
... | Get opinions of model
Returns opinions list of Yandex.Market service model.
@see https://tech.yandex.ru/market/content-data/doc/dg/reference/model-id-opinion-docpage/
@param int $modelId
@param array $params
@return Models\ResponseModelOpinionsGet | [
"Get",
"opinions",
"of",
"model"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Clients/ModelClient.php#L175-L184 | train |
nixsolutions/yandex-php-library | src/Yandex/Market/Content/Models/GeoRegions.php | GeoRegions.add | public function add($geoRegion)
{
if (is_array($geoRegion)) {
$this->collection[] = new GeoRegion($geoRegion);
} elseif (is_object($geoRegion) && $geoRegion instanceof GeoRegion) {
$this->collection[] = $geoRegion;
}
return $this;
} | php | public function add($geoRegion)
{
if (is_array($geoRegion)) {
$this->collection[] = new GeoRegion($geoRegion);
} elseif (is_object($geoRegion) && $geoRegion instanceof GeoRegion) {
$this->collection[] = $geoRegion;
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"geoRegion",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"geoRegion",
")",
")",
"{",
"$",
"this",
"->",
"collection",
"[",
"]",
"=",
"new",
"GeoRegion",
"(",
"$",
"geoRegion",
")",
";",
"}",
"elseif",
"(",
"is_... | Add geo region to collection
@param GeoRegion|array $geoRegion
@return GeoRegions | [
"Add",
"geo",
"region",
"to",
"collection"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Market/Content/Models/GeoRegions.php#L16-L25 | train |
nixsolutions/yandex-php-library | src/Yandex/Metrica/MetricaClient.php | MetricaClient.sendGetRequest | protected function sendGetRequest($resource, $params = [])
{
$response = $this->sendRequest(
'GET',
$this->getServiceUrl($resource, $params),
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
]
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
if (isset($decodedResponseBody['links']) && isset($decodedResponseBody['links']['next'])) {
$url = $decodedResponseBody['links']['next'];
unset($decodedResponseBody['rows']);
unset($decodedResponseBody['links']);
return $this->getNextPartOfList($url, $decodedResponseBody);
}
return $decodedResponseBody;
} | php | protected function sendGetRequest($resource, $params = [])
{
$response = $this->sendRequest(
'GET',
$this->getServiceUrl($resource, $params),
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
]
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
if (isset($decodedResponseBody['links']) && isset($decodedResponseBody['links']['next'])) {
$url = $decodedResponseBody['links']['next'];
unset($decodedResponseBody['rows']);
unset($decodedResponseBody['links']);
return $this->getNextPartOfList($url, $decodedResponseBody);
}
return $decodedResponseBody;
} | [
"protected",
"function",
"sendGetRequest",
"(",
"$",
"resource",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendRequest",
"(",
"'GET'",
",",
"$",
"this",
"->",
"getServiceUrl",
"(",
"$",
"resource",
",",
"$",... | Send GET request to API resource
@param string $resource
@param array $params
@return array | [
"Send",
"GET",
"request",
"to",
"API",
"resource"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Metrica/MetricaClient.php#L139-L162 | train |
nixsolutions/yandex-php-library | src/Yandex/Metrica/MetricaClient.php | MetricaClient.getNextPartOfList | protected function getNextPartOfList($url, $data = [])
{
$response = $this->sendRequest(
'GET',
$url,
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
]
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$mergedDecodedResponseBody = array_merge_recursive($data, $decodedResponseBody);
if (isset($mergedDecodedResponseBody['links']) && isset($mergedDecodedResponseBody['links']['next'])) {
$url = $mergedDecodedResponseBody['links'];
unset($mergedDecodedResponseBody['rows']);
unset($mergedDecodedResponseBody['links']);
return $this->getNextPartOfList($url, $response);
}
return $mergedDecodedResponseBody;
} | php | protected function getNextPartOfList($url, $data = [])
{
$response = $this->sendRequest(
'GET',
$url,
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
]
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$mergedDecodedResponseBody = array_merge_recursive($data, $decodedResponseBody);
if (isset($mergedDecodedResponseBody['links']) && isset($mergedDecodedResponseBody['links']['next'])) {
$url = $mergedDecodedResponseBody['links'];
unset($mergedDecodedResponseBody['rows']);
unset($mergedDecodedResponseBody['links']);
return $this->getNextPartOfList($url, $response);
}
return $mergedDecodedResponseBody;
} | [
"protected",
"function",
"getNextPartOfList",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendRequest",
"(",
"'GET'",
",",
"$",
"url",
",",
"[",
"'headers'",
"=>",
"[",
"'Accept'",
"=>",
"'app... | Send custom GET request to API resource
@param string $url
@param array $data
@return array | [
"Send",
"custom",
"GET",
"request",
"to",
"API",
"resource"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Metrica/MetricaClient.php#L171-L197 | train |
nixsolutions/yandex-php-library | src/Yandex/Metrica/MetricaClient.php | MetricaClient.sendPostRequest | protected function sendPostRequest($resource, $params)
{
$response = $this->sendRequest(
'POST',
$this->getServiceUrl($resource),
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
],
'json' => $params
]
);
return $this->getDecodedBody($response->getBody());
} | php | protected function sendPostRequest($resource, $params)
{
$response = $this->sendRequest(
'POST',
$this->getServiceUrl($resource),
[
'headers' => [
'Accept' => 'application/x-yametrika+json',
'Content-Type' => 'application/x-yametrika+json',
'Authorization' => 'OAuth ' . $this->getAccessToken(),
],
'json' => $params
]
);
return $this->getDecodedBody($response->getBody());
} | [
"protected",
"function",
"sendPostRequest",
"(",
"$",
"resource",
",",
"$",
"params",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendRequest",
"(",
"'POST'",
",",
"$",
"this",
"->",
"getServiceUrl",
"(",
"$",
"resource",
")",
",",
"[",
"'headers... | Send POST request to API resource
@param string $resource
@param array $params
@return array | [
"Send",
"POST",
"request",
"to",
"API",
"resource"
] | 9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89 | https://github.com/nixsolutions/yandex-php-library/blob/9f1d6eee82810cccbdfbb8f3b66f7f6dc1d76c89/src/Yandex/Metrica/MetricaClient.php#L206-L222 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.