id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
188,400 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.gatherGatewayData | protected function gatherGatewayData($data = array(), $includeCardOrToken = true)
{
//set the client IP address, if not already set
if (!isset($data['clientIp'])) {
$data['clientIp'] = Controller::curr()->getRequest()->getIP();
}
$gatewaydata = array_merge($data, array(
... | php | protected function gatherGatewayData($data = array(), $includeCardOrToken = true)
{
//set the client IP address, if not already set
if (!isset($data['clientIp'])) {
$data['clientIp'] = Controller::curr()->getRequest()->getIP();
}
$gatewaydata = array_merge($data, array(
... | [
"protected",
"function",
"gatherGatewayData",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"includeCardOrToken",
"=",
"true",
")",
"{",
"//set the client IP address, if not already set",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'clientIp'",
"]",
... | Collect common data parameters to pass to the gateway.
This method should merge in common data that is required by all services.
If you override this method, make sure to merge your data with parent::gatherGatewayData
@param array $data incoming data for the gateway
@param boolean $includeCardOrToken whether or not t... | [
"Collect",
"common",
"data",
"parameters",
"to",
"pass",
"to",
"the",
"gateway",
".",
"This",
"method",
"should",
"merge",
"in",
"common",
"data",
"that",
"is",
"required",
"by",
"all",
"services",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L218-L255 |
188,401 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.wrapOmnipayResponse | protected function wrapOmnipayResponse(ResponseInterface $omnipayResponse, $isNotification = false)
{
if ($isNotification) {
$flags = ServiceResponse::SERVICE_NOTIFICATION;
if (!$omnipayResponse->isSuccessful()) {
$flags |= ServiceResponse::SERVICE_ERROR;
... | php | protected function wrapOmnipayResponse(ResponseInterface $omnipayResponse, $isNotification = false)
{
if ($isNotification) {
$flags = ServiceResponse::SERVICE_NOTIFICATION;
if (!$omnipayResponse->isSuccessful()) {
$flags |= ServiceResponse::SERVICE_ERROR;
... | [
"protected",
"function",
"wrapOmnipayResponse",
"(",
"ResponseInterface",
"$",
"omnipayResponse",
",",
"$",
"isNotification",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"isNotification",
")",
"{",
"$",
"flags",
"=",
"ServiceResponse",
"::",
"SERVICE_NOTIFICATION",
";... | Get a service response from the given Omnipay response
@param ResponseInterface $omnipayResponse
@param bool $isNotification whether or not this response is a response to a notification
@throws \SilverStripe\Omnipay\Exception\ServiceException
@return ServiceResponse | [
"Get",
"a",
"service",
"response",
"from",
"the",
"given",
"Omnipay",
"response"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L274-L292 |
188,402 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.markCompleted | protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage)
{
$this->payment->Status = $endStatus;
if ($gatewayMessage && ($reference = $gatewayMessage->getTransactionReference())) {
$this->payment->TransactionReference = $reference;
}
... | php | protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage)
{
$this->payment->Status = $endStatus;
if ($gatewayMessage && ($reference = $gatewayMessage->getTransactionReference())) {
$this->payment->TransactionReference = $reference;
}
... | [
"protected",
"function",
"markCompleted",
"(",
"$",
"endStatus",
",",
"ServiceResponse",
"$",
"serviceResponse",
",",
"$",
"gatewayMessage",
")",
"{",
"$",
"this",
"->",
"payment",
"->",
"Status",
"=",
"$",
"endStatus",
";",
"if",
"(",
"$",
"gatewayMessage",
... | Mark this payment process as completed.
This sets the desired end-status on the payment, sets the transaction reference and writes the payment.
In subclasses, you'll want to override this and:
* Log/Write the GatewayMessage
* Call a "complete" hook
Don't forget to call the parent method from your subclass!
@param st... | [
"Mark",
"this",
"payment",
"process",
"as",
"completed",
".",
"This",
"sets",
"the",
"desired",
"end",
"-",
"status",
"on",
"the",
"payment",
"sets",
"the",
"transaction",
"reference",
"and",
"writes",
"the",
"payment",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L309-L316 |
188,403 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.createPartialPayment | protected function createPartialPayment($amount, $status, $write = true)
{
/** @var Payment $payment */
$payment = Payment::create(array(
'Gateway' => $this->payment->Gateway,
'TransactionReference' => $this->payment->TransactionReference,
'SuccessUrl' => $this->p... | php | protected function createPartialPayment($amount, $status, $write = true)
{
/** @var Payment $payment */
$payment = Payment::create(array(
'Gateway' => $this->payment->Gateway,
'TransactionReference' => $this->payment->TransactionReference,
'SuccessUrl' => $this->p... | [
"protected",
"function",
"createPartialPayment",
"(",
"$",
"amount",
",",
"$",
"status",
",",
"$",
"write",
"=",
"true",
")",
"{",
"/** @var Payment $payment */",
"$",
"payment",
"=",
"Payment",
"::",
"create",
"(",
"array",
"(",
"'Gateway'",
"=>",
"$",
"thi... | Create a partial payment that will be based on the current payment.
This new payment will inherit the Gateway, TransactionReference, SuccessUrl and FailureUrl
of the initial payment.
@param float $amount the amount that the partial payment should have
@param string $status the desired payment status
@param boolean $wri... | [
"Create",
"a",
"partial",
"payment",
"that",
"will",
"be",
"based",
"on",
"the",
"current",
"payment",
".",
"This",
"new",
"payment",
"will",
"inherit",
"the",
"Gateway",
"TransactionReference",
"SuccessUrl",
"and",
"FailureUrl",
"of",
"the",
"initial",
"payment... | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L328-L355 |
188,404 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.generateServiceResponse | protected function generateServiceResponse(
$flags,
$omnipayData = null
) {
$response = new ServiceResponse($this->payment, $flags);
if ($omnipayData) {
$response->setOmnipayResponse($omnipayData);
}
// redirects and notifications don't need a target URL... | php | protected function generateServiceResponse(
$flags,
$omnipayData = null
) {
$response = new ServiceResponse($this->payment, $flags);
if ($omnipayData) {
$response->setOmnipayResponse($omnipayData);
}
// redirects and notifications don't need a target URL... | [
"protected",
"function",
"generateServiceResponse",
"(",
"$",
"flags",
",",
"$",
"omnipayData",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"new",
"ServiceResponse",
"(",
"$",
"this",
"->",
"payment",
",",
"$",
"flags",
")",
";",
"if",
"(",
"$",
"omnipa... | Generate a service response
@param int $flags a combination of service flags
@param AbstractResponse|NotificationInterface|null $omnipayData the response or notification from the Omnipay gateway
@throws \SilverStripe\Omnipay\Exception\ServiceException
@return ServiceResponse | [
"Generate",
"a",
"service",
"response"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L364-L387 |
188,405 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.createMessage | protected function createMessage($type, $data = null)
{
$output = array();
if (is_string($data)) {
$output = [
'Message' => $data
];
} elseif (is_array($data)) {
$output = $data;
} elseif ($data instanceof \Exception) {
... | php | protected function createMessage($type, $data = null)
{
$output = array();
if (is_string($data)) {
$output = [
'Message' => $data
];
} elseif (is_array($data)) {
$output = $data;
} elseif ($data instanceof \Exception) {
... | [
"protected",
"function",
"createMessage",
"(",
"$",
"type",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"output",
"=",
"[",
"'Message'",
"=>",
... | Record a transaction on this for this payment.
@param string $type the type of transaction to create.
This is any class that is (or extends) PaymentMessage.
@param array|string|AbstractResponse|AbstractRequest|OmnipayException|NotificationInterface $data
@throws \Omnipay\Common\Exception\InvalidRequestException
@ret... | [
"Record",
"a",
"transaction",
"on",
"this",
"for",
"this",
"payment",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L400-L461 |
188,406 | silverstripe/silverstripe-omnipay | src/Service/PaymentService.php | PaymentService.logToFile | protected function logToFile($data, $type = '')
{
$this->logger->log(
// Log as error if we get a GatewayErrorMessage
is_subclass_of($type, GatewayErrorMessage::class) ? 'error' : 'info',
// Log title
sprintf('%s (%s)', $type, $this->payment->Gateway),
... | php | protected function logToFile($data, $type = '')
{
$this->logger->log(
// Log as error if we get a GatewayErrorMessage
is_subclass_of($type, GatewayErrorMessage::class) ? 'error' : 'info',
// Log title
sprintf('%s (%s)', $type, $this->payment->Gateway),
... | [
"protected",
"function",
"logToFile",
"(",
"$",
"data",
",",
"$",
"type",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"// Log as error if we get a GatewayErrorMessage",
"is_subclass_of",
"(",
"$",
"type",
",",
"GatewayErrorMessage",
"::",... | Helper function for logging gateway requests
@param mixed $data Data to log.
@param string $type Error message class. | [
"Helper",
"function",
"for",
"logging",
"gateway",
"requests"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PaymentService.php#L468-L478 |
188,407 | silverstripe/silverstripe-omnipay | src/Helper/PaymentMath.php | PaymentMath.subtract | public static function subtract($amountA, $amountB)
{
$precision = (int)self::config()->get('precision');
if (function_exists('bcsub') && self::config()->get('useBcMath')) {
return bcsub($amountA, $amountB, $precision);
}
return self::formatFloat((double)$amountA - (doub... | php | public static function subtract($amountA, $amountB)
{
$precision = (int)self::config()->get('precision');
if (function_exists('bcsub') && self::config()->get('useBcMath')) {
return bcsub($amountA, $amountB, $precision);
}
return self::formatFloat((double)$amountA - (doub... | [
"public",
"static",
"function",
"subtract",
"(",
"$",
"amountA",
",",
"$",
"amountB",
")",
"{",
"$",
"precision",
"=",
"(",
"int",
")",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'precision'",
")",
";",
"if",
"(",
"function_exists",
"(",
"'... | Subtract two numbers that are represented as a string.
Numbers will not be rounded but floored instead! So 10.0 - 0.1 with a precision of 0 will result in 9!
@param string $amountA first operand
@param string $amountB second operand
@return string the result as a string | [
"Subtract",
"two",
"numbers",
"that",
"are",
"represented",
"as",
"a",
"string",
".",
"Numbers",
"will",
"not",
"be",
"rounded",
"but",
"floored",
"instead!",
"So",
"10",
".",
"0",
"-",
"0",
".",
"1",
"with",
"a",
"precision",
"of",
"0",
"will",
"resul... | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/PaymentMath.php#L41-L49 |
188,408 | silverstripe/silverstripe-omnipay | src/Helper/PaymentMath.php | PaymentMath.add | public static function add($amountA, $amountB)
{
$precision = (int) self::config()->get('precision');
if (function_exists('bcadd') && self::config()->get('useBcMath')) {
return bcadd($amountA, $amountB, $precision);
}
return self::formatFloat((double)$amountA + (double)$... | php | public static function add($amountA, $amountB)
{
$precision = (int) self::config()->get('precision');
if (function_exists('bcadd') && self::config()->get('useBcMath')) {
return bcadd($amountA, $amountB, $precision);
}
return self::formatFloat((double)$amountA + (double)$... | [
"public",
"static",
"function",
"add",
"(",
"$",
"amountA",
",",
"$",
"amountB",
")",
"{",
"$",
"precision",
"=",
"(",
"int",
")",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'precision'",
")",
";",
"if",
"(",
"function_exists",
"(",
"'bcadd... | Add two numbers that are represented as a string
Numbers will not be rounded but floored instead! So 0.22 + 0.27 with a precision of 1 will result in 0.4!
@param string $amountA first operand
@param string $amountB second operand
@return string the result as a string | [
"Add",
"two",
"numbers",
"that",
"are",
"represented",
"as",
"a",
"string",
"Numbers",
"will",
"not",
"be",
"rounded",
"but",
"floored",
"instead!",
"So",
"0",
".",
"22",
"+",
"0",
".",
"27",
"with",
"a",
"precision",
"of",
"1",
"will",
"result",
"in",... | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/PaymentMath.php#L58-L66 |
188,409 | silverstripe/silverstripe-omnipay | src/Helper/PaymentMath.php | PaymentMath.compare | public static function compare($amountA, $amountB)
{
$precision = (int) self::config()->get('precision');
if (function_exists('bccomp') && self::config()->get('useBcMath')) {
return bccomp($amountA, $amountB, $precision);
}
$scale = pow(10, max(0, $precision));
$... | php | public static function compare($amountA, $amountB)
{
$precision = (int) self::config()->get('precision');
if (function_exists('bccomp') && self::config()->get('useBcMath')) {
return bccomp($amountA, $amountB, $precision);
}
$scale = pow(10, max(0, $precision));
$... | [
"public",
"static",
"function",
"compare",
"(",
"$",
"amountA",
",",
"$",
"amountB",
")",
"{",
"$",
"precision",
"=",
"(",
"int",
")",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'precision'",
")",
";",
"if",
"(",
"function_exists",
"(",
"'b... | Compare two numbers that are represented as a string
@param string $amountA first operand
@param string $amountB second operand
@return int 0 when both numbers are equal, 1 when $amountA is bigger than $amountB, -1 otherwise | [
"Compare",
"two",
"numbers",
"that",
"are",
"represented",
"as",
"a",
"string"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/PaymentMath.php#L91-L103 |
188,410 | silverstripe/silverstripe-omnipay | src/Helper/PaymentMath.php | PaymentMath.formatFloat | private static function formatFloat($f, $precision)
{
$scale = pow(10, max(0, $precision));
// clear off additional digits so that number_format doesn't round numbers
$i = (int)($f * $scale) / $scale;
return number_format($i, $precision, '.', '');
} | php | private static function formatFloat($f, $precision)
{
$scale = pow(10, max(0, $precision));
// clear off additional digits so that number_format doesn't round numbers
$i = (int)($f * $scale) / $scale;
return number_format($i, $precision, '.', '');
} | [
"private",
"static",
"function",
"formatFloat",
"(",
"$",
"f",
",",
"$",
"precision",
")",
"{",
"$",
"scale",
"=",
"pow",
"(",
"10",
",",
"max",
"(",
"0",
",",
"$",
"precision",
")",
")",
";",
"// clear off additional digits so that number_format doesn't round... | Format a float to string
@param float $f the number to format as string
@param int $precision desired precision
@return string | [
"Format",
"a",
"float",
"to",
"string"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/PaymentMath.php#L111-L117 |
188,411 | silverstripe/silverstripe-omnipay | src/Service/CreateCardService.php | CreateCardService.initiate | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot create a card for this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
$... | php | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot create a card for this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
$... | [
"public",
"function",
"initiate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"payment",
"->",
"Status",
"!==",
"'Created'",
")",
"{",
"throw",
"new",
"InvalidStateException",
"(",
"'Cannot create a card for this payment. ... | Start a createcard request
@inheritdoc | [
"Start",
"a",
"createcard",
"request"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/CreateCardService.php#L19-L71 |
188,412 | silverstripe/silverstripe-omnipay | src/Extensions/SagePayExtension.php | SagePayExtension.addTransactionReference | private function addTransactionReference(array &$gatewayData, $isAuthorize = false)
{
/** @var Payment $payment */
$payment = $this->owner->getPayment();
// Only apply the changes if the gateway is SagePay Server
if ($payment->Gateway == 'SagePay_Server') {
$type = ($isA... | php | private function addTransactionReference(array &$gatewayData, $isAuthorize = false)
{
/** @var Payment $payment */
$payment = $this->owner->getPayment();
// Only apply the changes if the gateway is SagePay Server
if ($payment->Gateway == 'SagePay_Server') {
$type = ($isA... | [
"private",
"function",
"addTransactionReference",
"(",
"array",
"&",
"$",
"gatewayData",
",",
"$",
"isAuthorize",
"=",
"false",
")",
"{",
"/** @var Payment $payment */",
"$",
"payment",
"=",
"$",
"this",
"->",
"owner",
"->",
"getPayment",
"(",
")",
";",
"// On... | Grabs the transactionReference from the previous received message and adds it to the
gateway data, so that it can be sent back to SagePay as clarification
@param array $gatewayData incoming gateway data
@param bool $isAuthorize whether or not we're dealing with a complete authorize request | [
"Grabs",
"the",
"transactionReference",
"from",
"the",
"previous",
"received",
"message",
"and",
"adds",
"it",
"to",
"the",
"gateway",
"data",
"so",
"that",
"it",
"can",
"be",
"sent",
"back",
"to",
"SagePay",
"as",
"clarification"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Extensions/SagePayExtension.php#L86-L99 |
188,413 | silverstripe/silverstripe-omnipay | src/Extensions/SagePayExtension.php | SagePayExtension.addDescription | private function addDescription(array &$gatewayData)
{
$payment = $this->owner->getPayment();
if ($payment->Gateway == 'SagePay_Direct' || $payment->Gateway == 'SagePay_Server') {
$gatewayData['description'] = sprintf(
'Payment made on %s',
date('D j M Y')... | php | private function addDescription(array &$gatewayData)
{
$payment = $this->owner->getPayment();
if ($payment->Gateway == 'SagePay_Direct' || $payment->Gateway == 'SagePay_Server') {
$gatewayData['description'] = sprintf(
'Payment made on %s',
date('D j M Y')... | [
"private",
"function",
"addDescription",
"(",
"array",
"&",
"$",
"gatewayData",
")",
"{",
"$",
"payment",
"=",
"$",
"this",
"->",
"owner",
"->",
"getPayment",
"(",
")",
";",
"if",
"(",
"$",
"payment",
"->",
"Gateway",
"==",
"'SagePay_Direct'",
"||",
"$",... | Description for SagePay must be < 100 characters
@param $gatewayData | [
"Description",
"for",
"SagePay",
"must",
"be",
"<",
"100",
"characters"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Extensions/SagePayExtension.php#L105-L114 |
188,414 | silverstripe/silverstripe-omnipay | src/Extensions/SagePayExtension.php | SagePayExtension.respondToNotification | private function respondToNotification(ServiceResponse $response, Payment $payment)
{
$omnipayResponse = $response->getOmnipayResponse();
if ($omnipayResponse !== null
&& $omnipayResponse->isSuccessful()
&& $response->isNotification()
&& !$response->isError()
... | php | private function respondToNotification(ServiceResponse $response, Payment $payment)
{
$omnipayResponse = $response->getOmnipayResponse();
if ($omnipayResponse !== null
&& $omnipayResponse->isSuccessful()
&& $response->isNotification()
&& !$response->isError()
... | [
"private",
"function",
"respondToNotification",
"(",
"ServiceResponse",
"$",
"response",
",",
"Payment",
"$",
"payment",
")",
"{",
"$",
"omnipayResponse",
"=",
"$",
"response",
"->",
"getOmnipayResponse",
"(",
")",
";",
"if",
"(",
"$",
"omnipayResponse",
"!==",
... | Used to respond to the SagePay notification
@param ServiceResponse $response
@param Payment $payment | [
"Used",
"to",
"respond",
"to",
"the",
"SagePay",
"notification"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Extensions/SagePayExtension.php#L121-L137 |
188,415 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getCardTypes | public function getCardTypes()
{
$card = new CreditCard();
$brands = $card->getSupportedBrands();
foreach ($brands as $brand => $x) {
$brands[$brand] = _t('CreditCard.'.strtoupper($brand), $brand);
}
return $brands;
} | php | public function getCardTypes()
{
$card = new CreditCard();
$brands = $card->getSupportedBrands();
foreach ($brands as $brand => $x) {
$brands[$brand] = _t('CreditCard.'.strtoupper($brand), $brand);
}
return $brands;
} | [
"public",
"function",
"getCardTypes",
"(",
")",
"{",
"$",
"card",
"=",
"new",
"CreditCard",
"(",
")",
";",
"$",
"brands",
"=",
"$",
"card",
"->",
"getSupportedBrands",
"(",
")",
";",
"foreach",
"(",
"$",
"brands",
"as",
"$",
"brand",
"=>",
"$",
"x",
... | Get a list of supported credit-card brands.
@return array | [
"Get",
"a",
"list",
"of",
"supported",
"credit",
"-",
"card",
"brands",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L231-L241 |
188,416 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getBillingFields | public function getBillingFields()
{
$fields = array(
'billingAddress1' => TextField::create(
$this->getFieldName('billingAddress1'),
_t('SilverStripe\Omnipay\PaymentForm.BillingAddress1', 'Address')
),
'billingAddress2' => TextField::creat... | php | public function getBillingFields()
{
$fields = array(
'billingAddress1' => TextField::create(
$this->getFieldName('billingAddress1'),
_t('SilverStripe\Omnipay\PaymentForm.BillingAddress1', 'Address')
),
'billingAddress2' => TextField::creat... | [
"public",
"function",
"getBillingFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"'billingAddress1'",
"=>",
"TextField",
"::",
"create",
"(",
"$",
"this",
"->",
"getFieldName",
"(",
"'billingAddress1'",
")",
",",
"_t",
"(",
"'SilverStripe\\Omnipay\\Pay... | Get billing address fields
@return FieldList | [
"Get",
"billing",
"address",
"fields"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L248-L284 |
188,417 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getEmailFields | public function getEmailFields()
{
$fields = array(
'email' => EmailField::create($this->getFieldName('email'), _t('SilverStripe\Omnipay\PaymentForm.Email', 'Email'))
);
$this->cullForGateway($fields);
return FieldList::create($fields);
} | php | public function getEmailFields()
{
$fields = array(
'email' => EmailField::create($this->getFieldName('email'), _t('SilverStripe\Omnipay\PaymentForm.Email', 'Email'))
);
$this->cullForGateway($fields);
return FieldList::create($fields);
} | [
"public",
"function",
"getEmailFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"'email'",
"=>",
"EmailField",
"::",
"create",
"(",
"$",
"this",
"->",
"getFieldName",
"(",
"'email'",
")",
",",
"_t",
"(",
"'SilverStripe\\Omnipay\\PaymentForm.Email'",
"... | Get email fields.
@return FieldList | [
"Get",
"email",
"fields",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L334-L343 |
188,418 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getCompanyFields | public function getCompanyFields()
{
$fields = array(
'company' => TextField::create($this->getFieldName('company'), _t('SilverStripe\Omnipay\PaymentForm.Company', 'Company'))
);
$this->cullForGateway($fields);
return FieldList::create($fields);
} | php | public function getCompanyFields()
{
$fields = array(
'company' => TextField::create($this->getFieldName('company'), _t('SilverStripe\Omnipay\PaymentForm.Company', 'Company'))
);
$this->cullForGateway($fields);
return FieldList::create($fields);
} | [
"public",
"function",
"getCompanyFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"'company'",
"=>",
"TextField",
"::",
"create",
"(",
"$",
"this",
"->",
"getFieldName",
"(",
"'company'",
")",
",",
"_t",
"(",
"'SilverStripe\\Omnipay\\PaymentForm.Company... | Get company fields
@return FieldList | [
"Get",
"company",
"fields"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L350-L359 |
188,419 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.cullForGateway | protected function cullForGateway(&$fields, $defaults = array())
{
if (!$this->gateway) {
return;
}
$selected = array_merge($defaults, GatewayInfo::requiredFields($this->gateway));
foreach ($fields as $name => $field) {
if (!in_array($name, $selected)) {
... | php | protected function cullForGateway(&$fields, $defaults = array())
{
if (!$this->gateway) {
return;
}
$selected = array_merge($defaults, GatewayInfo::requiredFields($this->gateway));
foreach ($fields as $name => $field) {
if (!in_array($name, $selected)) {
... | [
"protected",
"function",
"cullForGateway",
"(",
"&",
"$",
"fields",
",",
"$",
"defaults",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"gateway",
")",
"{",
"return",
";",
"}",
"$",
"selected",
"=",
"array_merge",
"(",
"$",
"... | Clear all fields that are not required by the gateway. Does nothing if gateway is null
@param $fields
@param array $defaults | [
"Clear",
"all",
"fields",
"that",
"are",
"not",
"required",
"by",
"the",
"gateway",
".",
"Does",
"nothing",
"if",
"gateway",
"is",
"null"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L366-L378 |
188,420 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getGlobalFieldName | private function getGlobalFieldName($defaultName)
{
$renameMap = $this->config()->rename;
if (is_array($renameMap) && array_key_exists($defaultName, $renameMap)) {
return $renameMap[ $defaultName ];
}
return false;
} | php | private function getGlobalFieldName($defaultName)
{
$renameMap = $this->config()->rename;
if (is_array($renameMap) && array_key_exists($defaultName, $renameMap)) {
return $renameMap[ $defaultName ];
}
return false;
} | [
"private",
"function",
"getGlobalFieldName",
"(",
"$",
"defaultName",
")",
"{",
"$",
"renameMap",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"rename",
";",
"if",
"(",
"is_array",
"(",
"$",
"renameMap",
")",
"&&",
"array_key_exists",
"(",
"$",
"def... | Fetches custom name from the rename map, or returns false
@param string $defaultName The original name of the field
@return bool|string Returns false if no custom name has been defined, otherwise returns the custom name | [
"Fetches",
"custom",
"name",
"from",
"the",
"rename",
"map",
"or",
"returns",
"false"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L458-L467 |
188,421 | silverstripe/silverstripe-omnipay | src/GatewayFieldsFactory.php | GatewayFieldsFactory.getGatewayFieldName | private function getGatewayFieldName($defaultName, $gateway = null)
{
if (!$gateway) {
if (!$this->gateway) {
return false;
}
return $this->getGatewayFieldName($defaultName, $this->gateway);
}
$renameMap = $this->config()->rename;
... | php | private function getGatewayFieldName($defaultName, $gateway = null)
{
if (!$gateway) {
if (!$this->gateway) {
return false;
}
return $this->getGatewayFieldName($defaultName, $this->gateway);
}
$renameMap = $this->config()->rename;
... | [
"private",
"function",
"getGatewayFieldName",
"(",
"$",
"defaultName",
",",
"$",
"gateway",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"gateway",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"gateway",
")",
"{",
"return",
"false",
";",
"}",
"return"... | Fetches custom name for a gateway field from the rename map, or returns false
@param $defaultName
@param null $gateway Optional, will default to current gateway if instantiated
@return bool|string Returns false if no custom gateway field name has been defined, otherwise returns the custom
name | [
"Fetches",
"custom",
"name",
"for",
"a",
"gateway",
"field",
"from",
"the",
"rename",
"map",
"or",
"returns",
"false"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayFieldsFactory.php#L478-L498 |
188,422 | silverstripe/silverstripe-omnipay | src/Service/NotificationCompleteService.php | NotificationCompleteService.notificationFailure | protected function notificationFailure($serviceResponse)
{
$omnipayResponse = $serviceResponse->getOmnipayResponse();
// if there's no response from the gateway, don't bother. Errors are already in messages/log
if (!$omnipayResponse) {
return;
}
// void any pend... | php | protected function notificationFailure($serviceResponse)
{
$omnipayResponse = $serviceResponse->getOmnipayResponse();
// if there's no response from the gateway, don't bother. Errors are already in messages/log
if (!$omnipayResponse) {
return;
}
// void any pend... | [
"protected",
"function",
"notificationFailure",
"(",
"$",
"serviceResponse",
")",
"{",
"$",
"omnipayResponse",
"=",
"$",
"serviceResponse",
"->",
"getOmnipayResponse",
"(",
")",
";",
"// if there's no response from the gateway, don't bother. Errors are already in messages/log",
... | Method to handle notification failures. Here we have to check if the gateway actually reported a failure
and then update the payment status accordingly!
@param ServiceResponse $serviceResponse
@return void | [
"Method",
"to",
"handle",
"notification",
"failures",
".",
"Here",
"we",
"have",
"to",
"check",
"if",
"the",
"gateway",
"actually",
"reported",
"a",
"failure",
"and",
"then",
"update",
"the",
"payment",
"status",
"accordingly!"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/NotificationCompleteService.php#L95-L116 |
188,423 | silverstripe/silverstripe-omnipay | src/Service/ServiceResponse.php | ServiceResponse.setOmnipayResponse | public function setOmnipayResponse($response)
{
$this->omnipayResponse = $response;
// also set the target Url if the response is a redirect
if ($this->isRedirect()) {
$redirectResponse = $this->omnipayResponse->getRedirectResponse();
if ($redirectResponse instanceof ... | php | public function setOmnipayResponse($response)
{
$this->omnipayResponse = $response;
// also set the target Url if the response is a redirect
if ($this->isRedirect()) {
$redirectResponse = $this->omnipayResponse->getRedirectResponse();
if ($redirectResponse instanceof ... | [
"public",
"function",
"setOmnipayResponse",
"(",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"omnipayResponse",
"=",
"$",
"response",
";",
"// also set the target Url if the response is a redirect",
"if",
"(",
"$",
"this",
"->",
"isRedirect",
"(",
")",
")",
"{",... | Set the response from Omnipay
@param AbstractResponse|NotificationInterface $response the response or notification from the Omnipay gateway
@return $this | [
"Set",
"the",
"response",
"from",
"Omnipay"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/ServiceResponse.php#L244-L255 |
188,424 | silverstripe/silverstripe-omnipay | src/Service/ServiceResponse.php | ServiceResponse.redirectOrRespond | public function redirectOrRespond()
{
if ($this->isRedirect()) {
$redirectResponse = $this->omnipayResponse->getRedirectResponse();
if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
$this->targetUrl = $redirectResponse->getTargetUr... | php | public function redirectOrRespond()
{
if ($this->isRedirect()) {
$redirectResponse = $this->omnipayResponse->getRedirectResponse();
if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
$this->targetUrl = $redirectResponse->getTargetUr... | [
"public",
"function",
"redirectOrRespond",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRedirect",
"(",
")",
")",
"{",
"$",
"redirectResponse",
"=",
"$",
"this",
"->",
"omnipayResponse",
"->",
"getRedirectResponse",
"(",
")",
";",
"if",
"(",
"$",
"red... | Create a redirect or a response.
This should be called when the application is ready to redirect!
If the response is a redirect, the redirect takes precedence.
Next, the HTTP response will be returned (if set) and lastly
a redirect response to the @see getTargetUrl.
If none of these parameters are given, this method... | [
"Create",
"a",
"redirect",
"or",
"a",
"response",
".",
"This",
"should",
"be",
"called",
"when",
"the",
"application",
"is",
"ready",
"to",
"redirect!"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/ServiceResponse.php#L269-L294 |
188,425 | silverstripe/silverstripe-omnipay | src/Service/AuthorizeService.php | AuthorizeService.initiate | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot authorize this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
$gateway ... | php | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot authorize this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
$gateway ... | [
"public",
"function",
"initiate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"payment",
"->",
"Status",
"!==",
"'Created'",
")",
"{",
"throw",
"new",
"InvalidStateException",
"(",
"'Cannot authorize this payment. Status i... | Start an authorization request
@inheritdoc | [
"Start",
"an",
"authorization",
"request"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/AuthorizeService.php#L23-L75 |
188,426 | silverstripe/silverstripe-omnipay | src/PaymentGatewayController.php | PaymentGatewayController.getEndpointUrl | public static function getEndpointUrl($action, $identifier)
{
$url = Controller::join_links(
'paymentendpoint',
$identifier,
$action
);
return Director::absoluteURL($url);
} | php | public static function getEndpointUrl($action, $identifier)
{
$url = Controller::join_links(
'paymentendpoint',
$identifier,
$action
);
return Director::absoluteURL($url);
} | [
"public",
"static",
"function",
"getEndpointUrl",
"(",
"$",
"action",
",",
"$",
"identifier",
")",
"{",
"$",
"url",
"=",
"Controller",
"::",
"join_links",
"(",
"'paymentendpoint'",
",",
"$",
"identifier",
",",
"$",
"action",
")",
";",
"return",
"Director",
... | Generate an absolute url for gateways to return to, or send requests to.
@param string $action the intended action of the gateway
@param string $identifier the unique payment id
@return string the resulting redirect url | [
"Generate",
"an",
"absolute",
"url",
"for",
"gateways",
"to",
"return",
"to",
"or",
"send",
"requests",
"to",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/PaymentGatewayController.php#L37-L46 |
188,427 | silverstripe/silverstripe-omnipay | src/PaymentGatewayController.php | PaymentGatewayController.getPaymentIntent | protected function getPaymentIntent($payment)
{
$intent = null;
switch ($payment->Status) {
// We have to check for both states here, since the notification might come in before the gateway returns
// if that's the case, the status of the payment will already be set to 'Auth... | php | protected function getPaymentIntent($payment)
{
$intent = null;
switch ($payment->Status) {
// We have to check for both states here, since the notification might come in before the gateway returns
// if that's the case, the status of the payment will already be set to 'Auth... | [
"protected",
"function",
"getPaymentIntent",
"(",
"$",
"payment",
")",
"{",
"$",
"intent",
"=",
"null",
";",
"switch",
"(",
"$",
"payment",
"->",
"Status",
")",
"{",
"// We have to check for both states here, since the notification might come in before the gateway returns",... | Find the intent of the current payment
@param Payment $payment the payment object
@return string|null | [
"Find",
"the",
"intent",
"of",
"the",
"current",
"payment"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/PaymentGatewayController.php#L120-L153 |
188,428 | silverstripe/silverstripe-omnipay | src/PaymentGatewayController.php | PaymentGatewayController.createPaymentResponse | protected function createPaymentResponse($payment)
{
if (!$payment) {
return $this->httpError(
404,
_t('SilverStripe\Omnipay\Model\Payment.NotFound', 'Payment could not be found.')
);
}
$intent = $this->getPaymentIntent($payment);
... | php | protected function createPaymentResponse($payment)
{
if (!$payment) {
return $this->httpError(
404,
_t('SilverStripe\Omnipay\Model\Payment.NotFound', 'Payment could not be found.')
);
}
$intent = $this->getPaymentIntent($payment);
... | [
"protected",
"function",
"createPaymentResponse",
"(",
"$",
"payment",
")",
"{",
"if",
"(",
"!",
"$",
"payment",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
",",
"_t",
"(",
"'SilverStripe\\Omnipay\\Model\\Payment.NotFound'",
",",
"'Payment co... | Create the appropriate HTTP response for the given payment.
@param Payment $payment the payment that should be processed
@return HTTPResponse
@throws Exception\InvalidConfigurationException
@throws Exception\InvalidStateException
@throws \SilverStripe\Control\HTTPResponse_Exception | [
"Create",
"the",
"appropriate",
"HTTP",
"response",
"for",
"the",
"given",
"payment",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/PaymentGatewayController.php#L164-L205 |
188,429 | silverstripe/silverstripe-omnipay | src/PaymentGatewayController.php | PaymentGatewayController.getPaymentFromRequest | protected function getPaymentFromRequest(HTTPRequest $request, $gateway = null)
{
$identifier = $request->param('Identifier');
$results = $this->extend('updatePaymentFromRequest', $request, $gateway);
// Look to see if our extension return a payment,
// if so, return it.
for... | php | protected function getPaymentFromRequest(HTTPRequest $request, $gateway = null)
{
$identifier = $request->param('Identifier');
$results = $this->extend('updatePaymentFromRequest', $request, $gateway);
// Look to see if our extension return a payment,
// if so, return it.
for... | [
"protected",
"function",
"getPaymentFromRequest",
"(",
"HTTPRequest",
"$",
"request",
",",
"$",
"gateway",
"=",
"null",
")",
"{",
"$",
"identifier",
"=",
"$",
"request",
"->",
"param",
"(",
"'Identifier'",
")",
";",
"$",
"results",
"=",
"$",
"this",
"->",
... | Get the the payment according to the identifier given in the url
@param HTTPRequest $request The current request
@param string $gateway the gateway name
@return Payment the payment | [
"Get",
"the",
"the",
"payment",
"according",
"to",
"the",
"identifier",
"given",
"in",
"the",
"url"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/PaymentGatewayController.php#L233-L250 |
188,430 | silverstripe/silverstripe-omnipay | src/Extensions/Payable.php | Payable.TotalPaid | public function TotalPaid()
{
$paid = 0;
if ($payments = $this->owner->Payments()) {
foreach ($payments as $payment) {
if ($payment->Status == 'Captured') {
$paid += $payment->Amount;
}
}
}
return $paid;
... | php | public function TotalPaid()
{
$paid = 0;
if ($payments = $this->owner->Payments()) {
foreach ($payments as $payment) {
if ($payment->Status == 'Captured') {
$paid += $payment->Amount;
}
}
}
return $paid;
... | [
"public",
"function",
"TotalPaid",
"(",
")",
"{",
"$",
"paid",
"=",
"0",
";",
"if",
"(",
"$",
"payments",
"=",
"$",
"this",
"->",
"owner",
"->",
"Payments",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"payments",
"as",
"$",
"payment",
")",
"{",
"if"... | Get the total captured amount
@return float | [
"Get",
"the",
"total",
"captured",
"amount"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Extensions/Payable.php#L28-L41 |
188,431 | silverstripe/silverstripe-omnipay | src/Extensions/Payable.php | Payable.TotalPaidOrAuthorized | public function TotalPaidOrAuthorized()
{
$paid = 0;
if ($payments = $this->owner->Payments()) {
foreach ($payments as $payment) {
// Captured and authorized payments
// (which aren't manual) should count towards the total
$captured = $pay... | php | public function TotalPaidOrAuthorized()
{
$paid = 0;
if ($payments = $this->owner->Payments()) {
foreach ($payments as $payment) {
// Captured and authorized payments
// (which aren't manual) should count towards the total
$captured = $pay... | [
"public",
"function",
"TotalPaidOrAuthorized",
"(",
")",
"{",
"$",
"paid",
"=",
"0",
";",
"if",
"(",
"$",
"payments",
"=",
"$",
"this",
"->",
"owner",
"->",
"Payments",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"payments",
"as",
"$",
"payment",
")",
... | Get the total captured or authorized amount, excluding Manual payments.
@return float | [
"Get",
"the",
"total",
"captured",
"or",
"authorized",
"amount",
"excluding",
"Manual",
"payments",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Extensions/Payable.php#L48-L66 |
188,432 | silverstripe/silverstripe-omnipay | src/Service/PurchaseService.php | PurchaseService.initiate | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot initiate a purchase with this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
... | php | public function initiate($data = array())
{
if ($this->payment->Status !== 'Created') {
throw new InvalidStateException('Cannot initiate a purchase with this payment. Status is not "Created"');
}
if (!$this->payment->isInDB()) {
$this->payment->write();
}
... | [
"public",
"function",
"initiate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"payment",
"->",
"Status",
"!==",
"'Created'",
")",
"{",
"throw",
"new",
"InvalidStateException",
"(",
"'Cannot initiate a purchase with this pa... | Attempt to make a payment.
@inheritdoc
@param array $data returnUrl/cancelUrl + customer creditcard and billing/shipping details.
Some keys (e.g. "amount") are overwritten with data from the associated {@link $payment}.
If this array is constructed from user data (e.g. a form submission), please take care
to whitelis... | [
"Attempt",
"to",
"make",
"a",
"payment",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PurchaseService.php#L23-L75 |
188,433 | silverstripe/silverstripe-omnipay | src/Service/PurchaseService.php | PurchaseService.complete | public function complete($data = array(), $isNotification = false)
{
$flags = $isNotification ? ServiceResponse::SERVICE_NOTIFICATION : 0;
// The payment is already captured
if ($this->payment->Status === 'Captured') {
return $this->generateServiceResponse($flags);
}
... | php | public function complete($data = array(), $isNotification = false)
{
$flags = $isNotification ? ServiceResponse::SERVICE_NOTIFICATION : 0;
// The payment is already captured
if ($this->payment->Status === 'Captured') {
return $this->generateServiceResponse($flags);
}
... | [
"public",
"function",
"complete",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"isNotification",
"=",
"false",
")",
"{",
"$",
"flags",
"=",
"$",
"isNotification",
"?",
"ServiceResponse",
"::",
"SERVICE_NOTIFICATION",
":",
"0",
";",
"// The payment is ... | Finalise this payment, after off-site external processing.
This is usually only called by PaymentGatewayController.
@inheritdoc | [
"Finalise",
"this",
"payment",
"after",
"off",
"-",
"site",
"external",
"processing",
".",
"This",
"is",
"usually",
"only",
"called",
"by",
"PaymentGatewayController",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Service/PurchaseService.php#L82-L132 |
188,434 | silverstripe/silverstripe-omnipay | src/Admin/PaymentDevelopmentAdmin.php | PaymentDevelopmentAdmin.PaymentTypes | private function PaymentTypes()
{
$factory = Omnipay::getFactory();
// since the omnipay gateway factory only returns gateways from the composer.json extra data,
// we should merge it with user-defined gateways from Payment.allowed_gateways
$gateways = array_unique(array_merge(
... | php | private function PaymentTypes()
{
$factory = Omnipay::getFactory();
// since the omnipay gateway factory only returns gateways from the composer.json extra data,
// we should merge it with user-defined gateways from Payment.allowed_gateways
$gateways = array_unique(array_merge(
... | [
"private",
"function",
"PaymentTypes",
"(",
")",
"{",
"$",
"factory",
"=",
"Omnipay",
"::",
"getFactory",
"(",
")",
";",
"// since the omnipay gateway factory only returns gateways from the composer.json extra data,",
"// we should merge it with user-defined gateways from Payment.all... | Get all available payment types | [
"Get",
"all",
"available",
"payment",
"types"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Admin/PaymentDevelopmentAdmin.php#L77-L98 |
188,435 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getDefaultSearchContext | public function getDefaultSearchContext()
{
$context = parent::getDefaultSearchContext();
$fields = $context->getSearchFields();
$fields->removeByName('Gateway');
$fields->removeByName('Created');
$fields->insertAfter('Money', DropdownField::create(
'Gateway',
... | php | public function getDefaultSearchContext()
{
$context = parent::getDefaultSearchContext();
$fields = $context->getSearchFields();
$fields->removeByName('Gateway');
$fields->removeByName('Created');
$fields->insertAfter('Money', DropdownField::create(
'Gateway',
... | [
"public",
"function",
"getDefaultSearchContext",
"(",
")",
"{",
"$",
"context",
"=",
"parent",
"::",
"getDefaultSearchContext",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"context",
"->",
"getSearchFields",
"(",
")",
";",
"$",
"fields",
"->",
"removeByName",
"(... | Change search context to use a dropdown for list of gateways. | [
"Change",
"search",
"context",
"to",
"use",
"a",
"dropdown",
"for",
"list",
"of",
"gateways",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L130-L154 |
188,436 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.init | public function init($gateway, $amount, $currency)
{
$this->setGateway($gateway);
$this->setAmount($amount);
$this->setCurrency($currency);
return $this;
} | php | public function init($gateway, $amount, $currency)
{
$this->setGateway($gateway);
$this->setAmount($amount);
$this->setCurrency($currency);
return $this;
} | [
"public",
"function",
"init",
"(",
"$",
"gateway",
",",
"$",
"amount",
",",
"$",
"currency",
")",
"{",
"$",
"this",
"->",
"setGateway",
"(",
"$",
"gateway",
")",
";",
"$",
"this",
"->",
"setAmount",
"(",
"$",
"amount",
")",
";",
"$",
"this",
"->",
... | Set gateway, amount, and currency in one function.
@param string $gateway Omnipay gateway short name
@param float $amount monetary amount
@param string $currency the currency to set
@return $this object for chaining | [
"Set",
"gateway",
"amount",
"and",
"currency",
"in",
"one",
"function",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L163-L169 |
188,437 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getTitle | public function getTitle()
{
return strftime(_t(
'SilverStripe\Omnipay\Model\Payment.TitleTemplate',
'{Gateway} {Money} %d/%m/%Y',
'A template for the payment title',
str_replace('%', '%%', array(
'Gateway' => $this->getGatewayTitle(),
... | php | public function getTitle()
{
return strftime(_t(
'SilverStripe\Omnipay\Model\Payment.TitleTemplate',
'{Gateway} {Money} %d/%m/%Y',
'A template for the payment title',
str_replace('%', '%%', array(
'Gateway' => $this->getGatewayTitle(),
... | [
"public",
"function",
"getTitle",
"(",
")",
"{",
"return",
"strftime",
"(",
"_t",
"(",
"'SilverStripe\\Omnipay\\Model\\Payment.TitleTemplate'",
",",
"'{Gateway} {Money} %d/%m/%Y'",
",",
"'A template for the payment title'",
",",
"str_replace",
"(",
"'%'",
",",
"'%%'",
","... | Locale aware title for a payment.
Consists of Gateway-Name, Money and Currency, Created date.
Uses a translatable string as template for the output.
@return string | [
"Locale",
"aware",
"title",
"for",
"a",
"payment",
".",
"Consists",
"of",
"Gateway",
"-",
"Name",
"Money",
"and",
"Currency",
"Created",
"date",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L210-L221 |
188,438 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getPaymentStatus | public function getPaymentStatus()
{
if ($this->Status) {
return _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($this->Status), $this->Status);
}
return null;
} | php | public function getPaymentStatus()
{
if ($this->Status) {
return _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($this->Status), $this->Status);
}
return null;
} | [
"public",
"function",
"getPaymentStatus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Status",
")",
"{",
"return",
"_t",
"(",
"'SilverStripe\\Omnipay\\Model\\Payment.STATUS_'",
".",
"strtoupper",
"(",
"$",
"this",
"->",
"Status",
")",
",",
"$",
"this",
"->... | Get the payment status. This will return a localized value if available.
@return string the payment status | [
"Get",
"the",
"payment",
"status",
".",
"This",
"will",
"return",
"a",
"localized",
"value",
"if",
"available",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L249-L255 |
188,439 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.setAmount | public function setAmount($amount)
{
if ($amount instanceof DBMoney) {
$this->setField('Money', $amount);
} elseif ($this->Status == 'Created' && is_numeric($amount)) {
$this->MoneyAmount = $amount;
}
return $this;
} | php | public function setAmount($amount)
{
if ($amount instanceof DBMoney) {
$this->setField('Money', $amount);
} elseif ($this->Status == 'Created' && is_numeric($amount)) {
$this->MoneyAmount = $amount;
}
return $this;
} | [
"public",
"function",
"setAmount",
"(",
"$",
"amount",
")",
"{",
"if",
"(",
"$",
"amount",
"instanceof",
"DBMoney",
")",
"{",
"$",
"this",
"->",
"setField",
"(",
"'Money'",
",",
"$",
"amount",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"Status"... | Set the payment amount, but only when the status is 'Created'.
@param float $amount value to set the payment to
@return Payment this object for chaining | [
"Set",
"the",
"payment",
"amount",
"but",
"only",
"when",
"the",
"status",
"is",
"Created",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L271-L279 |
188,440 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getPartialPayments | public function getPartialPayments()
{
if (!$this->isInDB()) {
return null;
}
return Payment::get()
->filter('InitialPaymentID', $this->ID)
->sort(array('Created' => 'DESC', 'ID' => 'DESC'));
} | php | public function getPartialPayments()
{
if (!$this->isInDB()) {
return null;
}
return Payment::get()
->filter('InitialPaymentID', $this->ID)
->sort(array('Created' => 'DESC', 'ID' => 'DESC'));
} | [
"public",
"function",
"getPartialPayments",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isInDB",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Payment",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'InitialPaymentID'",
",",
"$",
"... | Get partial payments that have this payment as initial payment.
The list will be sorted from newest to oldest
@return DataList|null | [
"Get",
"partial",
"payments",
"that",
"have",
"this",
"payment",
"as",
"initial",
"payment",
".",
"The",
"list",
"will",
"be",
"sorted",
"from",
"newest",
"to",
"oldest"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L337-L346 |
188,441 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getMaxCaptureAmount | public function getMaxCaptureAmount()
{
if ($this->Status !== 'Authorized') {
return 0;
}
$percent = GatewayInfo::maxExcessCapturePercent($this->Gateway);
$fixedAmount = GatewayInfo::maxExcessCaptureAmount($this->Gateway, $this->getCurrency());
// -1 will only b... | php | public function getMaxCaptureAmount()
{
if ($this->Status !== 'Authorized') {
return 0;
}
$percent = GatewayInfo::maxExcessCapturePercent($this->Gateway);
$fixedAmount = GatewayInfo::maxExcessCaptureAmount($this->Gateway, $this->getCurrency());
// -1 will only b... | [
"public",
"function",
"getMaxCaptureAmount",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Status",
"!==",
"'Authorized'",
")",
"{",
"return",
"0",
";",
"}",
"$",
"percent",
"=",
"GatewayInfo",
"::",
"maxExcessCapturePercent",
"(",
"$",
"this",
"->",
"Gate... | Calculate the max amount that can be captured for this payment.
If the Status of the payment isn't 'Authorized', this will return 0
@return int|string the max amount that can be captured for this payment. | [
"Calculate",
"the",
"max",
"amount",
"that",
"can",
"be",
"captured",
"for",
"this",
"payment",
".",
"If",
"the",
"Status",
"of",
"the",
"payment",
"isn",
"t",
"Authorized",
"this",
"will",
"return",
"0"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L376-L406 |
188,442 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.canCapture | public function canCapture($member = null, $partial = false)
{
// premise
if (!(
$this->Status === 'Authorized' &&
($partial ? GatewayInfo::allowPartialCapture($this->Gateway) : GatewayInfo::allowCapture($this->Gateway))
)) {
return false;
}
... | php | public function canCapture($member = null, $partial = false)
{
// premise
if (!(
$this->Status === 'Authorized' &&
($partial ? GatewayInfo::allowPartialCapture($this->Gateway) : GatewayInfo::allowCapture($this->Gateway))
)) {
return false;
}
... | [
"public",
"function",
"canCapture",
"(",
"$",
"member",
"=",
"null",
",",
"$",
"partial",
"=",
"false",
")",
"{",
"// premise",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"Status",
"===",
"'Authorized'",
"&&",
"(",
"$",
"partial",
"?",
"GatewayInfo",
"::"... | Whether or not this payment can be captured
@param Member|int $member the member/memberID to check permissions on
@param boolean $partial check if payment can be partially captured. Defaults to false
@return bool | [
"Whether",
"or",
"not",
"this",
"payment",
"can",
"be",
"captured"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L414-L440 |
188,443 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.canVoid | public function canVoid($member = null)
{
if (!($this->Status == 'Authorized' && GatewayInfo::allowVoid($this->Gateway))) {
return false;
}
$extended = $this->extendedCan('canVoid', $member);
if ($extended !== null) {
return $extended;
}
retu... | php | public function canVoid($member = null)
{
if (!($this->Status == 'Authorized' && GatewayInfo::allowVoid($this->Gateway))) {
return false;
}
$extended = $this->extendedCan('canVoid', $member);
if ($extended !== null) {
return $extended;
}
retu... | [
"public",
"function",
"canVoid",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"Status",
"==",
"'Authorized'",
"&&",
"GatewayInfo",
"::",
"allowVoid",
"(",
"$",
"this",
"->",
"Gateway",
")",
")",
")",
"{",
"return... | Whether or not this payment can be voided
@param Member|int $member the member/memberID to check permissions on
@return bool | [
"Whether",
"or",
"not",
"this",
"payment",
"can",
"be",
"voided"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L447-L459 |
188,444 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.canRefund | public function canRefund($member = null, $partial = false)
{
if (!(
$this->Status == 'Captured' &&
($partial ? GatewayInfo::allowPartialRefund($this->Gateway) : GatewayInfo::allowRefund($this->Gateway))
)) {
return false;
}
if ($this->isInDB()) {... | php | public function canRefund($member = null, $partial = false)
{
if (!(
$this->Status == 'Captured' &&
($partial ? GatewayInfo::allowPartialRefund($this->Gateway) : GatewayInfo::allowRefund($this->Gateway))
)) {
return false;
}
if ($this->isInDB()) {... | [
"public",
"function",
"canRefund",
"(",
"$",
"member",
"=",
"null",
",",
"$",
"partial",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"Status",
"==",
"'Captured'",
"&&",
"(",
"$",
"partial",
"?",
"GatewayInfo",
"::",
"allowPartialRef... | Whether or not this payment can be refunded
@param Member|int $member the member/memberID to check permissions on
@param boolean $partial check if payment can be partially refunded. Defaults to false
@return bool | [
"Whether",
"or",
"not",
"this",
"payment",
"can",
"be",
"refunded"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L467-L492 |
188,445 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.generateUniquePaymentIdentifier | protected function generateUniquePaymentIdentifier($gateway = null)
{
$gateway = $gateway ?: $this->Gateway;
$length = GatewayInfo::getConfigSetting($gateway, 'payment_identifier_length') ?:
static::config()->get('payment_identifier_length');
/** @var RandomGenerator $generator ... | php | protected function generateUniquePaymentIdentifier($gateway = null)
{
$gateway = $gateway ?: $this->Gateway;
$length = GatewayInfo::getConfigSetting($gateway, 'payment_identifier_length') ?:
static::config()->get('payment_identifier_length');
/** @var RandomGenerator $generator ... | [
"protected",
"function",
"generateUniquePaymentIdentifier",
"(",
"$",
"gateway",
"=",
"null",
")",
"{",
"$",
"gateway",
"=",
"$",
"gateway",
"?",
":",
"$",
"this",
"->",
"Gateway",
";",
"$",
"length",
"=",
"GatewayInfo",
"::",
"getConfigSetting",
"(",
"$",
... | Generate an internally unique string that identifies a payment,
and can be used in URLs.
@param string|null $gateway
@return string Identifier | [
"Generate",
"an",
"internally",
"unique",
"string",
"that",
"identifies",
"a",
"payment",
"and",
"can",
"be",
"used",
"in",
"URLs",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L576-L594 |
188,446 | silverstripe/silverstripe-omnipay | src/Model/Payment.php | Payment.getStatusValues | protected function getStatusValues()
{
$values = array();
foreach ($this->dbObject('Status')->enumValues() as $value) {
$values[$value] = _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($value), $value);
}
return $values;
} | php | protected function getStatusValues()
{
$values = array();
foreach ($this->dbObject('Status')->enumValues() as $value) {
$values[$value] = _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($value), $value);
}
return $values;
} | [
"protected",
"function",
"getStatusValues",
"(",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"dbObject",
"(",
"'Status'",
")",
"->",
"enumValues",
"(",
")",
"as",
"$",
"value",
")",
"{",
"$",
"values",
"["... | Get an array of status enum value to translated string.
Can be used for dropdowns
@return array | [
"Get",
"an",
"array",
"of",
"status",
"enum",
"value",
"to",
"translated",
"string",
".",
"Can",
"be",
"used",
"for",
"dropdowns"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Model/Payment.php#L601-L608 |
188,447 | silverstripe/silverstripe-omnipay | src/Helper/Logging.php | Logging.prepareForLogging | public static function prepareForLogging($data)
{
if (empty($data)) {
return [];
}
// If not an array, wrap it as an array
if (!is_array($data)) {
return [$data];
}
if (self::config()->logStyle == self::LOGSTYLE_SIMPLE) {
return a... | php | public static function prepareForLogging($data)
{
if (empty($data)) {
return [];
}
// If not an array, wrap it as an array
if (!is_array($data)) {
return [$data];
}
if (self::config()->logStyle == self::LOGSTYLE_SIMPLE) {
return a... | [
"public",
"static",
"function",
"prepareForLogging",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// If not an array, wrap it as an array",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
"... | Prepare data for logging by cleaning up the data or simplify it.
@param mixed $data the incoming data to log
@return array processed data for logging | [
"Prepare",
"data",
"for",
"logging",
"by",
"cleaning",
"up",
"the",
"data",
"or",
"simplify",
"it",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/Logging.php#L57-L80 |
188,448 | silverstripe/silverstripe-omnipay | src/Helper/Logging.php | Logging.sanitize | private static function sanitize(array &$data)
{
$blackList = array_combine(self::config()->loggingBlacklist, self::config()->loggingBlacklist);
array_walk_recursive($data, function (&$value, $key) use ($blackList) {
if (isset($blackList[$key])) {
$value = '(sanitized)';
... | php | private static function sanitize(array &$data)
{
$blackList = array_combine(self::config()->loggingBlacklist, self::config()->loggingBlacklist);
array_walk_recursive($data, function (&$value, $key) use ($blackList) {
if (isset($blackList[$key])) {
$value = '(sanitized)';
... | [
"private",
"static",
"function",
"sanitize",
"(",
"array",
"&",
"$",
"data",
")",
"{",
"$",
"blackList",
"=",
"array_combine",
"(",
"self",
"::",
"config",
"(",
")",
"->",
"loggingBlacklist",
",",
"self",
"::",
"config",
"(",
")",
"->",
"loggingBlacklist",... | Clean out sensitive data, such as credit-card numbers
@param array $data | [
"Clean",
"out",
"sensitive",
"data",
"such",
"as",
"credit",
"-",
"card",
"numbers"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/Helper/Logging.php#L86-L94 |
188,449 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.getSupportedGateways | public static function getSupportedGateways($nice = true)
{
$allowed = Payment::config()->allowed_gateways;
if (!is_array($allowed) || empty($allowed)) {
throw new InvalidConfigurationException(
'No allowed gateways configured. Use SilverStripe\Omnipay\Model\Payment.allo... | php | public static function getSupportedGateways($nice = true)
{
$allowed = Payment::config()->allowed_gateways;
if (!is_array($allowed) || empty($allowed)) {
throw new InvalidConfigurationException(
'No allowed gateways configured. Use SilverStripe\Omnipay\Model\Payment.allo... | [
"public",
"static",
"function",
"getSupportedGateways",
"(",
"$",
"nice",
"=",
"true",
")",
"{",
"$",
"allowed",
"=",
"Payment",
"::",
"config",
"(",
")",
"->",
"allowed_gateways",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"allowed",
")",
"||",
"empty",... | Get the available configured payment types, optionally with i18n readable names.
@param bool $nice make the array values i18n readable.
@return array map of gateway short name to translated long name.
@throws InvalidConfigurationException | [
"Get",
"the",
"available",
"configured",
"payment",
"types",
"optionally",
"with",
"i18n",
"readable",
"names",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L81-L98 |
188,450 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.niceTitle | public static function niceTitle($name)
{
if (empty($name)) {
return '';
}
$gateway = null;
try {
$factory = new GatewayFactory();
$gateway = $factory->create($name);
} catch (\Exception $e) {
/** do nothing */
}
... | php | public static function niceTitle($name)
{
if (empty($name)) {
return '';
}
$gateway = null;
try {
$factory = new GatewayFactory();
$gateway = $factory->create($name);
} catch (\Exception $e) {
/** do nothing */
}
... | [
"public",
"static",
"function",
"niceTitle",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"gateway",
"=",
"null",
";",
"try",
"{",
"$",
"factory",
"=",
"new",
"GatewayFactory",
"(",... | Get a locale aware title for the given gateway.
@param string $name gateway short name
@return string nice title for the gateway. Uses translations, if available | [
"Get",
"a",
"locale",
"aware",
"title",
"for",
"the",
"given",
"gateway",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L107-L128 |
188,451 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.isOffsite | public static function isOffsite($gateway)
{
$configValue = self::getConfigSetting($gateway, 'is_offsite');
// If the value from config is set, return it
if (is_bool($configValue)) {
return $configValue;
}
$factory = new GatewayFactory();
$gateway = $fact... | php | public static function isOffsite($gateway)
{
$configValue = self::getConfigSetting($gateway, 'is_offsite');
// If the value from config is set, return it
if (is_bool($configValue)) {
return $configValue;
}
$factory = new GatewayFactory();
$gateway = $fact... | [
"public",
"static",
"function",
"isOffsite",
"(",
"$",
"gateway",
")",
"{",
"$",
"configValue",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'is_offsite'",
")",
";",
"// If the value from config is set, return it",
"if",
"(",
"is_bool",
"(",
... | Checks if the given gateway name is an off-site gateway.
@param string $gateway gateway name
@throws \RuntimeException
@return boolean the gateway offsite or not | [
"Checks",
"if",
"the",
"given",
"gateway",
"name",
"is",
"an",
"off",
"-",
"site",
"gateway",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L149-L172 |
188,452 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.shouldUseAuthorize | public static function shouldUseAuthorize($gateway)
{
// Manual gateways are "authorized" by nature
if (self::isManual($gateway)) {
return true;
}
return self::getConfigSetting($gateway, 'use_authorize') == true;
} | php | public static function shouldUseAuthorize($gateway)
{
// Manual gateways are "authorized" by nature
if (self::isManual($gateway)) {
return true;
}
return self::getConfigSetting($gateway, 'use_authorize') == true;
} | [
"public",
"static",
"function",
"shouldUseAuthorize",
"(",
"$",
"gateway",
")",
"{",
"// Manual gateways are \"authorized\" by nature",
"if",
"(",
"self",
"::",
"isManual",
"(",
"$",
"gateway",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"self",
"::",
... | Check if the given gateway should use authorize payments
@param string $gateway the gateway name
@return boolean | [
"Check",
"if",
"the",
"given",
"gateway",
"should",
"use",
"authorize",
"payments"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L198-L206 |
188,453 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.shouldUseAsyncNotifications | public static function shouldUseAsyncNotifications($gateway)
{
// Manual gateways can be excluded
if (self::isManual($gateway)) {
return false;
}
return self::getConfigSetting($gateway, 'use_async_notification') == true;
} | php | public static function shouldUseAsyncNotifications($gateway)
{
// Manual gateways can be excluded
if (self::isManual($gateway)) {
return false;
}
return self::getConfigSetting($gateway, 'use_async_notification') == true;
} | [
"public",
"static",
"function",
"shouldUseAsyncNotifications",
"(",
"$",
"gateway",
")",
"{",
"// Manual gateways can be excluded",
"if",
"(",
"self",
"::",
"isManual",
"(",
"$",
"gateway",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"self",
"::",
"g... | Check if the given gateway should use asynchronous notifications
@param string $gateway the gateway name
@return boolean | [
"Check",
"if",
"the",
"given",
"gateway",
"should",
"use",
"asynchronous",
"notifications"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L213-L221 |
188,454 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.allowVoid | public static function allowVoid($gateway)
{
$setting = self::getConfigSetting($gateway, 'can_void');
// if the setting isn't present, default to true, otherwise check against falsy values
return ($setting === null || !($setting == false || $setting === 'off' || $setting === 'false'));
} | php | public static function allowVoid($gateway)
{
$setting = self::getConfigSetting($gateway, 'can_void');
// if the setting isn't present, default to true, otherwise check against falsy values
return ($setting === null || !($setting == false || $setting === 'off' || $setting === 'false'));
} | [
"public",
"static",
"function",
"allowVoid",
"(",
"$",
"gateway",
")",
"{",
"$",
"setting",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'can_void'",
")",
";",
"// if the setting isn't present, default to true, otherwise check against falsy values",
... | Whether or not the given gateway should allow voiding of payments
@param string $gateway the gateway name
@return bool | [
"Whether",
"or",
"not",
"the",
"given",
"gateway",
"should",
"allow",
"voiding",
"of",
"payments"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L228-L233 |
188,455 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.allowPartialCapture | public static function allowPartialCapture($gateway)
{
return (
self::configToConstant($gateway, 'can_capture') === self::PARTIAL
|| self::configToConstant($gateway, 'can_capture') === self::MULTIPLE
);
} | php | public static function allowPartialCapture($gateway)
{
return (
self::configToConstant($gateway, 'can_capture') === self::PARTIAL
|| self::configToConstant($gateway, 'can_capture') === self::MULTIPLE
);
} | [
"public",
"static",
"function",
"allowPartialCapture",
"(",
"$",
"gateway",
")",
"{",
"return",
"(",
"self",
"::",
"configToConstant",
"(",
"$",
"gateway",
",",
"'can_capture'",
")",
"===",
"self",
"::",
"PARTIAL",
"||",
"self",
"::",
"configToConstant",
"(",
... | Whether or not the given gateway should allow partial capturing of payments
@param string $gateway the gateway name
@return bool | [
"Whether",
"or",
"not",
"the",
"given",
"gateway",
"should",
"allow",
"partial",
"capturing",
"of",
"payments"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L261-L267 |
188,456 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.maxExcessCapturePercent | public static function maxExcessCapturePercent($gateway)
{
$setting = self::getConfigSetting($gateway, 'max_capture');
if (!$setting) {
return 0;
}
$pattern = '/^(\d+)%$/';
if (!is_array($setting)) {
if (preg_match($pattern, $setting, $match)) {
... | php | public static function maxExcessCapturePercent($gateway)
{
$setting = self::getConfigSetting($gateway, 'max_capture');
if (!$setting) {
return 0;
}
$pattern = '/^(\d+)%$/';
if (!is_array($setting)) {
if (preg_match($pattern, $setting, $match)) {
... | [
"public",
"static",
"function",
"maxExcessCapturePercent",
"(",
"$",
"gateway",
")",
"{",
"$",
"setting",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'max_capture'",
")",
";",
"if",
"(",
"!",
"$",
"setting",
")",
"{",
"return",
"0",
... | Get the max excess capture percentage for the given gateway.
Some payment providers allow capturing a slightly higher amount than was authorized.
If $200.00 was authorized and maxExcessCapturePercent returns `15`, you're allowed to capture at max $230.00,
unless further restricted by maxExcessCaptureAmount.
To get the... | [
"Get",
"the",
"max",
"excess",
"capture",
"percentage",
"for",
"the",
"given",
"gateway",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L283-L311 |
188,457 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.maxExcessCaptureAmount | public static function maxExcessCaptureAmount($gateway, $currency = null)
{
$setting = self::getConfigSetting($gateway, 'max_capture');
if (!$setting) {
return 0;
}
if (!is_array($setting)) {
if (preg_match('/^\d+%$/', $setting)) {
return -1;
... | php | public static function maxExcessCaptureAmount($gateway, $currency = null)
{
$setting = self::getConfigSetting($gateway, 'max_capture');
if (!$setting) {
return 0;
}
if (!is_array($setting)) {
if (preg_match('/^\d+%$/', $setting)) {
return -1;
... | [
"public",
"static",
"function",
"maxExcessCaptureAmount",
"(",
"$",
"gateway",
",",
"$",
"currency",
"=",
"null",
")",
"{",
"$",
"setting",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'max_capture'",
")",
";",
"if",
"(",
"!",
"$",
"... | Get the max excess capture amount for the given gateway and an optional currency.
Some payment providers allow capturing a slightly higher amount than was authorized.
If $200.00 was authorized and maxExcessCaptureAmount returns `70`, you're allowed to capture at max $270.00,
unless further restricted by maxExcessCaptu... | [
"Get",
"the",
"max",
"excess",
"capture",
"amount",
"for",
"the",
"given",
"gateway",
"and",
"an",
"optional",
"currency",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L327-L357 |
188,458 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.allowPartialRefund | public static function allowPartialRefund($gateway)
{
return (
self::configToConstant($gateway, 'can_refund') === self::PARTIAL
|| self::configToConstant($gateway, 'can_refund') === self::MULTIPLE
);
} | php | public static function allowPartialRefund($gateway)
{
return (
self::configToConstant($gateway, 'can_refund') === self::PARTIAL
|| self::configToConstant($gateway, 'can_refund') === self::MULTIPLE
);
} | [
"public",
"static",
"function",
"allowPartialRefund",
"(",
"$",
"gateway",
")",
"{",
"return",
"(",
"self",
"::",
"configToConstant",
"(",
"$",
"gateway",
",",
"'can_refund'",
")",
"===",
"self",
"::",
"PARTIAL",
"||",
"self",
"::",
"configToConstant",
"(",
... | Whether or not the given gateway should allow partial refunding of payments
@param string $gateway the gateway name
@return bool | [
"Whether",
"or",
"not",
"the",
"given",
"gateway",
"should",
"allow",
"partial",
"refunding",
"of",
"payments"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L385-L391 |
188,459 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.requiredFields | public static function requiredFields($gateway)
{
$fields = array();
$requiredFields = self::getConfigSetting($gateway, 'required_fields');
if (is_array($requiredFields)) {
$fields = $requiredFields;
}
//always require the following for on-site gateways (and no... | php | public static function requiredFields($gateway)
{
$fields = array();
$requiredFields = self::getConfigSetting($gateway, 'required_fields');
if (is_array($requiredFields)) {
$fields = $requiredFields;
}
//always require the following for on-site gateways (and no... | [
"public",
"static",
"function",
"requiredFields",
"(",
"$",
"gateway",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"$",
"requiredFields",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'required_fields'",
")",
";",
"if",
"(",
... | Get the required parameters for a given gateway
@param string $gateway gateway name
@return array required parameters | [
"Get",
"the",
"required",
"parameters",
"for",
"a",
"given",
"gateway"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L410-L429 |
188,460 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.getParameters | public static function getParameters($gateway)
{
$params = self::getConfigSetting($gateway, 'parameters');
return is_array($params) ? $params : null;
} | php | public static function getParameters($gateway)
{
$params = self::getConfigSetting($gateway, 'parameters');
return is_array($params) ? $params : null;
} | [
"public",
"static",
"function",
"getParameters",
"(",
"$",
"gateway",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"'parameters'",
")",
";",
"return",
"is_array",
"(",
"$",
"params",
")",
"?",
"$",
"params",
"... | Get the gateway config-parameters.
@param string $gateway the gateway name
@return array|null gateway parameters | [
"Get",
"the",
"gateway",
"config",
"-",
"parameters",
"."
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L437-L442 |
188,461 | silverstripe/silverstripe-omnipay | src/GatewayInfo.php | GatewayInfo.getConfigSetting | public static function getConfigSetting($gateway, $key)
{
$config = self::config()->get($gateway);
if (!is_array($config)) {
return null;
}
return isset($config[$key]) ? $config[$key] : null;
} | php | public static function getConfigSetting($gateway, $key)
{
$config = self::config()->get($gateway);
if (!is_array($config)) {
return null;
}
return isset($config[$key]) ? $config[$key] : null;
} | [
"public",
"static",
"function",
"getConfigSetting",
"(",
"$",
"gateway",
",",
"$",
"key",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"$",
"gateway",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")... | Get a single config setting for a gateway
@param string $gateway the gateway name
@param string $key the config key to get
@return mixed | [
"Get",
"a",
"single",
"config",
"setting",
"for",
"a",
"gateway"
] | dd6bed807b42420e90b345597d6ac76e9175988a | https://github.com/silverstripe/silverstripe-omnipay/blob/dd6bed807b42420e90b345597d6ac76e9175988a/src/GatewayInfo.php#L450-L459 |
188,462 | Prezto/permission | src/PermissionMiddleware.php | PermissionMiddleware.allow | public function allow(Request $request)
{
foreach ($this->patterns as $regex)
if (preg_match(sprintf("#^%s$#i", $regex), $request->getUri()->getPath()))
return false;
return true;
} | php | public function allow(Request $request)
{
foreach ($this->patterns as $regex)
if (preg_match(sprintf("#^%s$#i", $regex), $request->getUri()->getPath()))
return false;
return true;
} | [
"public",
"function",
"allow",
"(",
"Request",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"patterns",
"as",
"$",
"regex",
")",
"if",
"(",
"preg_match",
"(",
"sprintf",
"(",
"\"#^%s$#i\"",
",",
"$",
"regex",
")",
",",
"$",
"request",
... | The default allow rule set allows all connections through unless otherwise stated
@param Request $request
@return bool | [
"The",
"default",
"allow",
"rule",
"set",
"allows",
"all",
"connections",
"through",
"unless",
"otherwise",
"stated"
] | 043bb8db90fe9919b31dc0ed883d609c0fe945fb | https://github.com/Prezto/permission/blob/043bb8db90fe9919b31dc0ed883d609c0fe945fb/src/PermissionMiddleware.php#L41-L48 |
188,463 | coopTilleuls/CoopTilleulsCKEditorSonataMediaBundle | Controller/MediaAdminController.php | MediaAdminController.browserAction | public function browserAction()
{
if (false === $this->admin->isGranted('LIST')) {
throw new AccessDeniedException();
}
$datagrid = $this->admin->getDatagrid();
$datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));
$datagrid->setV... | php | public function browserAction()
{
if (false === $this->admin->isGranted('LIST')) {
throw new AccessDeniedException();
}
$datagrid = $this->admin->getDatagrid();
$datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));
$datagrid->setV... | [
"public",
"function",
"browserAction",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"admin",
"->",
"isGranted",
"(",
"'LIST'",
")",
")",
"{",
"throw",
"new",
"AccessDeniedException",
"(",
")",
";",
"}",
"$",
"datagrid",
"=",
"$",
"this"... | Returns the response object associated with the browser action.
@return Response
@throws AccessDeniedException | [
"Returns",
"the",
"response",
"object",
"associated",
"with",
"the",
"browser",
"action",
"."
] | d4b0b1d6b143b23b6436e7c96b05e79086525074 | https://github.com/coopTilleuls/CoopTilleulsCKEditorSonataMediaBundle/blob/d4b0b1d6b143b23b6436e7c96b05e79086525074/Controller/MediaAdminController.php#L51-L79 |
188,464 | coopTilleuls/CoopTilleulsCKEditorSonataMediaBundle | Controller/MediaAdminController.php | MediaAdminController.uploadAction | public function uploadAction()
{
if (false === $this->admin->isGranted('CREATE')) {
throw new AccessDeniedException();
}
$mediaManager = $this->get('sonata.media.manager.media');
$request = $this->getRequest();
$provider = $request->get('provider');
$fil... | php | public function uploadAction()
{
if (false === $this->admin->isGranted('CREATE')) {
throw new AccessDeniedException();
}
$mediaManager = $this->get('sonata.media.manager.media');
$request = $this->getRequest();
$provider = $request->get('provider');
$fil... | [
"public",
"function",
"uploadAction",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"admin",
"->",
"isGranted",
"(",
"'CREATE'",
")",
")",
"{",
"throw",
"new",
"AccessDeniedException",
"(",
")",
";",
"}",
"$",
"mediaManager",
"=",
"$",
"... | Returns the response object associated with the upload action.
@return Response
@throws AccessDeniedException | [
"Returns",
"the",
"response",
"object",
"associated",
"with",
"the",
"upload",
"action",
"."
] | d4b0b1d6b143b23b6436e7c96b05e79086525074 | https://github.com/coopTilleuls/CoopTilleulsCKEditorSonataMediaBundle/blob/d4b0b1d6b143b23b6436e7c96b05e79086525074/Controller/MediaAdminController.php#L88-L116 |
188,465 | ddeboer/vatin | src/Validator.php | Validator.isValid | public function isValid($value, $checkExistence = false)
{
if (null === $value || '' === $value) {
return false;
}
$countryCode = substr($value, 0, 2);
$vatin = substr($value, 2);
if (false === $this->isValidCountryCode($countryCode)) {
return false;... | php | public function isValid($value, $checkExistence = false)
{
if (null === $value || '' === $value) {
return false;
}
$countryCode = substr($value, 0, 2);
$vatin = substr($value, 2);
if (false === $this->isValidCountryCode($countryCode)) {
return false;... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
",",
"$",
"checkExistence",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
"||",
"''",
"===",
"$",
"value",
")",
"{",
"return",
"false",
";",
"}",
"$",
"countryCode",
"=",
"substr",... | Returns true if value is a valid VAT identification number, false
otherwise
@param string $value Value
@param bool $checkExistence In addition to checking the VATIN's format
for validity, also check whether the VATIN
exists. This requires a call to the VIES
web service.
@return bool | [
"Returns",
"true",
"if",
"value",
"is",
"a",
"valid",
"VAT",
"identification",
"number",
"false",
"otherwise"
] | 91281f32ee15eeca8c7501ed683e116865909218 | https://github.com/ddeboer/vatin/blob/91281f32ee15eeca8c7501ed683e116865909218/src/Validator.php#L85-L109 |
188,466 | ddeboer/vatin | src/Vies/Client.php | Client.getSoapClient | private function getSoapClient()
{
if (null === $this->soapClient) {
$this->soapClient = new \SoapClient(
$this->wsdl,
array(
'classmap' => $this->classmap,
'user_agent' => 'Mozilla', // the request fails unless a (dummy) us... | php | private function getSoapClient()
{
if (null === $this->soapClient) {
$this->soapClient = new \SoapClient(
$this->wsdl,
array(
'classmap' => $this->classmap,
'user_agent' => 'Mozilla', // the request fails unless a (dummy) us... | [
"private",
"function",
"getSoapClient",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"soapClient",
")",
"{",
"$",
"this",
"->",
"soapClient",
"=",
"new",
"\\",
"SoapClient",
"(",
"$",
"this",
"->",
"wsdl",
",",
"array",
"(",
"'classmap'"... | Get SOAP client
@return \SoapClient | [
"Get",
"SOAP",
"client"
] | 91281f32ee15eeca8c7501ed683e116865909218 | https://github.com/ddeboer/vatin/blob/91281f32ee15eeca8c7501ed683e116865909218/src/Vies/Client.php#L76-L90 |
188,467 | wormling/phparia | src/wormling/phparia/Api/Events.php | Events.getEvents | public function getEvents($app, $subscribeAll = false)
{
$uri = 'events';
$response = $this->client->getEndpoint()->get($uri, [
'form_params' => [
'app' => $app,
'subscribeAll' => $subscribeAll,
]
]);
$events = [];
fore... | php | public function getEvents($app, $subscribeAll = false)
{
$uri = 'events';
$response = $this->client->getEndpoint()->get($uri, [
'form_params' => [
'app' => $app,
'subscribeAll' => $subscribeAll,
]
]);
$events = [];
fore... | [
"public",
"function",
"getEvents",
"(",
"$",
"app",
",",
"$",
"subscribeAll",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"'events'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
... | WebSocket connection for events.
@param string $app (required) Applications to subscribe to. Allows comma separated values.
@param boolean $subscribeAll Subscribe to all Asterisk events. If provided, the applications listed will be subscribed to all events, effectively disabling the application specific subscriptions... | [
"WebSocket",
"connection",
"for",
"events",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Events.php#L43-L59 |
188,468 | gidkom/php-openfire-restapi | src/Gidkom/OpenFireRestApi/RestClient.php | RestClient.doRequest | protected function doRequest($type, $endpoint, $params=[])
{
$base = ($this->useSSL) ? "https" : "http";
$url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint;
if ($this->useBasicAuth)
$auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd);
... | php | protected function doRequest($type, $endpoint, $params=[])
{
$base = ($this->useSSL) ? "https" : "http";
$url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint;
if ($this->useBasicAuth)
$auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd);
... | [
"protected",
"function",
"doRequest",
"(",
"$",
"type",
",",
"$",
"endpoint",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"base",
"=",
"(",
"$",
"this",
"->",
"useSSL",
")",
"?",
"\"https\"",
":",
"\"http\"",
";",
"$",
"url",
"=",
"$",
"bas... | Make the request and analyze the result
@param string $type Request method
@param string $endpoint Api request endpoint
@param array $params Parameters
@return array|false Array with data or error, or False when something went fully wrong | [
"Make",
"the",
"request",
"and",
"analyze",
"the",
"result"
] | 4424094d9f97ad65145b30f840cb9276af9a3b53 | https://github.com/gidkom/php-openfire-restapi/blob/4424094d9f97ad65145b30f840cb9276af9a3b53/src/Gidkom/OpenFireRestApi/RestClient.php#L36-L66 |
188,469 | wormling/phparia | src/wormling/phparia/Api/PlaybackList.php | PlaybackList.stop | public function stop()
{
foreach (array_reverse($this->getArrayCopy()) as $playback) {
/* @var $playback Playback */
try {
$this->phparia->playbacks()->stopPlayback($playback->getId());
} catch (\Exception $ignore) {
// Don't throw exceptio... | php | public function stop()
{
foreach (array_reverse($this->getArrayCopy()) as $playback) {
/* @var $playback Playback */
try {
$this->phparia->playbacks()->stopPlayback($playback->getId());
} catch (\Exception $ignore) {
// Don't throw exceptio... | [
"public",
"function",
"stop",
"(",
")",
"{",
"foreach",
"(",
"array_reverse",
"(",
"$",
"this",
"->",
"getArrayCopy",
"(",
")",
")",
"as",
"$",
"playback",
")",
"{",
"/* @var $playback Playback */",
"try",
"{",
"$",
"this",
"->",
"phparia",
"->",
"playback... | Stop all the playbacks | [
"Stop",
"all",
"the",
"playbacks"
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/PlaybackList.php#L86-L96 |
188,470 | wormling/phparia | src/wormling/phparia/Api/Mailboxes.php | Mailboxes.getMailboxes | public function getMailboxes()
{
$uri = 'mailboxes';
$response = $this->client->getEndpoint()->get($uri);
$mailboxes = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $mailbox) {
$mailboxes[] = new Mailbox($mailbox);
}
return $mailboxes;
... | php | public function getMailboxes()
{
$uri = 'mailboxes';
$response = $this->client->getEndpoint()->get($uri);
$mailboxes = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $mailbox) {
$mailboxes[] = new Mailbox($mailbox);
}
return $mailboxes;
... | [
"public",
"function",
"getMailboxes",
"(",
")",
"{",
"$",
"uri",
"=",
"'mailboxes'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"mailboxes",
"=",
"[",
"]",
";"... | List all mailboxes.
@return Mailbox[] | [
"List",
"all",
"mailboxes",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Mailboxes.php#L38-L49 |
188,471 | wormling/phparia | src/wormling/phparia/Api/Mailboxes.php | Mailboxes.getMailbox | public function getMailbox($mailboxName)
{
$uri = "mailboxes/$mailboxName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Mailbox(\GuzzleHttp\json_decode($re... | php | public function getMailbox($mailboxName)
{
$uri = "mailboxes/$mailboxName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Mailbox(\GuzzleHttp\json_decode($re... | [
"public",
"function",
"getMailbox",
"(",
"$",
"mailboxName",
")",
"{",
"$",
"uri",
"=",
"\"mailboxes/$mailboxName\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
... | Retrieve the current state of a mailbox.
@param string $mailboxName Name of the mailbox
@return Mailbox
@throws NotFoundException | [
"Retrieve",
"the",
"current",
"state",
"of",
"a",
"mailbox",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Mailboxes.php#L58-L68 |
188,472 | wormling/phparia | src/wormling/phparia/Api/Mailboxes.php | Mailboxes.deleteMailbox | public function deleteMailbox($mailboxName)
{
$uri = "mailboxes/$mailboxName";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function deleteMailbox($mailboxName)
{
$uri = "mailboxes/$mailboxName";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"deleteMailbox",
"(",
"$",
"mailboxName",
")",
"{",
"$",
"uri",
"=",
"\"mailboxes/$mailboxName\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"delete",
"(",
"$",
"uri",
")",
";",
"}",
"catch",... | Destroy a mailbox.
@param string $mailboxName Name of the mailbox
@throws NotFoundException | [
"Destroy",
"a",
"mailbox",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Mailboxes.php#L99-L107 |
188,473 | wormling/phparia | src/wormling/phparia/Api/Applications.php | Applications.getApplications | public function getApplications()
{
$uri = 'applications';
$response = $this->client->getEndpoint()->get($uri);
$applications = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $application) {
$applications[] = new Application($this->client, $application);
... | php | public function getApplications()
{
$uri = 'applications';
$response = $this->client->getEndpoint()->get($uri);
$applications = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $application) {
$applications[] = new Application($this->client, $application);
... | [
"public",
"function",
"getApplications",
"(",
")",
"{",
"$",
"uri",
"=",
"'applications'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"applications",
"=",
"[",
"... | List all getApplications.
@return Application[] | [
"List",
"all",
"getApplications",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Applications.php#L41-L52 |
188,474 | wormling/phparia | src/wormling/phparia/Api/Applications.php | Applications.getApplication | public function getApplication($applicationName)
{
$uri = "applications/$applicationName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Application($this->c... | php | public function getApplication($applicationName)
{
$uri = "applications/$applicationName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Application($this->c... | [
"public",
"function",
"getApplication",
"(",
"$",
"applicationName",
")",
"{",
"$",
"uri",
"=",
"\"applications/$applicationName\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"... | Get details of an application.
@param $applicationName
@return Application
@throws NotFoundException | [
"Get",
"details",
"of",
"an",
"application",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Applications.php#L61-L71 |
188,475 | wormling/phparia | src/wormling/phparia/Api/Applications.php | Applications.subscribe | public function subscribe($applicationName, $eventSource)
{
$uri = "applications/$applicationName/subscription";
try {
$response = $this->client->getEndpoint()->post($uri, [
'form_params' => [
'eventSource' => $eventSource,
]
... | php | public function subscribe($applicationName, $eventSource)
{
$uri = "applications/$applicationName/subscription";
try {
$response = $this->client->getEndpoint()->post($uri, [
'form_params' => [
'eventSource' => $eventSource,
]
... | [
"public",
"function",
"subscribe",
"(",
"$",
"applicationName",
",",
"$",
"eventSource",
")",
"{",
"$",
"uri",
"=",
"\"applications/$applicationName/subscription\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
... | Subscribe an application to a event source. Returns the state of the application after the subscriptions have changed
@param string $applicationName Application's name
@param string $eventSource (required) URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{deviceNa... | [
"Subscribe",
"an",
"application",
"to",
"a",
"event",
"source",
".",
"Returns",
"the",
"state",
"of",
"the",
"application",
"after",
"the",
"subscriptions",
"have",
"changed"
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Applications.php#L83-L97 |
188,476 | wormling/phparia | src/wormling/phparia/Api/Applications.php | Applications.unsubscribe | public function unsubscribe($applicationName, $eventSource)
{
$uri = "applications/$applicationName/subscription?eventSource=".\GuzzleHttp\json_encode($eventSource);
try {
$response = $this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->p... | php | public function unsubscribe($applicationName, $eventSource)
{
$uri = "applications/$applicationName/subscription?eventSource=".\GuzzleHttp\json_encode($eventSource);
try {
$response = $this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->p... | [
"public",
"function",
"unsubscribe",
"(",
"$",
"applicationName",
",",
"$",
"eventSource",
")",
"{",
"$",
"uri",
"=",
"\"applications/$applicationName/subscription?eventSource=\"",
".",
"\\",
"GuzzleHttp",
"\\",
"json_encode",
"(",
"$",
"eventSource",
")",
";",
"try... | Unsubscribe an application from an event source. Returns the state of the application after the subscriptions have changed
@param string $applicationName Application's name
@param string $eventSource (required) URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{dev... | [
"Unsubscribe",
"an",
"application",
"from",
"an",
"event",
"source",
".",
"Returns",
"the",
"state",
"of",
"the",
"application",
"after",
"the",
"subscriptions",
"have",
"changed"
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Applications.php#L110-L120 |
188,477 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.getRecordings | public function getRecordings()
{
$uri = 'recordings/stored';
$response = $this->client->getEndpoint()->get($uri);
$recordings = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $recording) {
$recordings[] = new StoredRecording($recording);
}
... | php | public function getRecordings()
{
$uri = 'recordings/stored';
$response = $this->client->getEndpoint()->get($uri);
$recordings = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $recording) {
$recordings[] = new StoredRecording($recording);
}
... | [
"public",
"function",
"getRecordings",
"(",
")",
"{",
"$",
"uri",
"=",
"'recordings/stored'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"recordings",
"=",
"[",
... | List recordings that are complete.
@return StoredRecording[] | [
"List",
"recordings",
"that",
"are",
"complete",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L40-L51 |
188,478 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.getRecording | public function getRecording($recordingName)
{
$uri = "recordings/stored/$recordingName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new StoredRecording(\Guzz... | php | public function getRecording($recordingName)
{
$uri = "recordings/stored/$recordingName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new StoredRecording(\Guzz... | [
"public",
"function",
"getRecording",
"(",
"$",
"recordingName",
")",
"{",
"$",
"uri",
"=",
"\"recordings/stored/$recordingName\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"u... | Get a stored recording's details.
@param string $recordingName The name of the recording
@return StoredRecording
@throws NotFoundException | [
"Get",
"a",
"stored",
"recording",
"s",
"details",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L60-L70 |
188,479 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.deleteRecording | public function deleteRecording($recordingName)
{
$uri = "recordings/stored/$recordingName";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function deleteRecording($recordingName)
{
$uri = "recordings/stored/$recordingName";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"deleteRecording",
"(",
"$",
"recordingName",
")",
"{",
"$",
"uri",
"=",
"\"recordings/stored/$recordingName\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"delete",
"(",
"$",
"uri",
")",
";",
"... | Delete a stored recording.
@param string $recordingName The name of the recording
@return StoredRecording
@throws NotFoundException | [
"Delete",
"a",
"stored",
"recording",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L79-L87 |
188,480 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.copyRecording | public function copyRecording($recordingName, $destinationRecordingName)
{
$uri = "recordings/stored/$recordingName/copy";
try {
$response = $this->client->getEndpoint()->post($uri, [
'form_params' => [
'destinationRecordingName' => $destinationRecordi... | php | public function copyRecording($recordingName, $destinationRecordingName)
{
$uri = "recordings/stored/$recordingName/copy";
try {
$response = $this->client->getEndpoint()->post($uri, [
'form_params' => [
'destinationRecordingName' => $destinationRecordi... | [
"public",
"function",
"copyRecording",
"(",
"$",
"recordingName",
",",
"$",
"destinationRecordingName",
")",
"{",
"$",
"uri",
"=",
"\"recordings/stored/$recordingName/copy\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",... | Copy a stored recording.
@param string $recordingName The name of the recording to copy
@param string $destinationRecordingName (required) The destination name of the recording
@return StoredRecording
@throws ConflictException
@throws NotFoundException | [
"Copy",
"a",
"stored",
"recording",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L98-L112 |
188,481 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.getLiveRecording | public function getLiveRecording($recordingName)
{
$uri = "recordings/live/$recordingName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new LiveRecording($this... | php | public function getLiveRecording($recordingName)
{
$uri = "recordings/live/$recordingName";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new LiveRecording($this... | [
"public",
"function",
"getLiveRecording",
"(",
"$",
"recordingName",
")",
"{",
"$",
"uri",
"=",
"\"recordings/live/$recordingName\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
... | Get live recording
@param string $recordingName The name of the recording
@return LiveRecording
@throws NotFoundException | [
"Get",
"live",
"recording"
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L121-L131 |
188,482 | wormling/phparia | src/wormling/phparia/Api/Recordings.php | Recordings.stopLiveRecording | public function stopLiveRecording($recordingName)
{
$uri = "recordings/live/$recordingName/stop";
try {
$this->client->getEndpoint()->post($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function stopLiveRecording($recordingName)
{
$uri = "recordings/live/$recordingName/stop";
try {
$this->client->getEndpoint()->post($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"stopLiveRecording",
"(",
"$",
"recordingName",
")",
"{",
"$",
"uri",
"=",
"\"recordings/live/$recordingName/stop\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"post",
"(",
"$",
"uri",
")",
";",
... | Stop a live recording and store it.
@param string $recordingName The name of the recording
@throws NotFoundException | [
"Stop",
"a",
"live",
"recording",
"and",
"store",
"it",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Recordings.php#L171-L179 |
188,483 | wormling/phparia | src/wormling/phparia/Api/Endpoints.php | Endpoints.getEndpoints | public function getEndpoints()
{
$uri = 'endpoints';
$response = $this->client->getEndpoint()->get($uri);
$endpoints = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) {
$endpoints[] = new Endpoint($this->client, $endpoint);
}
ret... | php | public function getEndpoints()
{
$uri = 'endpoints';
$response = $this->client->getEndpoint()->get($uri);
$endpoints = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) {
$endpoints[] = new Endpoint($this->client, $endpoint);
}
ret... | [
"public",
"function",
"getEndpoints",
"(",
")",
"{",
"$",
"uri",
"=",
"'endpoints'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"endpoints",
"=",
"[",
"]",
";"... | List all endpoints.
@return Endpoint | [
"List",
"all",
"endpoints",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Endpoints.php#L43-L54 |
188,484 | wormling/phparia | src/wormling/phparia/Api/Endpoints.php | Endpoints.sendMessage | public function sendMessage($to, $from, $body, $variables = array())
{
$uri = 'endpoints/sendMessage';
try {
$this->client->getEndpoint()->put($uri, [
'form_params' => [
'to' => $to,
'from' => $from,
'body' => $b... | php | public function sendMessage($to, $from, $body, $variables = array())
{
$uri = 'endpoints/sendMessage';
try {
$this->client->getEndpoint()->put($uri, [
'form_params' => [
'to' => $to,
'from' => $from,
'body' => $b... | [
"public",
"function",
"sendMessage",
"(",
"$",
"to",
",",
"$",
"from",
",",
"$",
"body",
",",
"$",
"variables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"uri",
"=",
"'endpoints/sendMessage'",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndp... | Send a message to some technology URI or endpoint.
@param string $to (required) The endpoint resource or technology specific URI to send the message to. Valid resources are sip, pjsip, and xmpp.
@param string $from (required) The endpoint resource or technology specific identity to send this message from. Valid resour... | [
"Send",
"a",
"message",
"to",
"some",
"technology",
"URI",
"or",
"endpoint",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Endpoints.php#L65-L80 |
188,485 | wormling/phparia | src/wormling/phparia/Api/Endpoints.php | Endpoints.getEndpointsByTech | public function getEndpointsByTech($tech)
{
$uri = "endpoints/$tech";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
$endpoints = [];
foreach (\GuzzleHttp\json_d... | php | public function getEndpointsByTech($tech)
{
$uri = "endpoints/$tech";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
$endpoints = [];
foreach (\GuzzleHttp\json_d... | [
"public",
"function",
"getEndpointsByTech",
"(",
"$",
"tech",
")",
"{",
"$",
"uri",
"=",
"\"endpoints/$tech\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
... | List available endoints for a given endpoint technology.
@param string $tech Technology of the endpoints (sip,iax2,...)
@return \phparia\Resources\Endpoint[]
@throws NotFoundException | [
"List",
"available",
"endoints",
"for",
"a",
"given",
"endpoint",
"technology",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Endpoints.php#L89-L104 |
188,486 | wormling/phparia | src/wormling/phparia/Api/Endpoints.php | Endpoints.getEndpointByTechAndResource | public function getEndpointByTechAndResource($tech, $resource)
{
$uri = "endpoints/$tech/$resource";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Endpoint($... | php | public function getEndpointByTechAndResource($tech, $resource)
{
$uri = "endpoints/$tech/$resource";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Endpoint($... | [
"public",
"function",
"getEndpointByTechAndResource",
"(",
"$",
"tech",
",",
"$",
"resource",
")",
"{",
"$",
"uri",
"=",
"\"endpoints/$tech/$resource\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",... | Details for an endpoint.
@param string $tech Technology of the endpoint
@param string $resource ID of the endpoint
@return Endpoint
@throws InvalidParameterException
@throws NotFoundException | [
"Details",
"for",
"an",
"endpoint",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Endpoints.php#L115-L125 |
188,487 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.getChannels | public function getChannels()
{
$uri = 'channels';
$response = $this->client->getEndpoint()->get($uri);
$channels = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $channel) {
$channels[] = new Channel($this->client, $channel);
}
return $ch... | php | public function getChannels()
{
$uri = 'channels';
$response = $this->client->getEndpoint()->get($uri);
$channels = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $channel) {
$channels[] = new Channel($this->client, $channel);
}
return $ch... | [
"public",
"function",
"getChannels",
"(",
")",
"{",
"$",
"uri",
"=",
"'channels'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"channels",
"=",
"[",
"]",
";",
... | List all active channels in Asterisk.
@return Channel[] | [
"List",
"all",
"active",
"channels",
"in",
"Asterisk",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L57-L68 |
188,488 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.getChannel | public function getChannel($channelId)
{
$uri = "channels/$channelId";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Channel($this->client, \GuzzleHttp\json_... | php | public function getChannel($channelId)
{
$uri = "channels/$channelId";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
return new Channel($this->client, \GuzzleHttp\json_... | [
"public",
"function",
"getChannel",
"(",
"$",
"channelId",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
... | Channel details.
@param string $channelId
@return Channel
@throws NotFoundException | [
"Channel",
"details",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L140-L150 |
188,489 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.redirect | public function redirect($channelId, $endpoint)
{
$uri = "channels/$channelId/redirect";
try {
$this->client->getEndpoint()->post($uri, [
'form_params' => [
'endpoint' => $endpoint
]
]);
} catch (RequestException $e)... | php | public function redirect($channelId, $endpoint)
{
$uri = "channels/$channelId/redirect";
try {
$this->client->getEndpoint()->post($uri, [
'form_params' => [
'endpoint' => $endpoint
]
]);
} catch (RequestException $e)... | [
"public",
"function",
"redirect",
"(",
"$",
"channelId",
",",
"$",
"endpoint",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId/redirect\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"post",
"(",
"$",
"uri",
",",... | Redirect the channel to a different location.
@param string $channelId Channel's id
@param string $endpoint (required) The endpoint to redirect the channel to
@throws MissingParameterException
@throws NotFoundException
@throws ConflictException
@throws UnprocessableEntityException
@throws PreconditionFailedException | [
"Redirect",
"the",
"channel",
"to",
"a",
"different",
"location",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L281-L293 |
188,490 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.mute | public function mute($channelId, $direction)
{
$uri = "channels/$channelId/mute";
try {
$this->client->getEndpoint()->post($uri, [
'form_params' => [
'direction' => $direction,
]
]);
} catch (RequestException $e) {
... | php | public function mute($channelId, $direction)
{
$uri = "channels/$channelId/mute";
try {
$this->client->getEndpoint()->post($uri, [
'form_params' => [
'direction' => $direction,
]
]);
} catch (RequestException $e) {
... | [
"public",
"function",
"mute",
"(",
"$",
"channelId",
",",
"$",
"direction",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId/mute\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"post",
"(",
"$",
"uri",
",",
"[",... | Mute a channel.
@param string $channelId Channel's id
@param string $direction (default both) Direction in which to mute audio. Allowed values: both, in, out
@throws NotFoundException
@throws ConflictException | [
"Mute",
"a",
"channel",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L385-L397 |
188,491 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.unmute | public function unmute($channelId, $direction)
{
$uri = "channels/$channelId/mute?direction=".\GuzzleHttp\json_encode($direction);
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function unmute($channelId, $direction)
{
$uri = "channels/$channelId/mute?direction=".\GuzzleHttp\json_encode($direction);
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"unmute",
"(",
"$",
"channelId",
",",
"$",
"direction",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId/mute?direction=\"",
".",
"\\",
"GuzzleHttp",
"\\",
"json_encode",
"(",
"$",
"direction",
")",
";",
"try",
"{",
"$",
"this",
"->",
... | Unmute a channel.
@param string $channelId Channel's id
@param string $direction (default both) Direction in which to unmute audio
@throws NotFoundException
@throws ConflictException | [
"Unmute",
"a",
"channel",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L407-L415 |
188,492 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.hold | public function hold($channelId)
{
$uri = "channels/$channelId/hold";
try {
$this->client->getEndpoint()->post($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function hold($channelId)
{
$uri = "channels/$channelId/hold";
try {
$this->client->getEndpoint()->post($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"hold",
"(",
"$",
"channelId",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId/hold\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"post",
"(",
"$",
"uri",
")",
";",
"}",
"catch",
"(",
"... | Hold a channel.
@param string $channelId Channel's id
@throws NotFoundException
@throws ConflictException | [
"Hold",
"a",
"channel",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L424-L432 |
188,493 | wormling/phparia | src/wormling/phparia/Api/Channels.php | Channels.unhold | public function unhold($channelId)
{
$uri = "channels/$channelId/hold";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function unhold($channelId)
{
$uri = "channels/$channelId/hold";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"unhold",
"(",
"$",
"channelId",
")",
"{",
"$",
"uri",
"=",
"\"channels/$channelId/hold\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"delete",
"(",
"$",
"uri",
")",
";",
"}",
"catch",
"(",... | Remove a channel from hold.
@param string $channelId Channel's id
@throws NotFoundException
@throws ConflictException | [
"Remove",
"a",
"channel",
"from",
"hold",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Channels.php#L441-L449 |
188,494 | wormling/phparia | src/wormling/phparia/Resources/Response.php | Response.getResponseValue | protected function getResponseValue($propertyName, $class = null, AriClient $client = null)
{
if (property_exists($this->response, $propertyName)) {
if ($class !== null) {
if ($client instanceof AriClient) {
return new $class($client, $this->response->{$proper... | php | protected function getResponseValue($propertyName, $class = null, AriClient $client = null)
{
if (property_exists($this->response, $propertyName)) {
if ($class !== null) {
if ($client instanceof AriClient) {
return new $class($client, $this->response->{$proper... | [
"protected",
"function",
"getResponseValue",
"(",
"$",
"propertyName",
",",
"$",
"class",
"=",
"null",
",",
"AriClient",
"$",
"client",
"=",
"null",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
"->",
"response",
",",
"$",
"propertyName",
")",
... | Get the response value or object depending on which type of class.
@param string $propertyName The name of the property to retrieve
@param string|null $class (optional) The name of the class to pass the propertyValue to and return
@param AriClient|null $client (optional, requires $class) The AriClient instance to pass... | [
"Get",
"the",
"response",
"value",
"or",
"object",
"depending",
"on",
"which",
"type",
"of",
"class",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Resources/Response.php#L60-L75 |
188,495 | wormling/phparia | src/wormling/phparia/Api/Asterisk.php | Asterisk.getObject | public function getObject($configClass, $objectType, $id)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
... | php | public function getObject($configClass, $objectType, $id)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$response = $this->client->getEndpoint()->get($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
... | [
"public",
"function",
"getObject",
"(",
"$",
"configClass",
",",
"$",
"objectType",
",",
"$",
"id",
")",
"{",
"$",
"uri",
"=",
"\"asterisk/config/dynamic/$configClass/$objectType/$id\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",... | Retrieve a dynamic configuration object.
@param string $configClass The configuration class containing dynamic configuration objects.
@param string $objectType The type of configuration object to retrieve.
@param string $id The unique identifier of the object to retrieve.
@return ConfigTuple[]
@throws NotFoundExceptio... | [
"Retrieve",
"a",
"dynamic",
"configuration",
"object",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Asterisk.php#L55-L71 |
188,496 | wormling/phparia | src/wormling/phparia/Api/Asterisk.php | Asterisk.updateObject | public function updateObject($configClass, $objectType, $id, $fields)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$response = $this->client->getEndpoint()->put($uri, [
'form_params' => [
'fields' => array_map('strval', $fiel... | php | public function updateObject($configClass, $objectType, $id, $fields)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$response = $this->client->getEndpoint()->put($uri, [
'form_params' => [
'fields' => array_map('strval', $fiel... | [
"public",
"function",
"updateObject",
"(",
"$",
"configClass",
",",
"$",
"objectType",
",",
"$",
"id",
",",
"$",
"fields",
")",
"{",
"$",
"uri",
"=",
"\"asterisk/config/dynamic/$configClass/$objectType/$id\"",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this"... | Create or update a dynamic configuration object.
@param string $configClass The configuration class containing dynamic configuration objects.
@param string $objectType The type of configuration object to retrieve.
@param string $id The unique identifier of the object to retrieve.
@param ConfigTuple[] $fields The body ... | [
"Create",
"or",
"update",
"a",
"dynamic",
"configuration",
"object",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Asterisk.php#L85-L105 |
188,497 | wormling/phparia | src/wormling/phparia/Api/Asterisk.php | Asterisk.deleteObject | public function deleteObject($configClass, $objectType, $id)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | php | public function deleteObject($configClass, $objectType, $id)
{
$uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
try {
$this->client->getEndpoint()->delete($uri);
} catch (RequestException $e) {
$this->processRequestException($e);
}
} | [
"public",
"function",
"deleteObject",
"(",
"$",
"configClass",
",",
"$",
"objectType",
",",
"$",
"id",
")",
"{",
"$",
"uri",
"=",
"\"asterisk/config/dynamic/$configClass/$objectType/$id\"",
";",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
... | Delete a dynamic configuration object.
@param string $configClass The configuration class containing dynamic configuration objects.
@param string $objectType The type of configuration object to retrieve.
@param string $id The unique identifier of the object to retrieve.
@throws ForbiddenException
@throws NotFoundExcep... | [
"Delete",
"a",
"dynamic",
"configuration",
"object",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Asterisk.php#L116-L125 |
188,498 | wormling/phparia | src/wormling/phparia/Api/Asterisk.php | Asterisk.getInfo | public function getInfo($only = null)
{
if (empty($only)) {
$uri = 'asterisk/info';
} else {
$uri = "asterisk/info?only=$only";
}
$response = $this->client->getEndpoint()->get($uri);
return new AsteriskInfo(\GuzzleHttp\json_decode($response->getBody()... | php | public function getInfo($only = null)
{
if (empty($only)) {
$uri = 'asterisk/info';
} else {
$uri = "asterisk/info?only=$only";
}
$response = $this->client->getEndpoint()->get($uri);
return new AsteriskInfo(\GuzzleHttp\json_decode($response->getBody()... | [
"public",
"function",
"getInfo",
"(",
"$",
"only",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"only",
")",
")",
"{",
"$",
"uri",
"=",
"'asterisk/info'",
";",
"}",
"else",
"{",
"$",
"uri",
"=",
"\"asterisk/info?only=$only\"",
";",
"}",
"$",
... | Gets Asterisk system information.
@param string $only Filter information returned. Allows comma separated values. Allowed values: build, system, config, status.
@return AsteriskInfo | [
"Gets",
"Asterisk",
"system",
"information",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Asterisk.php#L133-L143 |
188,499 | wormling/phparia | src/wormling/phparia/Api/Asterisk.php | Asterisk.listModules | public function listModules()
{
$uri = 'asterisk/modules';
$response = $this->client->getEndpoint()->get($uri);
$modules = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $module) {
$modules[] = new Module($module);
}
return $modules;
... | php | public function listModules()
{
$uri = 'asterisk/modules';
$response = $this->client->getEndpoint()->get($uri);
$modules = [];
foreach (\GuzzleHttp\json_decode($response->getBody()) as $module) {
$modules[] = new Module($module);
}
return $modules;
... | [
"public",
"function",
"listModules",
"(",
")",
"{",
"$",
"uri",
"=",
"'asterisk/modules'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"getEndpoint",
"(",
")",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"$",
"modules",
"=",
"[",
"]",
... | List Asterisk modules.
@return Module[] | [
"List",
"Asterisk",
"modules",
"."
] | 955f9c01bd6001f11776273e262dbed0b7eb74d0 | https://github.com/wormling/phparia/blob/955f9c01bd6001f11776273e262dbed0b7eb74d0/src/wormling/phparia/Api/Asterisk.php#L150-L162 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.