repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6 values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1 value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.postSaveHook | public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
$apiLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($quoteTransfer->getPayment()->getPayone()->getFkSalesOrder());
$apiLog = $apiLogsQuery->findOne();
if ($apiLog) {
$redirectUrl = $apiLog->getRedirectUrl();
if ($redirectUrl !== null) {
$checkoutResponse->setIsExternalRedirect(true);
$checkoutResponse->setRedirectUrl($redirectUrl);
}
$errorCode = $apiLog->getErrorCode();
if ($errorCode) {
$error = new CheckoutErrorTransfer();
$error->setMessage($apiLog->getErrorMessageUser());
$error->setErrorCode($errorCode);
$checkoutResponse->addError($error);
$checkoutResponse->setIsSuccess(false);
}
}
return $checkoutResponse;
} | php | public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
$apiLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($quoteTransfer->getPayment()->getPayone()->getFkSalesOrder());
$apiLog = $apiLogsQuery->findOne();
if ($apiLog) {
$redirectUrl = $apiLog->getRedirectUrl();
if ($redirectUrl !== null) {
$checkoutResponse->setIsExternalRedirect(true);
$checkoutResponse->setRedirectUrl($redirectUrl);
}
$errorCode = $apiLog->getErrorCode();
if ($errorCode) {
$error = new CheckoutErrorTransfer();
$error->setMessage($apiLog->getErrorMessageUser());
$error->setErrorCode($errorCode);
$checkoutResponse->addError($error);
$checkoutResponse->setIsSuccess(false);
}
}
return $checkoutResponse;
} | [
"public",
"function",
"postSaveHook",
"(",
"QuoteTransfer",
"$",
"quoteTransfer",
",",
"CheckoutResponseTransfer",
"$",
"checkoutResponse",
")",
"{",
"$",
"apiLogsQuery",
"=",
"$",
"this",
"->",
"queryContainer",
"->",
"createLastApiLogsByOrderId",
"(",
"$",
"quoteTra... | @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
@param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
@return \Generated\Shared\Transfer\CheckoutResponseTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"QuoteTransfer",
"$quoteTransfer",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"CheckoutResponseTransfer",
"$checkoutResponse"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L863-L888 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.updatePaymentDetail | public function updatePaymentDetail(PaymentDetailTransfer $paymentDataTransfer, $idOrder)
{
$paymentEntity = $this->queryContainer->createPaymentByOrderId($idOrder)->findOne();
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();
$paymentDetailEntity->fromArray($paymentDataTransfer->toArray());
$paymentDetailEntity->save();
} | php | public function updatePaymentDetail(PaymentDetailTransfer $paymentDataTransfer, $idOrder)
{
$paymentEntity = $this->queryContainer->createPaymentByOrderId($idOrder)->findOne();
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();
$paymentDetailEntity->fromArray($paymentDataTransfer->toArray());
$paymentDetailEntity->save();
} | [
"public",
"function",
"updatePaymentDetail",
"(",
"PaymentDetailTransfer",
"$",
"paymentDataTransfer",
",",
"$",
"idOrder",
")",
"{",
"$",
"paymentEntity",
"=",
"$",
"this",
"->",
"queryContainer",
"->",
"createPaymentByOrderId",
"(",
"$",
"idOrder",
")",
"->",
"f... | @param \Generated\Shared\Transfer\PaymentDetailTransfer $paymentDataTransfer
@param int $idOrder
@return void | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PaymentDetailTransfer",
"$paymentDataTransfer",
"@param",
"int",
"$idOrder"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L896-L904 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.updatePaymentDetailAfterAuthorization | protected function updatePaymentDetailAfterAuthorization(SpyPaymentPayone $paymentEntity, AuthorizationResponseContainer $responseContainer)
{
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();
$paymentDetailEntity->setClearingBankAccountHolder($responseContainer->getClearingBankaccountholder());
$paymentDetailEntity->setClearingBankCountry($responseContainer->getClearingBankcountry());
$paymentDetailEntity->setClearingBankAccount($responseContainer->getClearingBankaccount());
$paymentDetailEntity->setClearingBankCode($responseContainer->getClearingBankcode());
$paymentDetailEntity->setClearingBankIban($responseContainer->getClearingBankiban());
$paymentDetailEntity->setClearingBankBic($responseContainer->getClearingBankbic());
$paymentDetailEntity->setClearingBankCity($responseContainer->getClearingBankcity());
$paymentDetailEntity->setClearingBankName($responseContainer->getClearingBankname());
if ($responseContainer->getMandateIdentification()) {
$paymentDetailEntity->setMandateIdentification($responseContainer->getMandateIdentification());
}
if ($paymentEntity->getPaymentMethod() == PayoneApiConstants::PAYMENT_METHOD_INVOICE) {
$paymentDetailEntity->setInvoiceTitle($this->getInvoiceTitle($paymentEntity->getTransactionId()));
}
$paymentDetailEntity->save();
} | php | protected function updatePaymentDetailAfterAuthorization(SpyPaymentPayone $paymentEntity, AuthorizationResponseContainer $responseContainer)
{
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();
$paymentDetailEntity->setClearingBankAccountHolder($responseContainer->getClearingBankaccountholder());
$paymentDetailEntity->setClearingBankCountry($responseContainer->getClearingBankcountry());
$paymentDetailEntity->setClearingBankAccount($responseContainer->getClearingBankaccount());
$paymentDetailEntity->setClearingBankCode($responseContainer->getClearingBankcode());
$paymentDetailEntity->setClearingBankIban($responseContainer->getClearingBankiban());
$paymentDetailEntity->setClearingBankBic($responseContainer->getClearingBankbic());
$paymentDetailEntity->setClearingBankCity($responseContainer->getClearingBankcity());
$paymentDetailEntity->setClearingBankName($responseContainer->getClearingBankname());
if ($responseContainer->getMandateIdentification()) {
$paymentDetailEntity->setMandateIdentification($responseContainer->getMandateIdentification());
}
if ($paymentEntity->getPaymentMethod() == PayoneApiConstants::PAYMENT_METHOD_INVOICE) {
$paymentDetailEntity->setInvoiceTitle($this->getInvoiceTitle($paymentEntity->getTransactionId()));
}
$paymentDetailEntity->save();
} | [
"protected",
"function",
"updatePaymentDetailAfterAuthorization",
"(",
"SpyPaymentPayone",
"$",
"paymentEntity",
",",
"AuthorizationResponseContainer",
"$",
"responseContainer",
")",
"{",
"$",
"paymentDetailEntity",
"=",
"$",
"paymentEntity",
"->",
"getSpyPaymentPayoneDetail",
... | @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity
@param \SprykerEco\Zed\Payone\Business\Api\Response\Container\AuthorizationResponseContainer $responseContainer
@return void | [
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Persistence",
"\\",
"SpyPaymentPayone",
"$paymentEntity",
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Response",
"\\",
"Container",
"\\",
"Authoriza... | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L912-L934 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.initPaypalExpressCheckout | public function initPaypalExpressCheckout(PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer)
{
$paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(
PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT
);
$baseGenericPaymentContainer = $paymentMethodMapper->createBaseGenericPaymentContainer();
$baseGenericPaymentContainer->getPaydata()->setAction(PayoneApiConstants::PAYONE_EXPRESS_CHECKOUT_SET_ACTION);
$requestContainer = $paymentMethodMapper->mapRequestTransferToGenericPayment(
$baseGenericPaymentContainer,
$requestTransfer
);
$responseTransfer = $this->performGenericRequest($requestContainer);
return $responseTransfer;
} | php | public function initPaypalExpressCheckout(PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer)
{
$paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(
PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT
);
$baseGenericPaymentContainer = $paymentMethodMapper->createBaseGenericPaymentContainer();
$baseGenericPaymentContainer->getPaydata()->setAction(PayoneApiConstants::PAYONE_EXPRESS_CHECKOUT_SET_ACTION);
$requestContainer = $paymentMethodMapper->mapRequestTransferToGenericPayment(
$baseGenericPaymentContainer,
$requestTransfer
);
$responseTransfer = $this->performGenericRequest($requestContainer);
return $responseTransfer;
} | [
"public",
"function",
"initPaypalExpressCheckout",
"(",
"PayoneInitPaypalExpressCheckoutRequestTransfer",
"$",
"requestTransfer",
")",
"{",
"$",
"paymentMethodMapper",
"=",
"$",
"this",
"->",
"getRegisteredPaymentMethodMapper",
"(",
"PayoneApiConstants",
"::",
"PAYMENT_METHOD_P... | @param \Generated\Shared\Transfer\PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer
@return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PayoneInitPaypalExpressCheckoutRequestTransfer",
"$requestTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L941-L955 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.getPaypalExpressCheckoutDetails | public function getPaypalExpressCheckoutDetails(QuoteTransfer $quoteTransfer)
{
$paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(
PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT
);
$baseGenericPaymentContainer = $paymentMethodMapper->createBaseGenericPaymentContainer();
$baseGenericPaymentContainer->getPaydata()->setAction(
PayoneApiConstants::PAYONE_EXPRESS_CHECKOUT_GET_DETAILS_ACTION
);
$requestContainer = $paymentMethodMapper->mapQuoteTransferToGenericPayment(
$baseGenericPaymentContainer,
$quoteTransfer
);
$responseTransfer = $this->performGenericRequest($requestContainer);
return $responseTransfer;
} | php | public function getPaypalExpressCheckoutDetails(QuoteTransfer $quoteTransfer)
{
$paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(
PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT
);
$baseGenericPaymentContainer = $paymentMethodMapper->createBaseGenericPaymentContainer();
$baseGenericPaymentContainer->getPaydata()->setAction(
PayoneApiConstants::PAYONE_EXPRESS_CHECKOUT_GET_DETAILS_ACTION
);
$requestContainer = $paymentMethodMapper->mapQuoteTransferToGenericPayment(
$baseGenericPaymentContainer,
$quoteTransfer
);
$responseTransfer = $this->performGenericRequest($requestContainer);
return $responseTransfer;
} | [
"public",
"function",
"getPaypalExpressCheckoutDetails",
"(",
"QuoteTransfer",
"$",
"quoteTransfer",
")",
"{",
"$",
"paymentMethodMapper",
"=",
"$",
"this",
"->",
"getRegisteredPaymentMethodMapper",
"(",
"PayoneApiConstants",
"::",
"PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT",
")... | @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
@return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"QuoteTransfer",
"$quoteTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L962-L979 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.performGenericRequest | protected function performGenericRequest(GenericPaymentContainer $requestContainer)
{
$this->setStandardParameter($requestContainer);
$rawResponse = $this->executionAdapter->sendRequest($requestContainer);
$responseContainer = new GenericPaymentResponseContainer($rawResponse);
$responseTransfer = new PayonePaypalExpressCheckoutGenericPaymentResponseTransfer();
$responseTransfer->setRedirectUrl($responseContainer->getRedirectUrl());
$responseTransfer->setWorkOrderId($responseContainer->getWorkOrderId());
$responseTransfer->setRawResponse(json_encode($rawResponse));
$responseTransfer->setStatus($responseContainer->getStatus());
$responseTransfer->setCustomerMessage($responseContainer->getCustomermessage());
$responseTransfer->setErrorMessage($responseContainer->getErrormessage());
$responseTransfer->setErrorCode($responseContainer->getErrorcode());
$responseTransfer->setEmail($responseContainer->getEmail());
$responseTransfer->setShippingFirstName($responseContainer->getShippingFirstname());
$responseTransfer->setShippingLastName($responseContainer->getShippingLastname());
$responseTransfer->setShippingCompany($responseContainer->getShippingCompany());
$responseTransfer->setShippingCountry($responseContainer->getShippingCountry());
$responseTransfer->setShippingState($responseContainer->getShippingState());
$responseTransfer->setShippingStreet($responseContainer->getShippingStreet());
$responseTransfer->setShippingAddressAdition($responseContainer->getShippingAddressaddition());
$responseTransfer->setShippingCity($responseContainer->getShippingCity());
$responseTransfer->setShippingZip($responseContainer->getShippingZip());
return $responseTransfer;
} | php | protected function performGenericRequest(GenericPaymentContainer $requestContainer)
{
$this->setStandardParameter($requestContainer);
$rawResponse = $this->executionAdapter->sendRequest($requestContainer);
$responseContainer = new GenericPaymentResponseContainer($rawResponse);
$responseTransfer = new PayonePaypalExpressCheckoutGenericPaymentResponseTransfer();
$responseTransfer->setRedirectUrl($responseContainer->getRedirectUrl());
$responseTransfer->setWorkOrderId($responseContainer->getWorkOrderId());
$responseTransfer->setRawResponse(json_encode($rawResponse));
$responseTransfer->setStatus($responseContainer->getStatus());
$responseTransfer->setCustomerMessage($responseContainer->getCustomermessage());
$responseTransfer->setErrorMessage($responseContainer->getErrormessage());
$responseTransfer->setErrorCode($responseContainer->getErrorcode());
$responseTransfer->setEmail($responseContainer->getEmail());
$responseTransfer->setShippingFirstName($responseContainer->getShippingFirstname());
$responseTransfer->setShippingLastName($responseContainer->getShippingLastname());
$responseTransfer->setShippingCompany($responseContainer->getShippingCompany());
$responseTransfer->setShippingCountry($responseContainer->getShippingCountry());
$responseTransfer->setShippingState($responseContainer->getShippingState());
$responseTransfer->setShippingStreet($responseContainer->getShippingStreet());
$responseTransfer->setShippingAddressAdition($responseContainer->getShippingAddressaddition());
$responseTransfer->setShippingCity($responseContainer->getShippingCity());
$responseTransfer->setShippingZip($responseContainer->getShippingZip());
return $responseTransfer;
} | [
"protected",
"function",
"performGenericRequest",
"(",
"GenericPaymentContainer",
"$",
"requestContainer",
")",
"{",
"$",
"this",
"->",
"setStandardParameter",
"(",
"$",
"requestContainer",
")",
";",
"$",
"rawResponse",
"=",
"$",
"this",
"->",
"executionAdapter",
"-... | @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\GenericPaymentContainer $requestContainer
@return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer | [
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Request",
"\\",
"Container",
"\\",
"GenericPaymentContainer",
"$requestContainer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L986-L1012 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.prepareOrderItems | protected function prepareOrderItems(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = [];
$arrayId = [];
$arrayPr = [];
$arrayNo = [];
$arrayDe = [];
$arrayVa = [];
$key = 1;
foreach ($orderTransfer->getItems() as $itemTransfer) {
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS;
$arrayId[$key] = $itemTransfer->getSku();
$arrayPr[$key] = $itemTransfer->getUnitGrossPrice();
$arrayNo[$key] = $itemTransfer->getQuantity();
$arrayDe[$key] = $itemTransfer->getName();
$arrayVa[$key] = (int)$itemTransfer->getTaxRate();
$key++;
}
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | php | protected function prepareOrderItems(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = [];
$arrayId = [];
$arrayPr = [];
$arrayNo = [];
$arrayDe = [];
$arrayVa = [];
$key = 1;
foreach ($orderTransfer->getItems() as $itemTransfer) {
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS;
$arrayId[$key] = $itemTransfer->getSku();
$arrayPr[$key] = $itemTransfer->getUnitGrossPrice();
$arrayNo[$key] = $itemTransfer->getQuantity();
$arrayDe[$key] = $itemTransfer->getName();
$arrayVa[$key] = (int)$itemTransfer->getTaxRate();
$key++;
}
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | [
"protected",
"function",
"prepareOrderItems",
"(",
"OrderTransfer",
"$",
"orderTransfer",
",",
"AbstractRequestContainer",
"$",
"container",
")",
":",
"AbstractRequestContainer",
"{",
"$",
"arrayIt",
"=",
"[",
"]",
";",
"$",
"arrayId",
"=",
"[",
"]",
";",
"$",
... | @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
@param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $container
@return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"OrderTransfer",
"$orderTransfer",
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Request",
"\\",
"Container",
"\\",
"AbstractRequestContainer",
... | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L1020-L1049 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.prepareOrderShipment | protected function prepareOrderShipment(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = $container->getIt() ?? [];
$arrayId = $container->getId() ?? [];
$arrayPr = $container->getPr() ?? [];
$arrayNo = $container->getNo() ?? [];
$arrayDe = $container->getDe() ?? [];
$arrayVa = $container->getVa() ?? [];
$key = count($arrayId) + 1;
$expenses = $orderTransfer->getExpenses();
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_SHIPMENT;
$arrayId[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_SHIPMENT;
$arrayPr[$key] = $this->getDeliveryCosts($expenses);
$arrayNo[$key] = 1;
$arrayDe[$key] = 'Shipment';
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | php | protected function prepareOrderShipment(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = $container->getIt() ?? [];
$arrayId = $container->getId() ?? [];
$arrayPr = $container->getPr() ?? [];
$arrayNo = $container->getNo() ?? [];
$arrayDe = $container->getDe() ?? [];
$arrayVa = $container->getVa() ?? [];
$key = count($arrayId) + 1;
$expenses = $orderTransfer->getExpenses();
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_SHIPMENT;
$arrayId[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_SHIPMENT;
$arrayPr[$key] = $this->getDeliveryCosts($expenses);
$arrayNo[$key] = 1;
$arrayDe[$key] = 'Shipment';
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | [
"protected",
"function",
"prepareOrderShipment",
"(",
"OrderTransfer",
"$",
"orderTransfer",
",",
"AbstractRequestContainer",
"$",
"container",
")",
":",
"AbstractRequestContainer",
"{",
"$",
"arrayIt",
"=",
"$",
"container",
"->",
"getIt",
"(",
")",
"??",
"[",
"]... | @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
@param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $container
@return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"OrderTransfer",
"$orderTransfer",
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Request",
"\\",
"Container",
"\\",
"AbstractRequestContainer",
... | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L1057-L1083 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.prepareOrderDiscount | protected function prepareOrderDiscount(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = $container->getIt() ?? [];
$arrayId = $container->getId() ?? [];
$arrayPr = $container->getPr() ?? [];
$arrayNo = $container->getNo() ?? [];
$arrayDe = $container->getDe() ?? [];
$arrayVa = $container->getVa() ?? [];
$key = count($arrayId) + 1;
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_VOUCHER;
$arrayId[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_VOUCHER;
$arrayPr[$key] = - $orderTransfer->getTotals()->getDiscountTotal();
$arrayNo[$key] = 1;
$arrayDe[$key] = 'Discount';
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | php | protected function prepareOrderDiscount(OrderTransfer $orderTransfer, AbstractRequestContainer $container): AbstractRequestContainer
{
$arrayIt = $container->getIt() ?? [];
$arrayId = $container->getId() ?? [];
$arrayPr = $container->getPr() ?? [];
$arrayNo = $container->getNo() ?? [];
$arrayDe = $container->getDe() ?? [];
$arrayVa = $container->getVa() ?? [];
$key = count($arrayId) + 1;
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_VOUCHER;
$arrayId[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_VOUCHER;
$arrayPr[$key] = - $orderTransfer->getTotals()->getDiscountTotal();
$arrayNo[$key] = 1;
$arrayDe[$key] = 'Discount';
$container->setIt($arrayIt);
$container->setId($arrayId);
$container->setPr($arrayPr);
$container->setNo($arrayNo);
$container->setDe($arrayDe);
$container->setVa($arrayVa);
return $container;
} | [
"protected",
"function",
"prepareOrderDiscount",
"(",
"OrderTransfer",
"$",
"orderTransfer",
",",
"AbstractRequestContainer",
"$",
"container",
")",
":",
"AbstractRequestContainer",
"{",
"$",
"arrayIt",
"=",
"$",
"container",
"->",
"getIt",
"(",
")",
"??",
"[",
"]... | @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
@param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $container
@return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"OrderTransfer",
"$orderTransfer",
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Request",
"\\",
"Container",
"\\",
"AbstractRequestContainer",
... | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L1091-L1116 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php | PaymentManager.getDeliveryCosts | protected function getDeliveryCosts(ArrayObject $expenses): string
{
foreach ($expenses as $expense) {
if ($expense->getType() === ShipmentConstants::SHIPMENT_EXPENSE_TYPE) {
return $expense->getSumGrossPrice();
}
}
return 0;
} | php | protected function getDeliveryCosts(ArrayObject $expenses): string
{
foreach ($expenses as $expense) {
if ($expense->getType() === ShipmentConstants::SHIPMENT_EXPENSE_TYPE) {
return $expense->getSumGrossPrice();
}
}
return 0;
} | [
"protected",
"function",
"getDeliveryCosts",
"(",
"ArrayObject",
"$",
"expenses",
")",
":",
"string",
"{",
"foreach",
"(",
"$",
"expenses",
"as",
"$",
"expense",
")",
"{",
"if",
"(",
"$",
"expense",
"->",
"getType",
"(",
")",
"===",
"ShipmentConstants",
":... | @param \ArrayObject $expenses
@return string | [
"@param",
"\\",
"ArrayObject",
"$expenses"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/PaymentManager.php#L1123-L1131 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Handler/ExpressCheckoutHandler.php | ExpressCheckoutHandler.addExpressCheckoutPaymentToQuote | protected function addExpressCheckoutPaymentToQuote(QuoteTransfer $quoteTransfer)
{
$paymentTransfer = new PaymentTransfer();
$paymentTransfer->setPaymentProvider(PayoneConstants::PROVIDER_NAME);
$paypalExpressCheckoutPayment = new PayonePaypalExpressCheckoutTransfer();
$paymentTransfer->setPayonePaypalExpressCheckout($paypalExpressCheckoutPayment);
$quoteTransfer->setPayment($paymentTransfer);
} | php | protected function addExpressCheckoutPaymentToQuote(QuoteTransfer $quoteTransfer)
{
$paymentTransfer = new PaymentTransfer();
$paymentTransfer->setPaymentProvider(PayoneConstants::PROVIDER_NAME);
$paypalExpressCheckoutPayment = new PayonePaypalExpressCheckoutTransfer();
$paymentTransfer->setPayonePaypalExpressCheckout($paypalExpressCheckoutPayment);
$quoteTransfer->setPayment($paymentTransfer);
} | [
"protected",
"function",
"addExpressCheckoutPaymentToQuote",
"(",
"QuoteTransfer",
"$",
"quoteTransfer",
")",
"{",
"$",
"paymentTransfer",
"=",
"new",
"PaymentTransfer",
"(",
")",
";",
"$",
"paymentTransfer",
"->",
"setPaymentProvider",
"(",
"PayoneConstants",
"::",
"... | @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
@return void | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"QuoteTransfer",
"$quoteTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Handler/ExpressCheckoutHandler.php#L147-L154 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/PayoneDependencyProvider.php | PayoneDependencyProvider.provideDependencies | public function provideDependencies(Container $container)
{
$container[self::CLIENT_PAYONE] = function (Container $container) {
return $container->getLocator()->payone()->client();
};
$container[self::CLIENT_CUSTOMER] = function (Container $container) {
return new PayoneToCustomerBridge($container->getLocator()->customer()->client());
};
$container[self::CLIENT_CART] = function (Container $container) {
return new PayoneToCartBridge($container->getLocator()->cart()->client());
};
$container[self::CLIENT_SHIPMENT] = function (Container $container) {
return new PayoneToShipmentBridge($container->getLocator()->shipment()->client());
};
$container[self::CLIENT_CALCULATION] = function (Container $container) {
return new PayoneToCalculationBridge($container->getLocator()->calculation()->client());
};
return $container;
} | php | public function provideDependencies(Container $container)
{
$container[self::CLIENT_PAYONE] = function (Container $container) {
return $container->getLocator()->payone()->client();
};
$container[self::CLIENT_CUSTOMER] = function (Container $container) {
return new PayoneToCustomerBridge($container->getLocator()->customer()->client());
};
$container[self::CLIENT_CART] = function (Container $container) {
return new PayoneToCartBridge($container->getLocator()->cart()->client());
};
$container[self::CLIENT_SHIPMENT] = function (Container $container) {
return new PayoneToShipmentBridge($container->getLocator()->shipment()->client());
};
$container[self::CLIENT_CALCULATION] = function (Container $container) {
return new PayoneToCalculationBridge($container->getLocator()->calculation()->client());
};
return $container;
} | [
"public",
"function",
"provideDependencies",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"container",
"[",
"self",
"::",
"CLIENT_PAYONE",
"]",
"=",
"function",
"(",
"Container",
"$",
"container",
")",
"{",
"return",
"$",
"container",
"->",
"getLocator",... | @param \Spryker\Yves\Kernel\Container $container
@return \Spryker\Yves\Kernel\Container | [
"@param",
"\\",
"Spryker",
"\\",
"Yves",
"\\",
"Kernel",
"\\",
"Container",
"$container"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/PayoneDependencyProvider.php#L34-L57 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/Adapter/Http/Guzzle.php | Guzzle.performRequest | protected function performRequest(array $params)
{
$urlArray = $this->generateUrlArray($params);
$urlHost = $urlArray['host'];
$urlPath = isset($urlArray['path']) ? $urlArray['path'] : '';
$urlScheme = $urlArray['scheme'];
$url = $urlScheme . '://' . $urlHost . $urlPath;
$this->logger
->logUrl($url)
->logRequest(print_r($params, true));
try {
$response = $this->client->post($url, ['form_params' => $params]);
} catch (ConnectException $e) {
$this->logger->flush();
throw new TimeoutException('Timeout - Payone Communication: ' . $e->getMessage());
} catch (ClientException $e) {
$response = $e->getResponse();
}
$result = (string)$response->getBody();
$this->logger
->logResponse($result)
->flush();
$result = explode("\n", $result);
return $result;
} | php | protected function performRequest(array $params)
{
$urlArray = $this->generateUrlArray($params);
$urlHost = $urlArray['host'];
$urlPath = isset($urlArray['path']) ? $urlArray['path'] : '';
$urlScheme = $urlArray['scheme'];
$url = $urlScheme . '://' . $urlHost . $urlPath;
$this->logger
->logUrl($url)
->logRequest(print_r($params, true));
try {
$response = $this->client->post($url, ['form_params' => $params]);
} catch (ConnectException $e) {
$this->logger->flush();
throw new TimeoutException('Timeout - Payone Communication: ' . $e->getMessage());
} catch (ClientException $e) {
$response = $e->getResponse();
}
$result = (string)$response->getBody();
$this->logger
->logResponse($result)
->flush();
$result = explode("\n", $result);
return $result;
} | [
"protected",
"function",
"performRequest",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"urlArray",
"=",
"$",
"this",
"->",
"generateUrlArray",
"(",
"$",
"params",
")",
";",
"$",
"urlHost",
"=",
"$",
"urlArray",
"[",
"'host'",
"]",
";",
"$",
"urlPath",
... | @param array $params
@throws \SprykerEco\Zed\Payone\Business\Exception\TimeoutException
@return array | [
"@param",
"array",
"$params"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/Adapter/Http/Guzzle.php#L49-L78 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Key/HashGenerator.php | HashGenerator.generateParamHash | public function generateParamHash(AbstractRequestContainer $request, $securityKey)
{
$hashString = '';
$requestData = $request->toArray();
sort($this->hashParameters);
foreach ($this->hashParameters as $key) {
if (!array_key_exists($key, $requestData)) {
continue;
}
$hashString .= $requestData[$key];
}
$hashString .= $securityKey;
return $this->hash($hashString);
} | php | public function generateParamHash(AbstractRequestContainer $request, $securityKey)
{
$hashString = '';
$requestData = $request->toArray();
sort($this->hashParameters);
foreach ($this->hashParameters as $key) {
if (!array_key_exists($key, $requestData)) {
continue;
}
$hashString .= $requestData[$key];
}
$hashString .= $securityKey;
return $this->hash($hashString);
} | [
"public",
"function",
"generateParamHash",
"(",
"AbstractRequestContainer",
"$",
"request",
",",
"$",
"securityKey",
")",
"{",
"$",
"hashString",
"=",
"''",
";",
"$",
"requestData",
"=",
"$",
"request",
"->",
"toArray",
"(",
")",
";",
"sort",
"(",
"$",
"th... | @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $request
@param string $securityKey
@return string | [
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Request",
"\\",
"Container",
"\\",
"AbstractRequestContainer",
"$request",
"@param",
"string",
"$securityKey"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Key/HashGenerator.php#L83-L97 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Dependency/Facade/PayoneToOmsBridge.php | PayoneToOmsBridge.triggerEvent | public function triggerEvent($eventId, ObjectCollection $orderItems, array $logContext, array $data = [])
{
return $this->omsFacade->triggerEvent($eventId, $orderItems, $logContext, $data);
} | php | public function triggerEvent($eventId, ObjectCollection $orderItems, array $logContext, array $data = [])
{
return $this->omsFacade->triggerEvent($eventId, $orderItems, $logContext, $data);
} | [
"public",
"function",
"triggerEvent",
"(",
"$",
"eventId",
",",
"ObjectCollection",
"$",
"orderItems",
",",
"array",
"$",
"logContext",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"omsFacade",
"->",
"triggerEvent",
"(",... | @param string $eventId
@param \Propel\Runtime\Collection\ObjectCollection $orderItems
@param array $logContext
@param array $data
@return array | [
"@param",
"string",
"$eventId",
"@param",
"\\",
"Propel",
"\\",
"Runtime",
"\\",
"Collection",
"\\",
"ObjectCollection",
"$orderItems",
"@param",
"array",
"$logContext",
"@param",
"array",
"$data"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Dependency/Facade/PayoneToOmsBridge.php#L35-L38 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/Response/Mapper/CaptureResponseMapper.php | CaptureResponseMapper.getCaptureResponseTransfer | public function getCaptureResponseTransfer(CaptureResponseContainer $responseContainer)
{
$result = new CaptureResponseTransfer();
$clearing = new ClearingTransfer();
$creditor = new CreditorTransfer();
$baseResponse = new BaseResponseTransfer();
// Fill clearing transfer
$clearing->setBankAccountHolder($responseContainer->getClearingBankaccountholder());
$clearing->setBankCountry($responseContainer->getClearingBankcountry());
$clearing->setBankAccount($responseContainer->getClearingBankaccount());
$clearing->setBankCode($responseContainer->getClearingBankcode());
$clearing->setBankIban($responseContainer->getClearingBankiban());
$clearing->setBankBic($responseContainer->getClearingBankbic());
$clearing->setBankCity($responseContainer->getClearingBankcity());
$clearing->setBankName($responseContainer->getClearingBankname());
$clearing->setLegalNote($responseContainer->getClearingLegalnote());
$clearing->setDate($responseContainer->getClearingDate());
$clearing->setDueDate($responseContainer->getClearingDuedate());
$clearing->setReference($responseContainer->getClearingReference());
$clearing->setInstructionNote($responseContainer->getClearingInstructionnote());
$clearing->setAmount($responseContainer->getClearingAmount());
// Fill creditor transfer
$creditor->setIdentifier($responseContainer->getCreditorIdentifier());
$creditor->setName($responseContainer->getCreditorName());
$creditor->setStreet($responseContainer->getCreditorStreet());
$creditor->setZip($responseContainer->getCreditorZip());
$creditor->setCity($responseContainer->getCreditorCity());
$creditor->setCountry($responseContainer->getCreditorCountry());
$creditor->setEmail($responseContainer->getCreditorEmail());
// Fill base response transfer
$baseResponse->setErrorCode($responseContainer->getErrorcode());
$baseResponse->setErrorMessage($responseContainer->getErrormessage());
$baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
$baseResponse->setStatus($responseContainer->getStatus());
$baseResponse->setRawResponse($responseContainer->getRawResponse());
// Set plain attributes
$result->setTxid($responseContainer->getTxid());
$result->setSettleAccount($responseContainer->getSettleaccount());
$result->setMandateIdentification($responseContainer->getMandateIdentification());
// Set aggregated transfers
$result->setClearing($clearing);
$result->setCreditor($creditor);
$result->setBaseResponse($baseResponse);
return $result;
} | php | public function getCaptureResponseTransfer(CaptureResponseContainer $responseContainer)
{
$result = new CaptureResponseTransfer();
$clearing = new ClearingTransfer();
$creditor = new CreditorTransfer();
$baseResponse = new BaseResponseTransfer();
// Fill clearing transfer
$clearing->setBankAccountHolder($responseContainer->getClearingBankaccountholder());
$clearing->setBankCountry($responseContainer->getClearingBankcountry());
$clearing->setBankAccount($responseContainer->getClearingBankaccount());
$clearing->setBankCode($responseContainer->getClearingBankcode());
$clearing->setBankIban($responseContainer->getClearingBankiban());
$clearing->setBankBic($responseContainer->getClearingBankbic());
$clearing->setBankCity($responseContainer->getClearingBankcity());
$clearing->setBankName($responseContainer->getClearingBankname());
$clearing->setLegalNote($responseContainer->getClearingLegalnote());
$clearing->setDate($responseContainer->getClearingDate());
$clearing->setDueDate($responseContainer->getClearingDuedate());
$clearing->setReference($responseContainer->getClearingReference());
$clearing->setInstructionNote($responseContainer->getClearingInstructionnote());
$clearing->setAmount($responseContainer->getClearingAmount());
// Fill creditor transfer
$creditor->setIdentifier($responseContainer->getCreditorIdentifier());
$creditor->setName($responseContainer->getCreditorName());
$creditor->setStreet($responseContainer->getCreditorStreet());
$creditor->setZip($responseContainer->getCreditorZip());
$creditor->setCity($responseContainer->getCreditorCity());
$creditor->setCountry($responseContainer->getCreditorCountry());
$creditor->setEmail($responseContainer->getCreditorEmail());
// Fill base response transfer
$baseResponse->setErrorCode($responseContainer->getErrorcode());
$baseResponse->setErrorMessage($responseContainer->getErrormessage());
$baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
$baseResponse->setStatus($responseContainer->getStatus());
$baseResponse->setRawResponse($responseContainer->getRawResponse());
// Set plain attributes
$result->setTxid($responseContainer->getTxid());
$result->setSettleAccount($responseContainer->getSettleaccount());
$result->setMandateIdentification($responseContainer->getMandateIdentification());
// Set aggregated transfers
$result->setClearing($clearing);
$result->setCreditor($creditor);
$result->setBaseResponse($baseResponse);
return $result;
} | [
"public",
"function",
"getCaptureResponseTransfer",
"(",
"CaptureResponseContainer",
"$",
"responseContainer",
")",
"{",
"$",
"result",
"=",
"new",
"CaptureResponseTransfer",
"(",
")",
";",
"$",
"clearing",
"=",
"new",
"ClearingTransfer",
"(",
")",
";",
"$",
"cred... | @param \SprykerEco\Zed\Payone\Business\Api\Response\Container\CaptureResponseContainer $responseContainer
@return \Generated\Shared\Transfer\CaptureResponseTransfer | [
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Response",
"\\",
"Container",
"\\",
"CaptureResponseContainer",
"$responseContainer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/Response/Mapper/CaptureResponseMapper.php#L23-L73 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php | OrderManager.saveOrder | public function saveOrder(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
Propel::getConnection()->beginTransaction();
$paymentTransfer = $quoteTransfer->getPayment()->getPayone();
$paymentTransfer->setFkSalesOrder($checkoutResponse->getSaveOrder()->getIdSalesOrder());
$payment = $this->savePayment($paymentTransfer);
$paymentDetailTransfer = $paymentTransfer->getPaymentDetail();
$this->savePaymentDetail($payment, $paymentDetailTransfer);
Propel::getConnection()->commit();
} | php | public function saveOrder(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
Propel::getConnection()->beginTransaction();
$paymentTransfer = $quoteTransfer->getPayment()->getPayone();
$paymentTransfer->setFkSalesOrder($checkoutResponse->getSaveOrder()->getIdSalesOrder());
$payment = $this->savePayment($paymentTransfer);
$paymentDetailTransfer = $paymentTransfer->getPaymentDetail();
$this->savePaymentDetail($payment, $paymentDetailTransfer);
Propel::getConnection()->commit();
} | [
"public",
"function",
"saveOrder",
"(",
"QuoteTransfer",
"$",
"quoteTransfer",
",",
"CheckoutResponseTransfer",
"$",
"checkoutResponse",
")",
"{",
"Propel",
"::",
"getConnection",
"(",
")",
"->",
"beginTransaction",
"(",
")",
";",
"$",
"paymentTransfer",
"=",
"$",... | @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
@param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
@return void | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"QuoteTransfer",
"$quoteTransfer",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"CheckoutResponseTransfer",
"$checkoutResponse"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php#L40-L52 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php | OrderManager.savePayment | protected function savePayment(PayonePaymentTransfer $paymentTransfer)
{
$payment = new SpyPaymentPayone();
$payment->fromArray(($paymentTransfer->toArray()));
if ($payment->getReference() === null) {
$orderEntity = $payment->getSpySalesOrder();
$payment->setReference($this->config->generatePayoneReference($paymentTransfer, $orderEntity));
}
$payment->save();
return $payment;
} | php | protected function savePayment(PayonePaymentTransfer $paymentTransfer)
{
$payment = new SpyPaymentPayone();
$payment->fromArray(($paymentTransfer->toArray()));
if ($payment->getReference() === null) {
$orderEntity = $payment->getSpySalesOrder();
$payment->setReference($this->config->generatePayoneReference($paymentTransfer, $orderEntity));
}
$payment->save();
return $payment;
} | [
"protected",
"function",
"savePayment",
"(",
"PayonePaymentTransfer",
"$",
"paymentTransfer",
")",
"{",
"$",
"payment",
"=",
"new",
"SpyPaymentPayone",
"(",
")",
";",
"$",
"payment",
"->",
"fromArray",
"(",
"(",
"$",
"paymentTransfer",
"->",
"toArray",
"(",
")... | @param \Generated\Shared\Transfer\PayonePaymentTransfer $paymentTransfer
@return \Orm\Zed\Payone\Persistence\SpyPaymentPayone | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PayonePaymentTransfer",
"$paymentTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php#L59-L72 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php | OrderManager.savePaymentDetail | protected function savePaymentDetail(SpyPaymentPayone $payment, PaymentDetailTransfer $paymentDetailTransfer)
{
$paymentDetailEntity = new SpyPaymentPayoneDetail();
$paymentDetailEntity->setSpyPaymentPayone($payment);
$paymentDetailEntity->fromArray($paymentDetailTransfer->toArray());
$paymentDetailEntity->save();
} | php | protected function savePaymentDetail(SpyPaymentPayone $payment, PaymentDetailTransfer $paymentDetailTransfer)
{
$paymentDetailEntity = new SpyPaymentPayoneDetail();
$paymentDetailEntity->setSpyPaymentPayone($payment);
$paymentDetailEntity->fromArray($paymentDetailTransfer->toArray());
$paymentDetailEntity->save();
} | [
"protected",
"function",
"savePaymentDetail",
"(",
"SpyPaymentPayone",
"$",
"payment",
",",
"PaymentDetailTransfer",
"$",
"paymentDetailTransfer",
")",
"{",
"$",
"paymentDetailEntity",
"=",
"new",
"SpyPaymentPayoneDetail",
"(",
")",
";",
"$",
"paymentDetailEntity",
"->"... | @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $payment
@param \Generated\Shared\Transfer\PaymentDetailTransfer $paymentDetailTransfer
@return void | [
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Persistence",
"\\",
"SpyPaymentPayone",
"$payment",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PaymentDetailTransfer",
"$paymentDetailTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Order/OrderManager.php#L80-L86 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Plugin/PluginCountryFactory.php | PluginCountryFactory.createSubFormsCreator | public function createSubFormsCreator($countryIso2Code)
{
if (isset($this->subFormsCreators[$countryIso2Code])) {
$subFormsCreator = $this->subFormsCreators[$countryIso2Code]();
} else {
$subFormsCreator = $this->subFormsCreators[self::DEFAULT_COUNTRY]();
}
return $subFormsCreator;
} | php | public function createSubFormsCreator($countryIso2Code)
{
if (isset($this->subFormsCreators[$countryIso2Code])) {
$subFormsCreator = $this->subFormsCreators[$countryIso2Code]();
} else {
$subFormsCreator = $this->subFormsCreators[self::DEFAULT_COUNTRY]();
}
return $subFormsCreator;
} | [
"public",
"function",
"createSubFormsCreator",
"(",
"$",
"countryIso2Code",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"subFormsCreators",
"[",
"$",
"countryIso2Code",
"]",
")",
")",
"{",
"$",
"subFormsCreator",
"=",
"$",
"this",
"->",
"subFormsCr... | @param string $countryIso2Code
@return \SprykerEco\Yves\Payone\Plugin\SubFormsCreator\SubFormsCreatorInterface | [
"@param",
"string",
"$countryIso2Code"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Plugin/PluginCountryFactory.php#L56-L65 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Command/RefundCommandPlugin.php | RefundCommandPlugin.run | public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
{
$payoneRefundTransfer = new PayoneRefundTransfer();
$orderTransfer = new OrderTransfer();
$orderTransfer->fromArray($orderEntity->toArray(), true);
$refundTransfer = $this->getFactory()
->getRefundFacade()
->calculateRefund($orderItems, $orderEntity);
$payoneRefundTransfer->setAmount($refundTransfer->getAmount() * -1);
$paymentPayoneEntity = $orderEntity->getSpyPaymentPayones()->getFirst();
$payonePaymentTransfer = new PayonePaymentTransfer();
$payonePaymentTransfer->fromArray($paymentPayoneEntity->toArray(), true);
$payoneRefundTransfer->setPayment($payonePaymentTransfer);
$payoneRefundTransfer->setUseCustomerdata(PayoneApiConstants::USE_CUSTOMER_DATA_YES);
$payoneRefundTransfer->setOrder($this->getOrderTransfer($orderEntity));
$narrativeText = $this->getFactory()->getConfig()->getNarrativeText($orderItems, $orderEntity, $data);
$payoneRefundTransfer->setNarrativeText($narrativeText);
$this->getFacade()->refundPayment($payoneRefundTransfer);
return [];
} | php | public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
{
$payoneRefundTransfer = new PayoneRefundTransfer();
$orderTransfer = new OrderTransfer();
$orderTransfer->fromArray($orderEntity->toArray(), true);
$refundTransfer = $this->getFactory()
->getRefundFacade()
->calculateRefund($orderItems, $orderEntity);
$payoneRefundTransfer->setAmount($refundTransfer->getAmount() * -1);
$paymentPayoneEntity = $orderEntity->getSpyPaymentPayones()->getFirst();
$payonePaymentTransfer = new PayonePaymentTransfer();
$payonePaymentTransfer->fromArray($paymentPayoneEntity->toArray(), true);
$payoneRefundTransfer->setPayment($payonePaymentTransfer);
$payoneRefundTransfer->setUseCustomerdata(PayoneApiConstants::USE_CUSTOMER_DATA_YES);
$payoneRefundTransfer->setOrder($this->getOrderTransfer($orderEntity));
$narrativeText = $this->getFactory()->getConfig()->getNarrativeText($orderItems, $orderEntity, $data);
$payoneRefundTransfer->setNarrativeText($narrativeText);
$this->getFacade()->refundPayment($payoneRefundTransfer);
return [];
} | [
"public",
"function",
"run",
"(",
"array",
"$",
"orderItems",
",",
"SpySalesOrder",
"$",
"orderEntity",
",",
"ReadOnlyArrayObject",
"$",
"data",
")",
"{",
"$",
"payoneRefundTransfer",
"=",
"new",
"PayoneRefundTransfer",
"(",
")",
";",
"$",
"orderTransfer",
"=",
... | @api
@param array $orderItems
@param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
@param \Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject $data
@return array | [
"@api"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Command/RefundCommandPlugin.php#L33-L61 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/Response/Mapper/RefundResponseMapper.php | RefundResponseMapper.getRefundResponseTransfer | public function getRefundResponseTransfer(RefundResponseContainer $responseContainer)
{
$result = new RefundResponseTransfer();
$baseResponse = new BaseResponseTransfer();
// Fill base response transfer
$baseResponse->setErrorCode($responseContainer->getErrorcode());
$baseResponse->setErrorMessage($responseContainer->getErrormessage());
$baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
$baseResponse->setStatus($responseContainer->getStatus());
$baseResponse->setRawResponse($responseContainer->getRawResponse());
// Set plain attributes
$result->setTxid($responseContainer->getTxid());
$result->setProtectResultAvs($responseContainer->getProtectResultAvs());
// Set aggregated transfers
$result->setBaseResponse($baseResponse);
return $result;
} | php | public function getRefundResponseTransfer(RefundResponseContainer $responseContainer)
{
$result = new RefundResponseTransfer();
$baseResponse = new BaseResponseTransfer();
// Fill base response transfer
$baseResponse->setErrorCode($responseContainer->getErrorcode());
$baseResponse->setErrorMessage($responseContainer->getErrormessage());
$baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
$baseResponse->setStatus($responseContainer->getStatus());
$baseResponse->setRawResponse($responseContainer->getRawResponse());
// Set plain attributes
$result->setTxid($responseContainer->getTxid());
$result->setProtectResultAvs($responseContainer->getProtectResultAvs());
// Set aggregated transfers
$result->setBaseResponse($baseResponse);
return $result;
} | [
"public",
"function",
"getRefundResponseTransfer",
"(",
"RefundResponseContainer",
"$",
"responseContainer",
")",
"{",
"$",
"result",
"=",
"new",
"RefundResponseTransfer",
"(",
")",
";",
"$",
"baseResponse",
"=",
"new",
"BaseResponseTransfer",
"(",
")",
";",
"// Fil... | @param \SprykerEco\Zed\Payone\Business\Api\Response\Container\RefundResponseContainer $responseContainer
@return \Generated\Shared\Transfer\RefundResponseTransfer | [
"@param",
"\\",
"SprykerEco",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Business",
"\\",
"Api",
"\\",
"Response",
"\\",
"Container",
"\\",
"RefundResponseContainer",
"$responseContainer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/Response/Mapper/RefundResponseMapper.php#L21-L41 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/PayoneBusinessFactory.php | PayoneBusinessFactory.createInstaller | public function createInstaller(MessengerInterface $messenger)
{
$installer = new Installer(
$this->getGlossaryFacade(),
$this->getConfig()
);
$installer->setMessenger($messenger);
return $installer;
} | php | public function createInstaller(MessengerInterface $messenger)
{
$installer = new Installer(
$this->getGlossaryFacade(),
$this->getConfig()
);
$installer->setMessenger($messenger);
return $installer;
} | [
"public",
"function",
"createInstaller",
"(",
"MessengerInterface",
"$",
"messenger",
")",
"{",
"$",
"installer",
"=",
"new",
"Installer",
"(",
"$",
"this",
"->",
"getGlossaryFacade",
"(",
")",
",",
"$",
"this",
"->",
"getConfig",
"(",
")",
")",
";",
"$",
... | @param \Psr\Log\LoggerInterface $messenger
@return \Spryker\Zed\Ratepay\Business\Internal\Install | [
"@param",
"\\",
"Psr",
"\\",
"Log",
"\\",
"LoggerInterface",
"$messenger"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/PayoneBusinessFactory.php#L346-L355 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->addCardType($builder, $options)
->addNameOnCard($builder)
->addHiddenInputs($builder);
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->addCardType($builder, $options)
->addNameOnCard($builder)
->addHiddenInputs($builder);
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"addCardType",
"(",
"$",
"builder",
",",
"$",
"options",
")",
"->",
"addNameOnCard",
"(",
"$",
"builder",
")",
"->",
... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return void | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L90-L95 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addCardType | public function addCardType(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_TYPE,
ChoiceType::class,
[
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_TYPES],
'label' => false,
'required' => true,
'expanded' => false,
'multiple' => false,
'placeholder' => false,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | php | public function addCardType(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_TYPE,
ChoiceType::class,
[
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_TYPES],
'label' => false,
'required' => true,
'expanded' => false,
'multiple' => false,
'placeholder' => false,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | [
"public",
"function",
"addCardType",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_CARD_TYPE",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'choices'",
"=>",
"$",
... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L103-L122 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addCardNumber | protected function addCardNumber(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_CARD_NUMBER,
TextType::class,
[
'label' => false,
'required' => false,
]
);
return $this;
} | php | protected function addCardNumber(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_CARD_NUMBER,
TextType::class,
[
'label' => false,
'required' => false,
]
);
return $this;
} | [
"protected",
"function",
"addCardNumber",
"(",
"FormBuilderInterface",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_CARD_NUMBER",
",",
"TextType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"false",
",",
"'required'",
"=>",
... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L129-L141 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addNameOnCard | protected function addNameOnCard(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_NAME_ON_CARD,
TextType::class,
[
'label' => false,
'required' => true,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | php | protected function addNameOnCard(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_NAME_ON_CARD,
TextType::class,
[
'label' => false,
'required' => true,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | [
"protected",
"function",
"addNameOnCard",
"(",
"FormBuilderInterface",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_NAME_ON_CARD",
",",
"TextType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"false",
",",
"'required'",
"=>",
... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L148-L163 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addCardExpiresMonth | protected function addCardExpiresMonth(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_EXPIRES_MONTH,
ChoiceType::class,
[
'label' => false,
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_EXPIRES_CHOICES_MONTH],
'required' => true,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | php | protected function addCardExpiresMonth(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_EXPIRES_MONTH,
ChoiceType::class,
[
'label' => false,
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_EXPIRES_CHOICES_MONTH],
'required' => true,
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | [
"protected",
"function",
"addCardExpiresMonth",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_CARD_EXPIRES_MONTH",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'label'"... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L171-L187 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addCardExpiresYear | protected function addCardExpiresYear(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_EXPIRES_YEAR,
ChoiceType::class,
[
'label' => false,
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_EXPIRES_CHOICES_YEAR],
'required' => true,
'attr' => [
'placeholder' => 'Expires year',
],
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | php | protected function addCardExpiresYear(FormBuilderInterface $builder, array $options)
{
$builder->add(
self::FIELD_CARD_EXPIRES_YEAR,
ChoiceType::class,
[
'label' => false,
'choices' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CARD_EXPIRES_CHOICES_YEAR],
'required' => true,
'attr' => [
'placeholder' => 'Expires year',
],
'constraints' => [
$this->createNotBlankConstraint(),
],
]
);
return $this;
} | [
"protected",
"function",
"addCardExpiresYear",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_CARD_EXPIRES_YEAR",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'label'",
... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L195-L214 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addCardSecurityCode | protected function addCardSecurityCode(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_CARD_SECURITY_CODE,
TextType::class,
[
'label' => false,
'required' => false,
]
);
return $this;
} | php | protected function addCardSecurityCode(FormBuilderInterface $builder)
{
$builder->add(
self::FIELD_CARD_SECURITY_CODE,
TextType::class,
[
'label' => false,
'required' => false,
]
);
return $this;
} | [
"protected",
"function",
"addCardSecurityCode",
"(",
"FormBuilderInterface",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_CARD_SECURITY_CODE",
",",
"TextType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"false",
",",
"'required... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L221-L233 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php | CreditCardSubForm.addHiddenInputs | protected function addHiddenInputs(FormBuilderInterface $builder)
{
parent::addHiddenInputs($builder);
$builder->add(
self::FIELD_PSEUDO_CARD_NUMBER,
HiddenType::class,
[
'label' => false,
]
);
return $this;
} | php | protected function addHiddenInputs(FormBuilderInterface $builder)
{
parent::addHiddenInputs($builder);
$builder->add(
self::FIELD_PSEUDO_CARD_NUMBER,
HiddenType::class,
[
'label' => false,
]
);
return $this;
} | [
"protected",
"function",
"addHiddenInputs",
"(",
"FormBuilderInterface",
"$",
"builder",
")",
"{",
"parent",
"::",
"addHiddenInputs",
"(",
"$",
"builder",
")",
";",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_PSEUDO_CARD_NUMBER",
",",
"HiddenType",
":... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/CreditCardSubForm.php#L240-L253 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/TransactionStatus/AbstractRequest.php | AbstractRequest.init | public function init(array $data = [])
{
foreach ($data as $key => $value) {
$this->set($key, $value);
}
} | php | public function init(array $data = [])
{
foreach ($data as $key => $value) {
$this->set($key, $value);
}
} | [
"public",
"function",
"init",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | @param array $data
@return void | [
"@param",
"array",
"$data"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/TransactionStatus/AbstractRequest.php#L27-L32 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/TransactionStatus/AbstractRequest.php | AbstractRequest.set | public function set($name, $value)
{
if (property_exists($this, $name)) {
$this->$name = $value;
return true;
}
return null;
} | php | public function set($name, $value)
{
if (property_exists($this, $name)) {
$this->$name = $value;
return true;
}
return null;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"{",
"$",
"this",
"->",
"$",
"name",
"=",
"$",
"value",
";",
"return",
"true",
";",
"}",
"re... | @param string $name
@param mixed $value
@return bool|null | [
"@param",
"string",
"$name",
"@param",
"mixed",
"$value"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/TransactionStatus/AbstractRequest.php#L107-L116 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/BancontactOnlineTransferSubForm.php | BancontactOnlineTransferSubForm.addOnlineBankTransferType | public function addOnlineBankTransferType(FormBuilderInterface $builder, array $options): self
{
$builder->add(
static::FIELD_ONLINE_BANK_TRANSFER_TYPE,
HiddenType::class,
[
'label' => false,
'data' => PayoneApiConstants::ONLINE_BANK_TRANSFER_TYPE_BANCONTACT,
]
);
return $this;
} | php | public function addOnlineBankTransferType(FormBuilderInterface $builder, array $options): self
{
$builder->add(
static::FIELD_ONLINE_BANK_TRANSFER_TYPE,
HiddenType::class,
[
'label' => false,
'data' => PayoneApiConstants::ONLINE_BANK_TRANSFER_TYPE_BANCONTACT,
]
);
return $this;
} | [
"public",
"function",
"addOnlineBankTransferType",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
":",
"self",
"{",
"$",
"builder",
"->",
"add",
"(",
"static",
"::",
"FIELD_ONLINE_BANK_TRANSFER_TYPE",
",",
"HiddenType",
"::",
"clas... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/BancontactOnlineTransferSubForm.php#L42-L54 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Plugin/Provider/PayoneControllerProvider.php | PayoneControllerProvider.defineControllers | protected function defineControllers(Application $app)
{
$this->createController('/payone', 'payone-index', 'Payone', 'index', 'index')->method('POST');
$this->createController('/payone/getfile', 'payone-getfile', 'payone', 'index', 'getFile')->method('GET|POST');
$this->createController('/payone/regular-redirect-payment-cancellation', 'payone-cancel-redirect', 'Payone', 'index', 'cancelRedirect')->method('GET');
$this->createController('/payone/getinvoice', 'payone-getinvoice', 'Payone', 'index', 'getInvoice')->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_BUTTON_PATH,
static::EXPRESS_CHECKOUT_BUTTON,
'payone',
'expressCheckout',
'checkoutWithPaypalButton'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_INIT_PATH,
static::EXPRESS_CHECKOUT_INIT,
'payone',
'expressCheckout',
'initPaypalExpressCheckout'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_LOAD_DETAILS_PATH,
static::EXPRESS_CHECKOUT_LOAD_DETAILS,
'payone',
'expressCheckout',
'loadPaypalExpressCheckoutDetails'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_FAILURE_PATH,
static::EXPRESS_CHECKOUT_FAILURE,
'payone',
'expressCheckout',
'failure'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_BACK_PATH,
static::EXPRESS_CHECKOUT_BACK,
'payone',
'expressCheckout',
'back'
)->method('GET');
} | php | protected function defineControllers(Application $app)
{
$this->createController('/payone', 'payone-index', 'Payone', 'index', 'index')->method('POST');
$this->createController('/payone/getfile', 'payone-getfile', 'payone', 'index', 'getFile')->method('GET|POST');
$this->createController('/payone/regular-redirect-payment-cancellation', 'payone-cancel-redirect', 'Payone', 'index', 'cancelRedirect')->method('GET');
$this->createController('/payone/getinvoice', 'payone-getinvoice', 'Payone', 'index', 'getInvoice')->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_BUTTON_PATH,
static::EXPRESS_CHECKOUT_BUTTON,
'payone',
'expressCheckout',
'checkoutWithPaypalButton'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_INIT_PATH,
static::EXPRESS_CHECKOUT_INIT,
'payone',
'expressCheckout',
'initPaypalExpressCheckout'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_LOAD_DETAILS_PATH,
static::EXPRESS_CHECKOUT_LOAD_DETAILS,
'payone',
'expressCheckout',
'loadPaypalExpressCheckoutDetails'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_FAILURE_PATH,
static::EXPRESS_CHECKOUT_FAILURE,
'payone',
'expressCheckout',
'failure'
)->method('GET');
$this->createController(
static::EXPRESS_CHECKOUT_BACK_PATH,
static::EXPRESS_CHECKOUT_BACK,
'payone',
'expressCheckout',
'back'
)->method('GET');
} | [
"protected",
"function",
"defineControllers",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"this",
"->",
"createController",
"(",
"'/payone'",
",",
"'payone-index'",
",",
"'Payone'",
",",
"'index'",
",",
"'index'",
")",
"->",
"method",
"(",
"'POST'",
")",
... | @param \Silex\Application $app
@return void | [
"@param",
"\\",
"Silex",
"\\",
"Application",
"$app"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Plugin/Provider/PayoneControllerProvider.php#L34-L79 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/Response/Container/AbstractResponseContainer.php | AbstractResponseContainer.init | public function init(array $data = [])
{
foreach ($data as $key => $value) {
$key = $this->getPreparedKey($key);
$method = 'set' . str_replace(' ', '', $key);
if (method_exists($this, $method)) {
$this->{$method}($value);
}
}
} | php | public function init(array $data = [])
{
foreach ($data as $key => $value) {
$key = $this->getPreparedKey($key);
$method = 'set' . str_replace(' ', '', $key);
if (method_exists($this, $method)) {
$this->{$method}($value);
}
}
} | [
"public",
"function",
"init",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getPreparedKey",
"(",
"$",
"key",
")",
";",
"$",... | @param array $data
@return void | [
"@param",
"array",
"$data"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/Response/Container/AbstractResponseContainer.php#L52-L62 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Condition/PaymentIsRefundConditionPlugin.php | PaymentIsRefundConditionPlugin.check | public function check(SpySalesOrderItem $orderItem)
{
return $this->getFacade()
->isPaymentRefund($orderItem->getFkSalesOrder(), $orderItem->getIdSalesOrderItem());
} | php | public function check(SpySalesOrderItem $orderItem)
{
return $this->getFacade()
->isPaymentRefund($orderItem->getFkSalesOrder(), $orderItem->getIdSalesOrderItem());
} | [
"public",
"function",
"check",
"(",
"SpySalesOrderItem",
"$",
"orderItem",
")",
"{",
"return",
"$",
"this",
"->",
"getFacade",
"(",
")",
"->",
"isPaymentRefund",
"(",
"$",
"orderItem",
"->",
"getFkSalesOrder",
"(",
")",
",",
"$",
"orderItem",
"->",
"getIdSal... | @api
@param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItem
@return bool | [
"@api"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Condition/PaymentIsRefundConditionPlugin.php#L26-L30 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.processTransactionStatusUpdate | public function processTransactionStatusUpdate(TransactionStatusUpdateInterface $request)
{
$validationResult = $this->validate($request);
if ($validationResult instanceof TransactionStatusResponse) {
return $validationResult;
}
$this->transformCurrency($request);
$this->persistRequest($request);
return $this->createSuccessResponse();
} | php | public function processTransactionStatusUpdate(TransactionStatusUpdateInterface $request)
{
$validationResult = $this->validate($request);
if ($validationResult instanceof TransactionStatusResponse) {
return $validationResult;
}
$this->transformCurrency($request);
$this->persistRequest($request);
return $this->createSuccessResponse();
} | [
"public",
"function",
"processTransactionStatusUpdate",
"(",
"TransactionStatusUpdateInterface",
"$",
"request",
")",
"{",
"$",
"validationResult",
"=",
"$",
"this",
"->",
"validate",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"validationResult",
"instanceof",
... | @param \SprykerEco\Shared\Payone\Dependency\TransactionStatusUpdateInterface $request
@return \SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusResponse | [
"@param",
"\\",
"SprykerEco",
"\\",
"Shared",
"\\",
"Payone",
"\\",
"Dependency",
"\\",
"TransactionStatusUpdateInterface",
"$request"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L57-L67 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.persistRequest | protected function persistRequest(TransactionStatusUpdateInterface $request)
{
$entity = new SpyPaymentPayoneTransactionStatusLog();
$entity->setSpyPaymentPayone($this->findPaymentByTransactionId($request->getTxid()));
$entity->setTransactionId($request->getTxid());
$entity->setReferenceId($request->getReference());
$entity->setMode($request->getMode());
$entity->setStatus($request->getTxaction());
$entity->setTransactionTime($request->getTxtime());
$entity->setSequenceNumber($request->getSequencenumber());
$entity->setClearingType($request->getClearingtype());
$entity->setPortalId($request->getPortalid());
$entity->setPrice($request->getPrice());
$entity->setBalance($request->getBalance());
$entity->setReceivable($request->getReceivable());
$entity->setReminderLevel($request->getReminderlevel());
$entity->setRawRequest($request);
$entity->save();
} | php | protected function persistRequest(TransactionStatusUpdateInterface $request)
{
$entity = new SpyPaymentPayoneTransactionStatusLog();
$entity->setSpyPaymentPayone($this->findPaymentByTransactionId($request->getTxid()));
$entity->setTransactionId($request->getTxid());
$entity->setReferenceId($request->getReference());
$entity->setMode($request->getMode());
$entity->setStatus($request->getTxaction());
$entity->setTransactionTime($request->getTxtime());
$entity->setSequenceNumber($request->getSequencenumber());
$entity->setClearingType($request->getClearingtype());
$entity->setPortalId($request->getPortalid());
$entity->setPrice($request->getPrice());
$entity->setBalance($request->getBalance());
$entity->setReceivable($request->getReceivable());
$entity->setReminderLevel($request->getReminderlevel());
$entity->setRawRequest($request);
$entity->save();
} | [
"protected",
"function",
"persistRequest",
"(",
"TransactionStatusUpdateInterface",
"$",
"request",
")",
"{",
"$",
"entity",
"=",
"new",
"SpyPaymentPayoneTransactionStatusLog",
"(",
")",
";",
"$",
"entity",
"->",
"setSpyPaymentPayone",
"(",
"$",
"this",
"->",
"findP... | @param \SprykerEco\Shared\Payone\Dependency\TransactionStatusUpdateInterface $request
@return void | [
"@param",
"\\",
"SprykerEco",
"\\",
"Shared",
"\\",
"Payone",
"\\",
"Dependency",
"\\",
"TransactionStatusUpdateInterface",
"$request"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L74-L95 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.transformCurrency | protected function transformCurrency(TransactionStatusUpdateInterface $request)
{
$balance = $request->getBalance();
$balanceAmountInCents = round($balance * 100);
$request->setBalance($balanceAmountInCents);
$receivable = $request->getReceivable();
$receivableAmountInCents = round($receivable * 100);
$request->setReceivable($receivableAmountInCents);
$price = $request->getPrice();
$priceAmountInCents = round($price * 100);
$request->setPrice($priceAmountInCents);
} | php | protected function transformCurrency(TransactionStatusUpdateInterface $request)
{
$balance = $request->getBalance();
$balanceAmountInCents = round($balance * 100);
$request->setBalance($balanceAmountInCents);
$receivable = $request->getReceivable();
$receivableAmountInCents = round($receivable * 100);
$request->setReceivable($receivableAmountInCents);
$price = $request->getPrice();
$priceAmountInCents = round($price * 100);
$request->setPrice($priceAmountInCents);
} | [
"protected",
"function",
"transformCurrency",
"(",
"TransactionStatusUpdateInterface",
"$",
"request",
")",
"{",
"$",
"balance",
"=",
"$",
"request",
"->",
"getBalance",
"(",
")",
";",
"$",
"balanceAmountInCents",
"=",
"round",
"(",
"$",
"balance",
"*",
"100",
... | @param \SprykerEco\Shared\Payone\Dependency\TransactionStatusUpdateInterface $request
@return void | [
"@param",
"\\",
"SprykerEco",
"\\",
"Shared",
"\\",
"Payone",
"\\",
"Dependency",
"\\",
"TransactionStatusUpdateInterface",
"$request"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L113-L126 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.validate | protected function validate(TransactionStatusUpdateInterface $request)
{
$systemHashedKey = $this->hashGenerator->hash($this->standardParameter->getKey());
if ($request->getKey() !== $systemHashedKey) {
return $this->createErrorResponse('Payone transaction status update: Given and internal key do not match!');
}
if ((int)$request->getAid() !== (int)$this->standardParameter->getAid()) {
return $this->createErrorResponse('Payone transaction status update: Invalid Aid! System: ' . $this->standardParameter->getAid() . ' Request: ' . $request->getAid());
}
if ((int)$request->getPortalid() !== (int)$this->standardParameter->getPortalId()) {
return $this->createErrorResponse('Payone transaction status update: Invalid Portalid! System: ' . $this->standardParameter->getPortalId() . ' Request: ' . $request->getPortalid());
}
return true;
} | php | protected function validate(TransactionStatusUpdateInterface $request)
{
$systemHashedKey = $this->hashGenerator->hash($this->standardParameter->getKey());
if ($request->getKey() !== $systemHashedKey) {
return $this->createErrorResponse('Payone transaction status update: Given and internal key do not match!');
}
if ((int)$request->getAid() !== (int)$this->standardParameter->getAid()) {
return $this->createErrorResponse('Payone transaction status update: Invalid Aid! System: ' . $this->standardParameter->getAid() . ' Request: ' . $request->getAid());
}
if ((int)$request->getPortalid() !== (int)$this->standardParameter->getPortalId()) {
return $this->createErrorResponse('Payone transaction status update: Invalid Portalid! System: ' . $this->standardParameter->getPortalId() . ' Request: ' . $request->getPortalid());
}
return true;
} | [
"protected",
"function",
"validate",
"(",
"TransactionStatusUpdateInterface",
"$",
"request",
")",
"{",
"$",
"systemHashedKey",
"=",
"$",
"this",
"->",
"hashGenerator",
"->",
"hash",
"(",
"$",
"this",
"->",
"standardParameter",
"->",
"getKey",
"(",
")",
")",
"... | @param \SprykerEco\Shared\Payone\Dependency\TransactionStatusUpdateInterface $request
@return bool|\SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusResponse | [
"@param",
"\\",
"SprykerEco",
"\\",
"Shared",
"\\",
"Payone",
"\\",
"Dependency",
"\\",
"TransactionStatusUpdateInterface",
"$request"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L133-L149 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentCapture | public function isPaymentCapture($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_CAPTURE;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | php | public function isPaymentCapture($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_CAPTURE;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | [
"public",
"function",
"isPaymentCapture",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"status",
"=",
"PayoneTransactionStatusConstants",
"::",
"TXACTION_CAPTURE",
";",
"return",
"$",
"this",
"->",
"isPayment",
"(",
"$",
"idSalesOrder",
"... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L212-L217 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentOverpaid | public function isPaymentOverpaid($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_PAID;
$statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
if ($statusLog === null) {
return false;
}
if ($statusLog->getBalance() >= 0) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | php | public function isPaymentOverpaid($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_PAID;
$statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
if ($statusLog === null) {
return false;
}
if ($statusLog->getBalance() >= 0) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | [
"public",
"function",
"isPaymentOverpaid",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"status",
"=",
"PayoneTransactionStatusConstants",
"::",
"TXACTION_PAID",
";",
"$",
"statusLog",
"=",
"$",
"this",
"->",
"getFirstUnprocessedTransactionSt... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L225-L239 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentUnderpaid | public function isPaymentUnderpaid($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_UNDERPAID;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | php | public function isPaymentUnderpaid($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_UNDERPAID;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | [
"public",
"function",
"isPaymentUnderpaid",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"status",
"=",
"PayoneTransactionStatusConstants",
"::",
"TXACTION_UNDERPAID",
";",
"return",
"$",
"this",
"->",
"isPayment",
"(",
"$",
"idSalesOrder",... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L247-L252 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentRefund | public function isPaymentRefund($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_REFUND;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | php | public function isPaymentRefund($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_REFUND;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | [
"public",
"function",
"isPaymentRefund",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"status",
"=",
"PayoneTransactionStatusConstants",
"::",
"TXACTION_REFUND",
";",
"return",
"$",
"this",
"->",
"isPayment",
"(",
"$",
"idSalesOrder",
","... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L260-L265 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentAppointed | public function isPaymentAppointed($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_APPOINTED;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | php | public function isPaymentAppointed($idSalesOrder, $idSalesOrderItem)
{
$status = PayoneTransactionStatusConstants::TXACTION_APPOINTED;
return $this->isPayment($idSalesOrder, $idSalesOrderItem, $status);
} | [
"public",
"function",
"isPaymentAppointed",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"status",
"=",
"PayoneTransactionStatusConstants",
"::",
"TXACTION_APPOINTED",
";",
"return",
"$",
"this",
"->",
"isPayment",
"(",
"$",
"idSalesOrder",... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L273-L278 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPaymentOther | public function isPaymentOther($idSalesOrder, $idSalesOrderItem)
{
$statusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
if (empty($statusLogs)) {
return false;
}
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $statusLog */
$statusLog = array_shift($statusLogs);
$statuses = [
PayoneTransactionStatusConstants::TXACTION_PAID,
PayoneTransactionStatusConstants::TXACTION_APPOINTED,
PayoneTransactionStatusConstants::TXACTION_UNDERPAID,
];
if (in_array($statusLog->getStatus(), $statuses)) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | php | public function isPaymentOther($idSalesOrder, $idSalesOrderItem)
{
$statusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
if (empty($statusLogs)) {
return false;
}
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $statusLog */
$statusLog = array_shift($statusLogs);
$statuses = [
PayoneTransactionStatusConstants::TXACTION_PAID,
PayoneTransactionStatusConstants::TXACTION_APPOINTED,
PayoneTransactionStatusConstants::TXACTION_UNDERPAID,
];
if (in_array($statusLog->getStatus(), $statuses)) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | [
"public",
"function",
"isPaymentOther",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"statusLogs",
"=",
"$",
"this",
"->",
"getUnprocessedTransactionStatusLogs",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
";",
"if",
"(... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L286-L308 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.isPayment | protected function isPayment($idSalesOrder, $idSalesOrderItem, $status)
{
$statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
if ($statusLog === null) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | php | protected function isPayment($idSalesOrder, $idSalesOrderItem, $status)
{
$statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
if ($statusLog === null) {
return false;
}
$this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);
return true;
} | [
"protected",
"function",
"isPayment",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
",",
"$",
"status",
")",
"{",
"$",
"statusLog",
"=",
"$",
"this",
"->",
"getFirstUnprocessedTransactionStatusLog",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",... | @param int $idSalesOrder
@param int $idSalesOrderItem
@param string $status
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem",
"@param",
"string",
"$status"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L317-L327 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.hasUnprocessedTransactionStatusLogs | protected function hasUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem)
{
$records = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
return !empty($transactionStatusLogs);
} | php | protected function hasUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem)
{
$records = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
return !empty($transactionStatusLogs);
} | [
"protected",
"function",
"hasUnprocessedTransactionStatusLogs",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"records",
"=",
"$",
"this",
"->",
"getUnprocessedTransactionStatusLogs",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")"... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return bool | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L335-L340 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.getFirstUnprocessedTransactionStatusLog | protected function getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status)
{
$transactionStatusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
if (empty($transactionStatusLogs)) {
return null;
}
while (count($transactionStatusLogs)) {
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $transactionStatusLog */
$transactionStatusLog = array_shift($transactionStatusLogs);
if ($transactionStatusLog->getStatus() == $status) {
return $transactionStatusLog;
}
}
return null;
} | php | protected function getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status)
{
$transactionStatusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
if (empty($transactionStatusLogs)) {
return null;
}
while (count($transactionStatusLogs)) {
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $transactionStatusLog */
$transactionStatusLog = array_shift($transactionStatusLogs);
if ($transactionStatusLog->getStatus() == $status) {
return $transactionStatusLog;
}
}
return null;
} | [
"protected",
"function",
"getFirstUnprocessedTransactionStatusLog",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
",",
"$",
"status",
")",
"{",
"$",
"transactionStatusLogs",
"=",
"$",
"this",
"->",
"getUnprocessedTransactionStatusLogs",
"(",
"$",
"idSalesOrder... | @param int $idSalesOrder
@param int $idSalesOrderItem
@param string $status
@return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog|null | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem",
"@param",
"string",
"$status"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L349-L367 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.getUnprocessedTransactionStatusLogs | protected function getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem)
{
$transactionStatusLogs = $this->queryContainer->createTransactionStatusLogsBySalesOrder($idSalesOrder)->find();
$ids = [];
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $transactionStatusLog */
foreach ($transactionStatusLogs as $transactionStatusLog) {
$ids[$transactionStatusLog->getIdPaymentPayoneTransactionStatusLog()] = $transactionStatusLog;
}
$relations = $this->queryContainer
->createTransactionStatusLogOrderItemsByLogIds($idSalesOrderItem, array_keys($ids))
->find();
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLogOrderItem $relation */
foreach ($relations as $relation) {
unset($ids[$relation->getIdPaymentPayoneTransactionStatusLog()]);
}
return $ids;
} | php | protected function getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem)
{
$transactionStatusLogs = $this->queryContainer->createTransactionStatusLogsBySalesOrder($idSalesOrder)->find();
$ids = [];
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $transactionStatusLog */
foreach ($transactionStatusLogs as $transactionStatusLog) {
$ids[$transactionStatusLog->getIdPaymentPayoneTransactionStatusLog()] = $transactionStatusLog;
}
$relations = $this->queryContainer
->createTransactionStatusLogOrderItemsByLogIds($idSalesOrderItem, array_keys($ids))
->find();
/** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLogOrderItem $relation */
foreach ($relations as $relation) {
unset($ids[$relation->getIdPaymentPayoneTransactionStatusLog()]);
}
return $ids;
} | [
"protected",
"function",
"getUnprocessedTransactionStatusLogs",
"(",
"$",
"idSalesOrder",
",",
"$",
"idSalesOrderItem",
")",
"{",
"$",
"transactionStatusLogs",
"=",
"$",
"this",
"->",
"queryContainer",
"->",
"createTransactionStatusLogsBySalesOrder",
"(",
"$",
"idSalesOrd... | @param int $idSalesOrder
@param int $idSalesOrderItem
@return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog[] | [
"@param",
"int",
"$idSalesOrder",
"@param",
"int",
"$idSalesOrderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L375-L396 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php | TransactionStatusUpdateManager.saveSpyPaymentPayoneTransactionStatusLogOrderItem | protected function saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, SpyPaymentPayoneTransactionStatusLog $statusLog)
{
$entity = new SpyPaymentPayoneTransactionStatusLogOrderItem();
$entity->setSpyPaymentPayoneTransactionStatusLog($statusLog);
$entity->setIdSalesOrderItem($idSalesOrderItem);
$entity->save();
} | php | protected function saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, SpyPaymentPayoneTransactionStatusLog $statusLog)
{
$entity = new SpyPaymentPayoneTransactionStatusLogOrderItem();
$entity->setSpyPaymentPayoneTransactionStatusLog($statusLog);
$entity->setIdSalesOrderItem($idSalesOrderItem);
$entity->save();
} | [
"protected",
"function",
"saveSpyPaymentPayoneTransactionStatusLogOrderItem",
"(",
"$",
"idSalesOrderItem",
",",
"SpyPaymentPayoneTransactionStatusLog",
"$",
"statusLog",
")",
"{",
"$",
"entity",
"=",
"new",
"SpyPaymentPayoneTransactionStatusLogOrderItem",
"(",
")",
";",
"$",... | @param int $idSalesOrderItem
@param \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $statusLog
@return void | [
"@param",
"int",
"$idSalesOrderItem",
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Payone",
"\\",
"Persistence",
"\\",
"SpyPaymentPayoneTransactionStatusLog",
"$statusLog"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/TransactionStatus/TransactionStatusUpdateManager.php#L404-L410 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Api/Request/Container/Invoicing/ItemContainer.php | ItemContainer.toArrayByKey | public function toArrayByKey($key)
{
$data = [];
if (isset($this->id)) {
$data['id[' . $key . ']'] = $this->getId();
}
if (isset($this->pr)) {
$data['pr[' . $key . ']'] = $this->getPr();
}
if (isset($this->no)) {
$data['no[' . $key . ']'] = $this->getNo();
}
if (isset($this->de)) {
$data['de[' . $key . ']'] = $this->getDe();
}
if (isset($this->it)) {
$data['it[' . $key . ']'] = $this->getIt();
}
if (isset($this->va)) {
$data['va[' . $key . ']'] = $this->getVa();
}
if (isset($this->sd)) {
$data['sd[' . $key . ']'] = $this->getSd();
}
if (isset($this->ed)) {
$data['ed[' . $key . ']'] = $this->getEd();
}
return $data;
} | php | public function toArrayByKey($key)
{
$data = [];
if (isset($this->id)) {
$data['id[' . $key . ']'] = $this->getId();
}
if (isset($this->pr)) {
$data['pr[' . $key . ']'] = $this->getPr();
}
if (isset($this->no)) {
$data['no[' . $key . ']'] = $this->getNo();
}
if (isset($this->de)) {
$data['de[' . $key . ']'] = $this->getDe();
}
if (isset($this->it)) {
$data['it[' . $key . ']'] = $this->getIt();
}
if (isset($this->va)) {
$data['va[' . $key . ']'] = $this->getVa();
}
if (isset($this->sd)) {
$data['sd[' . $key . ']'] = $this->getSd();
}
if (isset($this->ed)) {
$data['ed[' . $key . ']'] = $this->getEd();
}
return $data;
} | [
"public",
"function",
"toArrayByKey",
"(",
"$",
"key",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"data",
"[",
"'id['",
".",
"$",
"key",
".",
"']'",
"]",
"=",
"$",
"this",
... | @param int $key
@return array | [
"@param",
"int",
"$key"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Api/Request/Container/Invoicing/ItemContainer.php#L65-L94 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Command/PreAuthorizeCommandPlugin.php | PreAuthorizeCommandPlugin.run | public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
{
$paymentEntity = $orderEntity->getSpyPaymentPayones()->getFirst();
$this->getFacade()->preAuthorizePayment($paymentEntity->getFkSalesOrder());
return [];
} | php | public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
{
$paymentEntity = $orderEntity->getSpyPaymentPayones()->getFirst();
$this->getFacade()->preAuthorizePayment($paymentEntity->getFkSalesOrder());
return [];
} | [
"public",
"function",
"run",
"(",
"array",
"$",
"orderItems",
",",
"SpySalesOrder",
"$",
"orderEntity",
",",
"ReadOnlyArrayObject",
"$",
"data",
")",
"{",
"$",
"paymentEntity",
"=",
"$",
"orderEntity",
"->",
"getSpyPaymentPayones",
"(",
")",
"->",
"getFirst",
... | @api
@param array $orderItems
@param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
@param \Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject $data
@return array | [
"@api"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Command/PreAuthorizeCommandPlugin.php#L30-L36 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Condition/AbstractPlugin.php | AbstractPlugin.check | public function check(SpySalesOrderItem $orderItem)
{
$order = $orderItem->getOrder();
if (isset(self::$resultCache[$this->getName()][$order->getPrimaryKey()])) {
return self::$resultCache[$this->getName()][$order->getPrimaryKey()];
}
$orderTransfer = new OrderTransfer();
$orderTransfer->fromArray($order->toArray(), true);
$isSuccess = $this->callFacade($orderTransfer);
self::$resultCache[$order->getPrimaryKey()] = $isSuccess;
return $isSuccess;
} | php | public function check(SpySalesOrderItem $orderItem)
{
$order = $orderItem->getOrder();
if (isset(self::$resultCache[$this->getName()][$order->getPrimaryKey()])) {
return self::$resultCache[$this->getName()][$order->getPrimaryKey()];
}
$orderTransfer = new OrderTransfer();
$orderTransfer->fromArray($order->toArray(), true);
$isSuccess = $this->callFacade($orderTransfer);
self::$resultCache[$order->getPrimaryKey()] = $isSuccess;
return $isSuccess;
} | [
"public",
"function",
"check",
"(",
"SpySalesOrderItem",
"$",
"orderItem",
")",
"{",
"$",
"order",
"=",
"$",
"orderItem",
"->",
"getOrder",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"resultCache",
"[",
"$",
"this",
"->",
"getName",
"("... | @api
@param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItem
@return bool | [
"@api"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Communication/Plugin/Oms/Condition/AbstractPlugin.php#L34-L49 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/MethodMapper/Invoice.php | Invoice.mapOrderItemToItemContainer | public function mapOrderItemToItemContainer(ItemTransfer $orderItem)
{
$itemContainer = new ItemContainer();
$itemContainer->setIt(PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS);
$itemContainer->setId($orderItem->getSku());
$itemContainer->setPr($orderItem->getUnitGrossPrice());
$itemContainer->setNo($orderItem->getQuantity());
$itemContainer->setDe($orderItem->getName());
$itemContainer->setVa($orderItem->getTaxRate());
return $itemContainer;
} | php | public function mapOrderItemToItemContainer(ItemTransfer $orderItem)
{
$itemContainer = new ItemContainer();
$itemContainer->setIt(PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS);
$itemContainer->setId($orderItem->getSku());
$itemContainer->setPr($orderItem->getUnitGrossPrice());
$itemContainer->setNo($orderItem->getQuantity());
$itemContainer->setDe($orderItem->getName());
$itemContainer->setVa($orderItem->getTaxRate());
return $itemContainer;
} | [
"public",
"function",
"mapOrderItemToItemContainer",
"(",
"ItemTransfer",
"$",
"orderItem",
")",
"{",
"$",
"itemContainer",
"=",
"new",
"ItemContainer",
"(",
")",
";",
"$",
"itemContainer",
"->",
"setIt",
"(",
"PayoneApiConstants",
"::",
"INVOICING_ITEM_TYPE_GOODS",
... | @param \Generated\Shared\Transfer\ItemTransfer $orderItem
@return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\ItemContainer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"ItemTransfer",
"$orderItem"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/MethodMapper/Invoice.php#L57-L68 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Business/Payment/MethodMapper/Invoice.php | Invoice.mapGetInvoice | public function mapGetInvoice(PayoneGetInvoiceTransfer $getInvoiceTransfer)
{
$getInvoiceContainer = new GetInvoiceContainer();
$getInvoiceContainer->setInvoiceTitle($getInvoiceTransfer->getReference());
return $getInvoiceContainer;
} | php | public function mapGetInvoice(PayoneGetInvoiceTransfer $getInvoiceTransfer)
{
$getInvoiceContainer = new GetInvoiceContainer();
$getInvoiceContainer->setInvoiceTitle($getInvoiceTransfer->getReference());
return $getInvoiceContainer;
} | [
"public",
"function",
"mapGetInvoice",
"(",
"PayoneGetInvoiceTransfer",
"$",
"getInvoiceTransfer",
")",
"{",
"$",
"getInvoiceContainer",
"=",
"new",
"GetInvoiceContainer",
"(",
")",
";",
"$",
"getInvoiceContainer",
"->",
"setInvoiceTitle",
"(",
"$",
"getInvoiceTransfer"... | @param \Generated\Shared\Transfer\PayoneGetInvoiceTransfer $getInvoiceTransfer
@return \SprykerEco\Zed\Payone\Business\Api\Request\Container\GetInvoiceContainer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PayoneGetInvoiceTransfer",
"$getInvoiceTransfer"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Business/Payment/MethodMapper/Invoice.php#L165-L171 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/EWalletSubForm.php | EWalletSubForm.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->addWalletType($builder, $options[SubFormInterface::OPTIONS_FIELD_NAME][static::OPTION_WALLET_CHOICES]);
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"addWalletType",
"(",
"$",
"builder",
",",
"$",
"options",
"[",
"SubFormInterface",
"::",
"OPTIONS_FIELD_NAME",
"]",
"[",... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return void | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/EWalletSubForm.php#L77-L80 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/EWalletSubForm.php | EWalletSubForm.addWalletType | protected function addWalletType(FormBuilderInterface $builder, array $choices)
{
$builder->add(
self::FIELD_WALLET_TYPE,
ChoiceType::class,
[
'label' => false,
'required' => true,
'choices' => $choices,
]
);
return $this;
} | php | protected function addWalletType(FormBuilderInterface $builder, array $choices)
{
$builder->add(
self::FIELD_WALLET_TYPE,
ChoiceType::class,
[
'label' => false,
'required' => true,
'choices' => $choices,
]
);
return $this;
} | [
"protected",
"function",
"addWalletType",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"choices",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"self",
"::",
"FIELD_WALLET_TYPE",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $choices
@return $this | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$choices"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/EWalletSubForm.php#L88-L101 |
spryker-eco/payone | src/SprykerEco/Yves/Payone/Form/GiropayOnlineTransferSubForm.php | GiropayOnlineTransferSubForm.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$this->addIban($builder)
->addBic($builder);
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$this->addIban($builder)
->addBic($builder);
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"parent",
"::",
"buildForm",
"(",
"$",
"builder",
",",
"$",
"options",
")",
";",
"$",
"this",
"->",
"addIban",
"(",
"$",
"builder",
")... | @param \Symfony\Component\Form\FormBuilderInterface $builder
@param array $options
@return void | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Form",
"\\",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Yves/Payone/Form/GiropayOnlineTransferSubForm.php#L43-L49 |
spryker-eco/payone | src/SprykerEco/Zed/Payone/Communication/Plugin/Checkout/PayoneSaveOrderPlugin.php | PayoneSaveOrderPlugin.execute | public function execute(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
$this->getFacade()->saveOrder($quoteTransfer, $checkoutResponse);
} | php | public function execute(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
{
$this->getFacade()->saveOrder($quoteTransfer, $checkoutResponse);
} | [
"public",
"function",
"execute",
"(",
"QuoteTransfer",
"$",
"quoteTransfer",
",",
"CheckoutResponseTransfer",
"$",
"checkoutResponse",
")",
"{",
"$",
"this",
"->",
"getFacade",
"(",
")",
"->",
"saveOrder",
"(",
"$",
"quoteTransfer",
",",
"$",
"checkoutResponse",
... | @api
@param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
@param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
@return void | [
"@api"
] | train | https://github.com/spryker-eco/payone/blob/531524641f86d7c6cebf61eb3c953eb2fdf3f388/src/SprykerEco/Zed/Payone/Communication/Plugin/Checkout/PayoneSaveOrderPlugin.php#L29-L32 |
99designs/phumbor | lib/Thumbor/Url.php | Url.stringify | public function stringify($server, $secret, $original, $commands)
{
if (count($commands) > 0) {
$commandPath = implode('/', $commands);
$imgPath = sprintf('%s/%s', $commandPath, $original);
} else {
$imgPath = $original;
}
$signature = $secret ? self::sign($imgPath, $secret) : 'unsafe';
return sprintf(
'%s/%s/%s',
$server,
$signature,
$imgPath
);
} | php | public function stringify($server, $secret, $original, $commands)
{
if (count($commands) > 0) {
$commandPath = implode('/', $commands);
$imgPath = sprintf('%s/%s', $commandPath, $original);
} else {
$imgPath = $original;
}
$signature = $secret ? self::sign($imgPath, $secret) : 'unsafe';
return sprintf(
'%s/%s/%s',
$server,
$signature,
$imgPath
);
} | [
"public",
"function",
"stringify",
"(",
"$",
"server",
",",
"$",
"secret",
",",
"$",
"original",
",",
"$",
"commands",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"commands",
")",
">",
"0",
")",
"{",
"$",
"commandPath",
"=",
"implode",
"(",
"'/'",
",",... | Produce a URL to an image on a Thumbor server according to the specified
options.
See https://github.com/globocom/thumbor/wiki/Usage for available $commands.
@param string $server Thumbor server
@param string $secret shared secret key (may be blank/null)
@param string $original URL of original image
@param array $commands array of Thumbor commands | [
"Produce",
"a",
"URL",
"to",
"an",
"image",
"on",
"a",
"Thumbor",
"server",
"according",
"to",
"the",
"specified",
"options",
"."
] | train | https://github.com/99designs/phumbor/blob/7b32a4bc0a247b07490dc57399aaaa06b5b32632/lib/Thumbor/Url.php#L38-L55 |
99designs/phumbor | lib/Thumbor/Url.php | Url.sign | public static function sign($msg, $secret)
{
$signature = hash_hmac("sha1", $msg, $secret, true);
return strtr(
base64_encode($signature),
'/+', '_-'
);
} | php | public static function sign($msg, $secret)
{
$signature = hash_hmac("sha1", $msg, $secret, true);
return strtr(
base64_encode($signature),
'/+', '_-'
);
} | [
"public",
"static",
"function",
"sign",
"(",
"$",
"msg",
",",
"$",
"secret",
")",
"{",
"$",
"signature",
"=",
"hash_hmac",
"(",
"\"sha1\"",
",",
"$",
"msg",
",",
"$",
"secret",
",",
"true",
")",
";",
"return",
"strtr",
"(",
"base64_encode",
"(",
"$",... | Sign a message using a shared secret key, per
https://github.com/globocom/thumbor/wiki/Libraries
@param string $msg
@param string $secret
@return string | [
"Sign",
"a",
"message",
"using",
"a",
"shared",
"secret",
"key",
"per",
"https",
":",
"//",
"github",
".",
"com",
"/",
"globocom",
"/",
"thumbor",
"/",
"wiki",
"/",
"Libraries"
] | train | https://github.com/99designs/phumbor/blob/7b32a4bc0a247b07490dc57399aaaa06b5b32632/lib/Thumbor/Url.php#L65-L72 |
99designs/phumbor | lib/Thumbor/Url/CommandSet.php | CommandSet.trim | public function trim($colourSource = null, $tolerance = null)
{
$this->trim = 'trim';
$this->trim .= $colourSource ? ":$colourSource" : '';
$this->trim .= $tolerance ? ":$tolerance" : '';
} | php | public function trim($colourSource = null, $tolerance = null)
{
$this->trim = 'trim';
$this->trim .= $colourSource ? ":$colourSource" : '';
$this->trim .= $tolerance ? ":$tolerance" : '';
} | [
"public",
"function",
"trim",
"(",
"$",
"colourSource",
"=",
"null",
",",
"$",
"tolerance",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"trim",
"=",
"'trim'",
";",
"$",
"this",
"->",
"trim",
".=",
"$",
"colourSource",
"?",
"\":$colourSource\"",
":",
"''"... | Trim surrounding space from the thumbnail. The top-left corner of the
image is assumed to contain the background colour. To specify otherwise,
pass either 'top-left' or 'bottom-right' as the $colourSource argument.
For tolerance the euclidian distance between the colors of the reference pixel
and the surrounding pixels is used. If the distance is within the
tolerance they'll get trimmed. For a RGB image the tolerance would
be within the range 0-442 | [
"Trim",
"surrounding",
"space",
"from",
"the",
"thumbnail",
".",
"The",
"top",
"-",
"left",
"corner",
"of",
"the",
"image",
"is",
"assumed",
"to",
"contain",
"the",
"background",
"colour",
".",
"To",
"specify",
"otherwise",
"pass",
"either",
"top",
"-",
"l... | train | https://github.com/99designs/phumbor/blob/7b32a4bc0a247b07490dc57399aaaa06b5b32632/lib/Thumbor/Url/CommandSet.php#L29-L34 |
99designs/phumbor | lib/Thumbor/Url/CommandSet.php | CommandSet.addFilter | public function addFilter(/*$filter, $args ...*/)
{
$args = func_get_args();
$filter = array_shift($args);
$this->filters []= sprintf('%s(%s)', $filter, implode(',', $args));
} | php | public function addFilter(/*$filter, $args ...*/)
{
$args = func_get_args();
$filter = array_shift($args);
$this->filters []= sprintf('%s(%s)', $filter, implode(',', $args));
} | [
"public",
"function",
"addFilter",
"(",
"/*$filter, $args ...*/",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"filter",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"this",
"->",
"filters",
"[",
"]",
"=",
"sprintf",
"(",
"'... | Append a filter, e.g. `->addFilter('brightness', 42)` | [
"Append",
"a",
"filter",
"e",
".",
"g",
".",
"-",
">",
"addFilter",
"(",
"brightness",
"42",
")"
] | train | https://github.com/99designs/phumbor/blob/7b32a4bc0a247b07490dc57399aaaa06b5b32632/lib/Thumbor/Url/CommandSet.php#L107-L112 |
99designs/phumbor | lib/Thumbor/Url/CommandSet.php | CommandSet.toArray | public function toArray()
{
$commands = array();
$maybeAppend = function ($command) use (&$commands) {
if ($command) $commands []= (string) $command;
};
if ($this->metadataOnly) {
$commands []= 'meta';
}
$maybeAppend($this->trim);
$maybeAppend($this->crop);
$maybeAppend($this->resize);
$maybeAppend($this->halign);
$maybeAppend($this->valign);
if ($this->smartCrop) {
$commands []= 'smart';
}
if (count($this->filters)) {
$filters = 'filters:' . implode(':', $this->filters);
$commands []= $filters;
}
return $commands;
} | php | public function toArray()
{
$commands = array();
$maybeAppend = function ($command) use (&$commands) {
if ($command) $commands []= (string) $command;
};
if ($this->metadataOnly) {
$commands []= 'meta';
}
$maybeAppend($this->trim);
$maybeAppend($this->crop);
$maybeAppend($this->resize);
$maybeAppend($this->halign);
$maybeAppend($this->valign);
if ($this->smartCrop) {
$commands []= 'smart';
}
if (count($this->filters)) {
$filters = 'filters:' . implode(':', $this->filters);
$commands []= $filters;
}
return $commands;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"commands",
"=",
"array",
"(",
")",
";",
"$",
"maybeAppend",
"=",
"function",
"(",
"$",
"command",
")",
"use",
"(",
"&",
"$",
"commands",
")",
"{",
"if",
"(",
"$",
"command",
")",
"$",
"commands"... | Stringify and return commands as an array. | [
"Stringify",
"and",
"return",
"commands",
"as",
"an",
"array",
"."
] | train | https://github.com/99designs/phumbor/blob/7b32a4bc0a247b07490dc57399aaaa06b5b32632/lib/Thumbor/Url/CommandSet.php#L127-L155 |
larapack/hooks | src/Hooks.php | Hooks.install | public function install($name, $version = null, $migrate = true, $seed = true, $publish = true)
{
// Check if already installed
if ($this->installed($name)) {
throw new Exceptions\HookAlreadyInstalledException("Hook [{$name}] is already installed.");
}
event(new Events\InstallingHook($name));
// Prepare a repository if the hook is located locally
if ($this->local($name)) {
$this->prepareLocalInstallation($name);
if (is_null($version)) {
$version = static::$localVersion;
}
}
// Require hook
if (is_null($version)) {
$this->composerRequire([$name]); // TODO: Save Composer output somewhere
} else {
$this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
}
// TODO: Handle the case when Composer outputs:
// Your requirements could not be resolved to an installable set of packages.
//
// Problem 1
// - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
// but these are rejected by your constraint.
// TODO: Move to Composer Plugin
$this->readJsonFile([$name]);
$this->remakeJson();
if ($migrate) {
$this->migrateHook($this->hooks[$name]);
}
if ($seed) {
$this->seedHook($this->hooks[$name]);
}
if ($publish) {
$this->publishHook($this->hooks[$name]);
}
event(new Events\InstalledHook($this->hooks[$name]));
} | php | public function install($name, $version = null, $migrate = true, $seed = true, $publish = true)
{
// Check if already installed
if ($this->installed($name)) {
throw new Exceptions\HookAlreadyInstalledException("Hook [{$name}] is already installed.");
}
event(new Events\InstallingHook($name));
// Prepare a repository if the hook is located locally
if ($this->local($name)) {
$this->prepareLocalInstallation($name);
if (is_null($version)) {
$version = static::$localVersion;
}
}
// Require hook
if (is_null($version)) {
$this->composerRequire([$name]); // TODO: Save Composer output somewhere
} else {
$this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
}
// TODO: Handle the case when Composer outputs:
// Your requirements could not be resolved to an installable set of packages.
//
// Problem 1
// - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
// but these are rejected by your constraint.
// TODO: Move to Composer Plugin
$this->readJsonFile([$name]);
$this->remakeJson();
if ($migrate) {
$this->migrateHook($this->hooks[$name]);
}
if ($seed) {
$this->seedHook($this->hooks[$name]);
}
if ($publish) {
$this->publishHook($this->hooks[$name]);
}
event(new Events\InstalledHook($this->hooks[$name]));
} | [
"public",
"function",
"install",
"(",
"$",
"name",
",",
"$",
"version",
"=",
"null",
",",
"$",
"migrate",
"=",
"true",
",",
"$",
"seed",
"=",
"true",
",",
"$",
"publish",
"=",
"true",
")",
"{",
"// Check if already installed",
"if",
"(",
"$",
"this",
... | Install hook.
@param $name
@throws \Larapack\Hooks\Exceptions\HookAlreadyInstalledException | [
"Install",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L198-L247 |
larapack/hooks | src/Hooks.php | Hooks.uninstall | public function uninstall($name, $delete = false, $unmigrate = true, $unseed = true, $unpublish = true)
{
// Check if installed
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] is not installed.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\UninstallingHook($hook));
if ($this->enabled($name)) {
event(new Events\DisablingHook($hook));
// Some logic could later be placed here
event(new Events\DisabledHook($hook));
}
if ($unseed) {
$this->unseedHook($hook);
}
if ($unmigrate) {
$this->unmigrateHook($hook);
}
if ($unpublish) {
$this->unpublishHook($hook);
}
$this->runComposer([
'command' => 'remove',
'packages' => [$name],
]);
$hooks = $this->hooks()->where('name', '!=', $name);
$this->hooks = $hooks;
$this->remakeJson();
event(new Events\UninstalledHook($name));
if ($delete && $hook->isLocal()) {
$this->filesystem->deleteDirectory(base_path("hooks/{$name}"));
}
} | php | public function uninstall($name, $delete = false, $unmigrate = true, $unseed = true, $unpublish = true)
{
// Check if installed
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] is not installed.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\UninstallingHook($hook));
if ($this->enabled($name)) {
event(new Events\DisablingHook($hook));
// Some logic could later be placed here
event(new Events\DisabledHook($hook));
}
if ($unseed) {
$this->unseedHook($hook);
}
if ($unmigrate) {
$this->unmigrateHook($hook);
}
if ($unpublish) {
$this->unpublishHook($hook);
}
$this->runComposer([
'command' => 'remove',
'packages' => [$name],
]);
$hooks = $this->hooks()->where('name', '!=', $name);
$this->hooks = $hooks;
$this->remakeJson();
event(new Events\UninstalledHook($name));
if ($delete && $hook->isLocal()) {
$this->filesystem->deleteDirectory(base_path("hooks/{$name}"));
}
} | [
"public",
"function",
"uninstall",
"(",
"$",
"name",
",",
"$",
"delete",
"=",
"false",
",",
"$",
"unmigrate",
"=",
"true",
",",
"$",
"unseed",
"=",
"true",
",",
"$",
"unpublish",
"=",
"true",
")",
"{",
"// Check if installed",
"if",
"(",
"!",
"$",
"t... | Uninstall a hook.
@param $name
@param $keep boolean
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException | [
"Uninstall",
"a",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L267-L315 |
larapack/hooks | src/Hooks.php | Hooks.update | public function update($name, $version, $migrate = true, $seed = true, $publish = true, $force = false)
{
// Check if hook exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
// Check if installed
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
event(new Events\UpdatingHook($this->hooks[$name]));
if (is_null($version)) {
if (static::$useVersionWildcardOnUpdate) {
$version = static::$versionWildcard;
}
// Prepare a repository if the hook is located locally
if ($this->local($name)) {
$version = static::$localVersion;
}
}
if (!$force) {
$this->makeTemponaryBackup($this->hooks[$name]);
}
// Require hook
if (is_null($version)) {
$this->composerRequire([$name]); // TODO: Save Composer output somewhere
} else {
$this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
}
// TODO: Handle the case when Composer outputs:
// Your requirements could not be resolved to an installable set of packages.
//
// Problem 1
// - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
// but these are rejected by your constraint.
// TODO: Move to Composer Plugin
$this->readJsonFile();
$this->remakeJson();
if ($migrate) {
$this->migrateHook($this->hooks[$name]);
}
if ($seed) {
$this->seedHook($this->hooks[$name]);
}
if ($publish) {
$this->publishHook($this->hooks[$name], $force);
}
$this->clearTemponaryFiles();
event(new Events\UpdatedHook($this->hooks[$name]));
return true;
} | php | public function update($name, $version, $migrate = true, $seed = true, $publish = true, $force = false)
{
// Check if hook exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
// Check if installed
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
event(new Events\UpdatingHook($this->hooks[$name]));
if (is_null($version)) {
if (static::$useVersionWildcardOnUpdate) {
$version = static::$versionWildcard;
}
// Prepare a repository if the hook is located locally
if ($this->local($name)) {
$version = static::$localVersion;
}
}
if (!$force) {
$this->makeTemponaryBackup($this->hooks[$name]);
}
// Require hook
if (is_null($version)) {
$this->composerRequire([$name]); // TODO: Save Composer output somewhere
} else {
$this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
}
// TODO: Handle the case when Composer outputs:
// Your requirements could not be resolved to an installable set of packages.
//
// Problem 1
// - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
// but these are rejected by your constraint.
// TODO: Move to Composer Plugin
$this->readJsonFile();
$this->remakeJson();
if ($migrate) {
$this->migrateHook($this->hooks[$name]);
}
if ($seed) {
$this->seedHook($this->hooks[$name]);
}
if ($publish) {
$this->publishHook($this->hooks[$name], $force);
}
$this->clearTemponaryFiles();
event(new Events\UpdatedHook($this->hooks[$name]));
return true;
} | [
"public",
"function",
"update",
"(",
"$",
"name",
",",
"$",
"version",
",",
"$",
"migrate",
"=",
"true",
",",
"$",
"seed",
"=",
"true",
",",
"$",
"publish",
"=",
"true",
",",
"$",
"force",
"=",
"false",
")",
"{",
"// Check if hook exists",
"if",
"(",... | Update hook.
@param $name
@param string|null $version
@param bool $migrate
@param bool $seed
@param bool $publish
@param bool $force
@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException
@return bool | [
"Update",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L332-L396 |
larapack/hooks | src/Hooks.php | Hooks.enable | public function enable($name)
{
// Check if exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
if ($this->enabled($name)) {
throw new Exceptions\HookAlreadyEnabledException("Hook [{$name}] already enabled.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\EnablingHook($hook));
$this->hooks[$name]->update(['enabled' => true]);
$this->remakeJson();
event(new Events\EnabledHook($hook));
} | php | public function enable($name)
{
// Check if exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
if ($this->enabled($name)) {
throw new Exceptions\HookAlreadyEnabledException("Hook [{$name}] already enabled.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\EnablingHook($hook));
$this->hooks[$name]->update(['enabled' => true]);
$this->remakeJson();
event(new Events\EnabledHook($hook));
} | [
"public",
"function",
"enable",
"(",
"$",
"name",
")",
"{",
"// Check if exists",
"if",
"(",
"!",
"$",
"this",
"->",
"downloaded",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"HookNotFoundException",
"(",
"\"Hook [{$name}] not found.\"... | Enable hook.
@param $name
@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException
@throws \Larapack\Hooks\Exceptions\HookAlreadyEnabledException | [
"Enable",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L407-L433 |
larapack/hooks | src/Hooks.php | Hooks.disable | public function disable($name)
{
// Check if exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
if (!$this->enabled($name)) {
throw new Exceptions\HookNotEnabledException("Hook [{$name}] not enabled.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\DisablingHook($hook));
$this->hooks[$name]->update(['enabled' => false]);
$this->remakeJson();
event(new Events\DisabledHook($hook));
} | php | public function disable($name)
{
// Check if exists
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
if (!$this->enabled($name)) {
throw new Exceptions\HookNotEnabledException("Hook [{$name}] not enabled.");
}
$hook = $this->hook($name);
$hook->loadJson();
event(new Events\DisablingHook($hook));
$this->hooks[$name]->update(['enabled' => false]);
$this->remakeJson();
event(new Events\DisabledHook($hook));
} | [
"public",
"function",
"disable",
"(",
"$",
"name",
")",
"{",
"// Check if exists",
"if",
"(",
"!",
"$",
"this",
"->",
"downloaded",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"HookNotFoundException",
"(",
"\"Hook [{$name}] not found.\... | Disable a hook.
@param $name
@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotEnabledException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException | [
"Disable",
"a",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L444-L470 |
larapack/hooks | src/Hooks.php | Hooks.make | public function make($name)
{
$studlyCase = studly_case($name);
// Check if already exists
if ($this->downloaded($name)) {
throw new Exceptions\HookAlreadyExistsException("Hook [{$name}] already exists.");
}
event(new Events\MakingHook($name));
// Ensure hooks folder exists
if (!$this->filesystem->isDirectory(base_path('hooks'))) {
$this->filesystem->makeDirectory(base_path('hooks'));
}
// Create folder for the new hook
$this->filesystem->deleteDirectory(base_path("hooks/{$name}"));
$this->filesystem->makeDirectory(base_path("hooks/{$name}"));
// make stub files
$this->makeStubFiles($name);
event(new Events\MadeHook($name));
} | php | public function make($name)
{
$studlyCase = studly_case($name);
// Check if already exists
if ($this->downloaded($name)) {
throw new Exceptions\HookAlreadyExistsException("Hook [{$name}] already exists.");
}
event(new Events\MakingHook($name));
// Ensure hooks folder exists
if (!$this->filesystem->isDirectory(base_path('hooks'))) {
$this->filesystem->makeDirectory(base_path('hooks'));
}
// Create folder for the new hook
$this->filesystem->deleteDirectory(base_path("hooks/{$name}"));
$this->filesystem->makeDirectory(base_path("hooks/{$name}"));
// make stub files
$this->makeStubFiles($name);
event(new Events\MadeHook($name));
} | [
"public",
"function",
"make",
"(",
"$",
"name",
")",
"{",
"$",
"studlyCase",
"=",
"studly_case",
"(",
"$",
"name",
")",
";",
"// Check if already exists",
"if",
"(",
"$",
"this",
"->",
"downloaded",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exc... | Make hook.
@param $name
@throws \Larapack\Hooks\Exceptions\HookAlreadyExistsException | [
"Make",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L479-L503 |
larapack/hooks | src/Hooks.php | Hooks.enabled | public function enabled($name)
{
return isset($this->hooks[$name]) && $this->hooks[$name]->enabled;
} | php | public function enabled($name)
{
return isset($this->hooks[$name]) && $this->hooks[$name]->enabled;
} | [
"public",
"function",
"enabled",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"hooks",
"[",
"$",
"name",
"]",
")",
"&&",
"$",
"this",
"->",
"hooks",
"[",
"$",
"name",
"]",
"->",
"enabled",
";",
"}"
] | Check if hook is enabled.
@param $name
@return bool | [
"Check",
"if",
"hook",
"is",
"enabled",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L574-L577 |
larapack/hooks | src/Hooks.php | Hooks.downloaded | public function downloaded($name)
{
if ($this->local($name)) {
return $this->filesystem->isDirectory(base_path("hooks/{$name}"))
&& $this->filesystem->exists(base_path("hooks/{$name}/composer.json"));
}
return $this->filesystem->isDirectory(base_path("vendor/{$name}"));
} | php | public function downloaded($name)
{
if ($this->local($name)) {
return $this->filesystem->isDirectory(base_path("hooks/{$name}"))
&& $this->filesystem->exists(base_path("hooks/{$name}/composer.json"));
}
return $this->filesystem->isDirectory(base_path("vendor/{$name}"));
} | [
"public",
"function",
"downloaded",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"local",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"filesystem",
"->",
"isDirectory",
"(",
"base_path",
"(",
"\"hooks/{$name}\"",
")",
")"... | Check if hook is downloaded.
@param $name
@return bool | [
"Check",
"if",
"hook",
"is",
"downloaded",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L610-L618 |
larapack/hooks | src/Hooks.php | Hooks.hook | public function hook($name)
{
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
return $this->hooks[$name];
} | php | public function hook($name)
{
if (!$this->downloaded($name)) {
throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
}
if (!$this->installed($name)) {
throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
}
return $this->hooks[$name];
} | [
"public",
"function",
"hook",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"downloaded",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"HookNotFoundException",
"(",
"\"Hook [{$name}] not found.\"",
")",
";",
"}",
... | Get hook information.
@param $name
@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException
@return \Larapack\Hooks\Hook | [
"Get",
"hook",
"information",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L644-L655 |
larapack/hooks | src/Hooks.php | Hooks.type | public function type($name)
{
$hook = $this->hooks()->where('name', $name)->first();
if (!is_null($hook)) {
return $hook->type;
}
} | php | public function type($name)
{
$hook = $this->hooks()->where('name', $name)->first();
if (!is_null($hook)) {
return $hook->type;
}
} | [
"public",
"function",
"type",
"(",
"$",
"name",
")",
"{",
"$",
"hook",
"=",
"$",
"this",
"->",
"hooks",
"(",
")",
"->",
"where",
"(",
"'name'",
",",
"$",
"name",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"hook",
... | Get type of hook.
@param $name
@return string | [
"Get",
"type",
"of",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L674-L681 |
larapack/hooks | src/Hooks.php | Hooks.getRemoteDetails | public function getRemoteDetails($name)
{
// Get remote
$remote = json_decode(file_get_contents($this->getRemote()."/api/hooks/{$name}.json"), true);
if ($remote['exists'] !== true) {
throw new \InvalidArgumentException("Hook [{$name}] does not exists.");
}
return $remote;
} | php | public function getRemoteDetails($name)
{
// Get remote
$remote = json_decode(file_get_contents($this->getRemote()."/api/hooks/{$name}.json"), true);
if ($remote['exists'] !== true) {
throw new \InvalidArgumentException("Hook [{$name}] does not exists.");
}
return $remote;
} | [
"public",
"function",
"getRemoteDetails",
"(",
"$",
"name",
")",
"{",
"// Get remote",
"$",
"remote",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"getRemote",
"(",
")",
".",
"\"/api/hooks/{$name}.json\"",
")",
",",
"true",
")",
";",
... | Get hook details from remote.
@param $name
@return array | [
"Get",
"hook",
"details",
"from",
"remote",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L704-L714 |
larapack/hooks | src/Hooks.php | Hooks.readJsonFile | public function readJsonFile($localsIncluded = [])
{
$hooks = [];
if (!$this->filesystem->exists(base_path('hooks'))) {
$this->filesystem->makeDirectory(base_path('hooks'));
}
if (!$this->filesystem->exists(base_path('hooks/hooks.json'))) {
$this->filesystem->put(base_path('hooks/hooks.json'), '{}');
}
$data = json_decode($this->filesystem->get(base_path('hooks/hooks.json')), true);
$enabled = [];
if (isset($data['hooks'])) {
foreach ($data['hooks'] as $key => $hook) {
if (!$this->filesystem->exists(base_path("hooks/{$key}/composer.json")) &&
!$this->filesystem->exists(base_path("vendor/{$key}/composer.json"))) {
continue; // This hook does not seem to exist anymore
}
$hooks[$key] = new Hook($hook);
if ($hooks[$key]->enabled) {
$enabled[] = $key;
}
}
}
if (isset($data['last_remote_check'])) {
$this->lastRemoteCheck = Carbon::createFromTimestamp($data['last_remote_check']);
}
foreach ($this->readComposerHooks() as $name => $composerHook) {
$hooks[$name] = $composerHook;
if (in_array($name, $enabled)) {
$hooks[$name]->enabled = true;
}
}
foreach ($this->readLocalHooks() as $name => $composerHook) {
if (!isset($hooks[$name]) && !in_array($name, $localsIncluded)) {
continue; // Do not show not-installed local hooks.
}
$hooks[$name] = $composerHook;
if (in_array($name, $enabled)) {
$hooks[$name]->enabled = true;
}
}
$this->hooks = collect($hooks);
} | php | public function readJsonFile($localsIncluded = [])
{
$hooks = [];
if (!$this->filesystem->exists(base_path('hooks'))) {
$this->filesystem->makeDirectory(base_path('hooks'));
}
if (!$this->filesystem->exists(base_path('hooks/hooks.json'))) {
$this->filesystem->put(base_path('hooks/hooks.json'), '{}');
}
$data = json_decode($this->filesystem->get(base_path('hooks/hooks.json')), true);
$enabled = [];
if (isset($data['hooks'])) {
foreach ($data['hooks'] as $key => $hook) {
if (!$this->filesystem->exists(base_path("hooks/{$key}/composer.json")) &&
!$this->filesystem->exists(base_path("vendor/{$key}/composer.json"))) {
continue; // This hook does not seem to exist anymore
}
$hooks[$key] = new Hook($hook);
if ($hooks[$key]->enabled) {
$enabled[] = $key;
}
}
}
if (isset($data['last_remote_check'])) {
$this->lastRemoteCheck = Carbon::createFromTimestamp($data['last_remote_check']);
}
foreach ($this->readComposerHooks() as $name => $composerHook) {
$hooks[$name] = $composerHook;
if (in_array($name, $enabled)) {
$hooks[$name]->enabled = true;
}
}
foreach ($this->readLocalHooks() as $name => $composerHook) {
if (!isset($hooks[$name]) && !in_array($name, $localsIncluded)) {
continue; // Do not show not-installed local hooks.
}
$hooks[$name] = $composerHook;
if (in_array($name, $enabled)) {
$hooks[$name]->enabled = true;
}
}
$this->hooks = collect($hooks);
} | [
"public",
"function",
"readJsonFile",
"(",
"$",
"localsIncluded",
"=",
"[",
"]",
")",
"{",
"$",
"hooks",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"filesystem",
"->",
"exists",
"(",
"base_path",
"(",
"'hooks'",
")",
")",
")",
"{",
"$",... | Read hooks.json file. | [
"Read",
"hooks",
".",
"json",
"file",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L738-L792 |
larapack/hooks | src/Hooks.php | Hooks.remakeJson | public function remakeJson()
{
$json = json_encode([
'last_remote_check' => (!is_null($this->lastRemoteCheck) ? $this->lastRemoteCheck->timestamp : null),
'hooks' => $this->hooks(),
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
file_put_contents(base_path('hooks/hooks.json'), $json);
} | php | public function remakeJson()
{
$json = json_encode([
'last_remote_check' => (!is_null($this->lastRemoteCheck) ? $this->lastRemoteCheck->timestamp : null),
'hooks' => $this->hooks(),
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
file_put_contents(base_path('hooks/hooks.json'), $json);
} | [
"public",
"function",
"remakeJson",
"(",
")",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"[",
"'last_remote_check'",
"=>",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"lastRemoteCheck",
")",
"?",
"$",
"this",
"->",
"lastRemoteCheck",
"->",
"timestamp",
":... | Remake hooks.json file. | [
"Remake",
"hooks",
".",
"json",
"file",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L838-L846 |
larapack/hooks | src/Hooks.php | Hooks.migrateHook | protected function migrateHook(Hook $hook)
{
$migrations = (array) $hook->getComposerHookKey('migrations', []);
foreach ($migrations as $path) {
if ($this->filesystem->isDirectory($hook->getPath().'/'.$path)) {
$this->migrator->run($this->realPath([$path], $hook->getPath().'/')->all());
} else {
$this->migrator->runFiles($this->realPath([$path], $hook->getPath().'/')->all());
}
}
} | php | protected function migrateHook(Hook $hook)
{
$migrations = (array) $hook->getComposerHookKey('migrations', []);
foreach ($migrations as $path) {
if ($this->filesystem->isDirectory($hook->getPath().'/'.$path)) {
$this->migrator->run($this->realPath([$path], $hook->getPath().'/')->all());
} else {
$this->migrator->runFiles($this->realPath([$path], $hook->getPath().'/')->all());
}
}
} | [
"protected",
"function",
"migrateHook",
"(",
"Hook",
"$",
"hook",
")",
"{",
"$",
"migrations",
"=",
"(",
"array",
")",
"$",
"hook",
"->",
"getComposerHookKey",
"(",
"'migrations'",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"migrations",
"as",
"$",
... | Run migrations found for a specific hook.
@param \Larapack\Hooks\Hook $hook | [
"Run",
"migrations",
"found",
"for",
"a",
"specific",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L908-L919 |
larapack/hooks | src/Hooks.php | Hooks.unmigrateHook | protected function unmigrateHook(Hook $hook)
{
$migrations = (array) $hook->getComposerHookKey('migrations', []);
foreach ($migrations as $path) {
if ($this->filesystem->isDirectory($hook->getPath().'/'.$path)) {
$this->migrator->reset($this->realPath([$path], $hook->getPath().'/')->all());
} else {
$this->migrator->resetFiles($this->realPath([$path], $hook->getPath().'/')->all());
}
}
} | php | protected function unmigrateHook(Hook $hook)
{
$migrations = (array) $hook->getComposerHookKey('migrations', []);
foreach ($migrations as $path) {
if ($this->filesystem->isDirectory($hook->getPath().'/'.$path)) {
$this->migrator->reset($this->realPath([$path], $hook->getPath().'/')->all());
} else {
$this->migrator->resetFiles($this->realPath([$path], $hook->getPath().'/')->all());
}
}
} | [
"protected",
"function",
"unmigrateHook",
"(",
"Hook",
"$",
"hook",
")",
"{",
"$",
"migrations",
"=",
"(",
"array",
")",
"$",
"hook",
"->",
"getComposerHookKey",
"(",
"'migrations'",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"migrations",
"as",
"$",
... | Rollback migrations found for a specific hook.
@param \Larapack\Hooks\Hook $hook | [
"Rollback",
"migrations",
"found",
"for",
"a",
"specific",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L926-L937 |
larapack/hooks | src/Hooks.php | Hooks.seedHook | protected function seedHook(Hook $hook)
{
$folders = (array) $hook->getComposerHookKey('seeders', []);
$basePath = $hook->getPath().'/';
$this->runSeeders($folders, $basePath);
} | php | protected function seedHook(Hook $hook)
{
$folders = (array) $hook->getComposerHookKey('seeders', []);
$basePath = $hook->getPath().'/';
$this->runSeeders($folders, $basePath);
} | [
"protected",
"function",
"seedHook",
"(",
"Hook",
"$",
"hook",
")",
"{",
"$",
"folders",
"=",
"(",
"array",
")",
"$",
"hook",
"->",
"getComposerHookKey",
"(",
"'seeders'",
",",
"[",
"]",
")",
";",
"$",
"basePath",
"=",
"$",
"hook",
"->",
"getPath",
"... | Run seeders found for a specific hook.
@param \Larapack\Hooks\Hook $hook | [
"Run",
"seeders",
"found",
"for",
"a",
"specific",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L944-L950 |
larapack/hooks | src/Hooks.php | Hooks.publishHook | protected function publishHook(Hook $hook, $force = false)
{
$folders = (array) $hook->getComposerHookKey('assets', []);
$basePath = $hook->getPath().'/';
$filesystem = $this->filesystem;
foreach ($folders as $location => $publish) {
$publishPath = base_path($publish);
if (!$realLocation = realpath($basePath.$location)) {
continue;
}
if ($filesystem->isDirectory($realLocation)) {
$allFiles = collect($filesystem->allFiles($realLocation))->map(function ($file) use ($realLocation) {
return substr($file->getRealPath(), strlen($realLocation) + 1);
});
} else {
$allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
$realLocation,
'',
basename($realLocation)
)]);
}
$newFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
return !$filesystem->exists($publishPath.'/'.$filename);
});
$updatedFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
return $filesystem->exists($publishPath.'/'.$filename);
});
if (!$force && isset($this->tempDirectories[$hook->name])) {
$tempLocation = $this->tempDirectories[$hook->name].'/'.$location;
$updatedFiles = $updatedFiles
->filter(function ($filename) use ($tempLocation, $publishPath, $filesystem) {
if (!$filesystem->exists($tempLocation.'/'.$filename)) {
return true;
}
return md5_file($tempLocation.'/'.$filename) ==
md5_file($publishPath.'/'.$filename);
});
}
$newFiles->merge($updatedFiles)
->each(function ($filename) use ($realLocation, $publishPath, $filesystem) {
if (!$filesystem->isDirectory($realLocation)) {
$directory = substr($publishPath, 0, -strlen(basename($publishPath)));
if (!$filesystem->isDirectory($directory)) {
$filesystem->makeDirectory($directory, 0755, true, true);
}
return $filesystem->copy($realLocation, $publishPath);
}
$directory = substr($publishPath.'/'.$filename, 0, -strlen(basename($filename)));
if (!$filesystem->isDirectory($directory)) {
$filesystem->makeDirectory($directory, 0755, true, true);
}
$filesystem->delete($publishPath.'/'.$filename);
$filesystem->copy(
$realLocation.'/'.$filename,
$publishPath.'/'.$filename
);
});
}
} | php | protected function publishHook(Hook $hook, $force = false)
{
$folders = (array) $hook->getComposerHookKey('assets', []);
$basePath = $hook->getPath().'/';
$filesystem = $this->filesystem;
foreach ($folders as $location => $publish) {
$publishPath = base_path($publish);
if (!$realLocation = realpath($basePath.$location)) {
continue;
}
if ($filesystem->isDirectory($realLocation)) {
$allFiles = collect($filesystem->allFiles($realLocation))->map(function ($file) use ($realLocation) {
return substr($file->getRealPath(), strlen($realLocation) + 1);
});
} else {
$allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
$realLocation,
'',
basename($realLocation)
)]);
}
$newFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
return !$filesystem->exists($publishPath.'/'.$filename);
});
$updatedFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
return $filesystem->exists($publishPath.'/'.$filename);
});
if (!$force && isset($this->tempDirectories[$hook->name])) {
$tempLocation = $this->tempDirectories[$hook->name].'/'.$location;
$updatedFiles = $updatedFiles
->filter(function ($filename) use ($tempLocation, $publishPath, $filesystem) {
if (!$filesystem->exists($tempLocation.'/'.$filename)) {
return true;
}
return md5_file($tempLocation.'/'.$filename) ==
md5_file($publishPath.'/'.$filename);
});
}
$newFiles->merge($updatedFiles)
->each(function ($filename) use ($realLocation, $publishPath, $filesystem) {
if (!$filesystem->isDirectory($realLocation)) {
$directory = substr($publishPath, 0, -strlen(basename($publishPath)));
if (!$filesystem->isDirectory($directory)) {
$filesystem->makeDirectory($directory, 0755, true, true);
}
return $filesystem->copy($realLocation, $publishPath);
}
$directory = substr($publishPath.'/'.$filename, 0, -strlen(basename($filename)));
if (!$filesystem->isDirectory($directory)) {
$filesystem->makeDirectory($directory, 0755, true, true);
}
$filesystem->delete($publishPath.'/'.$filename);
$filesystem->copy(
$realLocation.'/'.$filename,
$publishPath.'/'.$filename
);
});
}
} | [
"protected",
"function",
"publishHook",
"(",
"Hook",
"$",
"hook",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"folders",
"=",
"(",
"array",
")",
"$",
"hook",
"->",
"getComposerHookKey",
"(",
"'assets'",
",",
"[",
"]",
")",
";",
"$",
"basePath",
"... | Publish assets found for a specific hook.
@param \Larapack\Hooks\Hook $hook | [
"Publish",
"assets",
"found",
"for",
"a",
"specific",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L970-L1040 |
larapack/hooks | src/Hooks.php | Hooks.unpublishHook | protected function unpublishHook(Hook $hook)
{
$folders = (array) $hook->getComposerHookKey('assets', []);
$basePath = $hook->getPath().'/';
$filesystem = $this->filesystem;
foreach ($folders as $location => $publish) {
$publishPath = base_path($publish);
if (!$realLocation = realpath($basePath.$location)) {
continue;
}
if ($filesystem->isDirectory($realLocation)) {
$allFiles = collect($this->filesystem->allFiles($realLocation))
->map(function ($file) use ($realLocation) {
return substr($file->getRealPath(), strlen($realLocation) + 1);
});
} else {
$allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
$realLocation,
'',
basename($realLocation)
)]);
}
$existingFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
if ($filesystem->isDirectory($publishPath)) {
return $filesystem->exists($publishPath.'/'.$filename);
}
return $filesystem->exists($publishPath);
});
$existingFiles->each(function ($filename) use ($publishPath, $filesystem) {
if ($filesystem->isDirectory($publishPath)) {
return $filesystem->delete($publishPath.'/'.$filename);
}
$filesystem->delete($publishPath);
});
}
} | php | protected function unpublishHook(Hook $hook)
{
$folders = (array) $hook->getComposerHookKey('assets', []);
$basePath = $hook->getPath().'/';
$filesystem = $this->filesystem;
foreach ($folders as $location => $publish) {
$publishPath = base_path($publish);
if (!$realLocation = realpath($basePath.$location)) {
continue;
}
if ($filesystem->isDirectory($realLocation)) {
$allFiles = collect($this->filesystem->allFiles($realLocation))
->map(function ($file) use ($realLocation) {
return substr($file->getRealPath(), strlen($realLocation) + 1);
});
} else {
$allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
$realLocation,
'',
basename($realLocation)
)]);
}
$existingFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
if ($filesystem->isDirectory($publishPath)) {
return $filesystem->exists($publishPath.'/'.$filename);
}
return $filesystem->exists($publishPath);
});
$existingFiles->each(function ($filename) use ($publishPath, $filesystem) {
if ($filesystem->isDirectory($publishPath)) {
return $filesystem->delete($publishPath.'/'.$filename);
}
$filesystem->delete($publishPath);
});
}
} | [
"protected",
"function",
"unpublishHook",
"(",
"Hook",
"$",
"hook",
")",
"{",
"$",
"folders",
"=",
"(",
"array",
")",
"$",
"hook",
"->",
"getComposerHookKey",
"(",
"'assets'",
",",
"[",
"]",
")",
";",
"$",
"basePath",
"=",
"$",
"hook",
"->",
"getPath",... | Unpublish assets found for a specific hook.
@param \Larapack\Hooks\Hook $hook | [
"Unpublish",
"assets",
"found",
"for",
"a",
"specific",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L1047-L1088 |
larapack/hooks | src/Hooks.php | Hooks.runSeeders | protected function runSeeders($folders, $basePath)
{
$filesystem = $this->filesystem;
$this->realPath($folders, $basePath)
->each(function ($folder) use ($filesystem) {
if ($filesystem->isDirectory($folder)) {
$files = $filesystem->files($folder);
} else {
$files = [new \Symfony\Component\Finder\SplFileInfo(
$folder,
'',
basename($folder)
)];
}
collect($files)->filter(function ($file) {
return $file->getExtension() == 'php';
})->each(function ($file) {
$class = substr($file->getFilename(), 0, -4);
require_once $file->getRealPath();
(new $class())->run();
});
});
} | php | protected function runSeeders($folders, $basePath)
{
$filesystem = $this->filesystem;
$this->realPath($folders, $basePath)
->each(function ($folder) use ($filesystem) {
if ($filesystem->isDirectory($folder)) {
$files = $filesystem->files($folder);
} else {
$files = [new \Symfony\Component\Finder\SplFileInfo(
$folder,
'',
basename($folder)
)];
}
collect($files)->filter(function ($file) {
return $file->getExtension() == 'php';
})->each(function ($file) {
$class = substr($file->getFilename(), 0, -4);
require_once $file->getRealPath();
(new $class())->run();
});
});
} | [
"protected",
"function",
"runSeeders",
"(",
"$",
"folders",
",",
"$",
"basePath",
")",
"{",
"$",
"filesystem",
"=",
"$",
"this",
"->",
"filesystem",
";",
"$",
"this",
"->",
"realPath",
"(",
"$",
"folders",
",",
"$",
"basePath",
")",
"->",
"each",
"(",
... | Run seeder files.
@param array $folders
@param string $basePath | [
"Run",
"seeder",
"files",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L1096-L1121 |
larapack/hooks | src/Hooks.php | Hooks.realPath | protected function realPath(array $paths, $basePath = '')
{
return collect($paths)->map(function ($path) use ($basePath) {
return realpath($basePath.$path);
})->filter(function ($path) {
return $path;
});
} | php | protected function realPath(array $paths, $basePath = '')
{
return collect($paths)->map(function ($path) use ($basePath) {
return realpath($basePath.$path);
})->filter(function ($path) {
return $path;
});
} | [
"protected",
"function",
"realPath",
"(",
"array",
"$",
"paths",
",",
"$",
"basePath",
"=",
"''",
")",
"{",
"return",
"collect",
"(",
"$",
"paths",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"path",
")",
"use",
"(",
"$",
"basePath",
")",
"{",
"re... | Get collection of realpath paths.
@param array $paths
@param string $basePath
@return \Illuminate\Support\Collection | [
"Get",
"collection",
"of",
"realpath",
"paths",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L1131-L1138 |
larapack/hooks | src/Hooks.php | Hooks.makeTemponaryBackup | protected function makeTemponaryBackup(Hook $hook)
{
$folder = $this->createTempFolder();
$this->filesystem->copyDirectory($hook->getPath(), $folder);
$this->tempDirectories[$hook->name] = $folder;
} | php | protected function makeTemponaryBackup(Hook $hook)
{
$folder = $this->createTempFolder();
$this->filesystem->copyDirectory($hook->getPath(), $folder);
$this->tempDirectories[$hook->name] = $folder;
} | [
"protected",
"function",
"makeTemponaryBackup",
"(",
"Hook",
"$",
"hook",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"createTempFolder",
"(",
")",
";",
"$",
"this",
"->",
"filesystem",
"->",
"copyDirectory",
"(",
"$",
"hook",
"->",
"getPath",
"(",
... | Make temponary backup of hook.
@param \Larapack\Hooks\Hook $hook
@return void | [
"Make",
"temponary",
"backup",
"of",
"hook",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/Hooks.php#L1147-L1153 |
larapack/hooks | src/HooksServiceProvider.php | HooksServiceProvider.register | public function register()
{
$configPath = dirname(__DIR__).'/publishable/config/hooks.php';
$this->mergeConfigFrom($configPath, 'hooks');
if (!config('hooks.enabled', true)) {
return;
}
$this->registerCommands();
$this->publishes(
[$configPath => config_path('hooks.php')],
'hooks-config'
);
// Register Hooks system and aliases
$this->app->singleton(Hooks::class, function ($app) {
$filesystem = $app[Filesystem::class];
$migrator = $app[Migrator::class];
return new Hooks($filesystem, $migrator);
});
$this->app->alias(Hooks::class, 'hooks');
// The migrator is responsible for actually running and rollback the migration
// files in the application. We'll pass in our database connection resolver
// so the migrator can resolve any of these connections when it needs to.
$this->app->singleton(Migrator::class, function ($app) {
$repository = $app['migration.repository'];
return new Migrator($repository, $app['db'], $app['files']);
});
} | php | public function register()
{
$configPath = dirname(__DIR__).'/publishable/config/hooks.php';
$this->mergeConfigFrom($configPath, 'hooks');
if (!config('hooks.enabled', true)) {
return;
}
$this->registerCommands();
$this->publishes(
[$configPath => config_path('hooks.php')],
'hooks-config'
);
// Register Hooks system and aliases
$this->app->singleton(Hooks::class, function ($app) {
$filesystem = $app[Filesystem::class];
$migrator = $app[Migrator::class];
return new Hooks($filesystem, $migrator);
});
$this->app->alias(Hooks::class, 'hooks');
// The migrator is responsible for actually running and rollback the migration
// files in the application. We'll pass in our database connection resolver
// so the migrator can resolve any of these connections when it needs to.
$this->app->singleton(Migrator::class, function ($app) {
$repository = $app['migration.repository'];
return new Migrator($repository, $app['db'], $app['files']);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"configPath",
"=",
"dirname",
"(",
"__DIR__",
")",
".",
"'/publishable/config/hooks.php'",
";",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"configPath",
",",
"'hooks'",
")",
";",
"if",
"(",
"!",
"c... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/HooksServiceProvider.php#L14-L49 |
larapack/hooks | src/HooksServiceProvider.php | HooksServiceProvider.registerHookProviders | public function registerHookProviders()
{
// load only the enabled hooks
$hooks = $this->app['hooks']->hooks()->where('enabled', true);
$loader = AliasLoader::getInstance();
foreach ($hooks as $hook) {
// load providers
foreach ($hook->getProviders() as $provider) {
$this->app->register($provider);
}
// set aliases
foreach ($hook->getAliases() as $alias => $class) {
$loader->alias($alias, $class);
}
}
} | php | public function registerHookProviders()
{
// load only the enabled hooks
$hooks = $this->app['hooks']->hooks()->where('enabled', true);
$loader = AliasLoader::getInstance();
foreach ($hooks as $hook) {
// load providers
foreach ($hook->getProviders() as $provider) {
$this->app->register($provider);
}
// set aliases
foreach ($hook->getAliases() as $alias => $class) {
$loader->alias($alias, $class);
}
}
} | [
"public",
"function",
"registerHookProviders",
"(",
")",
"{",
"// load only the enabled hooks",
"$",
"hooks",
"=",
"$",
"this",
"->",
"app",
"[",
"'hooks'",
"]",
"->",
"hooks",
"(",
")",
"->",
"where",
"(",
"'enabled'",
",",
"true",
")",
";",
"$",
"loader"... | Register Hook Service Providers. | [
"Register",
"Hook",
"Service",
"Providers",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/HooksServiceProvider.php#L54-L71 |
larapack/hooks | src/HooksServiceProvider.php | HooksServiceProvider.registerCommands | protected function registerCommands()
{
$this->commands(Commands\SetupCommand::class);
$this->commands(Commands\MakeCommand::class);
$this->commands(Commands\InstallCommand::class);
$this->commands(Commands\UninstallCommand::class);
$this->commands(Commands\UpdateCommand::class);
$this->commands(Commands\CheckCommand::class);
$this->commands(Commands\EnableCommand::class);
$this->commands(Commands\DisableCommand::class);
$this->commands(Commands\InfoCommand::class);
$this->commands(Commands\ListCommand::class);
} | php | protected function registerCommands()
{
$this->commands(Commands\SetupCommand::class);
$this->commands(Commands\MakeCommand::class);
$this->commands(Commands\InstallCommand::class);
$this->commands(Commands\UninstallCommand::class);
$this->commands(Commands\UpdateCommand::class);
$this->commands(Commands\CheckCommand::class);
$this->commands(Commands\EnableCommand::class);
$this->commands(Commands\DisableCommand::class);
$this->commands(Commands\InfoCommand::class);
$this->commands(Commands\ListCommand::class);
} | [
"protected",
"function",
"registerCommands",
"(",
")",
"{",
"$",
"this",
"->",
"commands",
"(",
"Commands",
"\\",
"SetupCommand",
"::",
"class",
")",
";",
"$",
"this",
"->",
"commands",
"(",
"Commands",
"\\",
"MakeCommand",
"::",
"class",
")",
";",
"$",
... | Register commands. | [
"Register",
"commands",
"."
] | train | https://github.com/larapack/hooks/blob/f39696243060aa9b3ccc42cb565890a21950858a/src/HooksServiceProvider.php#L89-L101 |
dannyvankooten/laravel-vat | src/VatServiceProvider.php | VatServiceProvider.boot | public function boot()
{
/**
* Register the "vat_number" validation rule.
*/
LaravelValidator::extend('vat_number', function ($attribute, $value, $parameters, $validator) {
$rule = new Rules\VatNumber;
return $rule->passes($attribute, $value);
});
/**
* Register the "country_code" validation rule.
*/
LaravelValidator::extend('country_code', function ($attribute, $value, $parameters, $validator) {
$rule = new Rules\Country;
return $rule->passes($attribute, $value);
});
} | php | public function boot()
{
/**
* Register the "vat_number" validation rule.
*/
LaravelValidator::extend('vat_number', function ($attribute, $value, $parameters, $validator) {
$rule = new Rules\VatNumber;
return $rule->passes($attribute, $value);
});
/**
* Register the "country_code" validation rule.
*/
LaravelValidator::extend('country_code', function ($attribute, $value, $parameters, $validator) {
$rule = new Rules\Country;
return $rule->passes($attribute, $value);
});
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"/**\n * Register the \"vat_number\" validation rule.\n */",
"LaravelValidator",
"::",
"extend",
"(",
"'vat_number'",
",",
"function",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
",",
"... | Boot the service provider.
@return void | [
"Boot",
"the",
"service",
"provider",
"."
] | train | https://github.com/dannyvankooten/laravel-vat/blob/e214b18d2d7ae1205f1337be5b13a508150245cd/src/VatServiceProvider.php#L22-L39 |
dannyvankooten/laravel-vat | src/VatServiceProvider.php | VatServiceProvider.register | public function register()
{
$this->app->singleton( Countries::class, function (Container $app) {
return new Countries();
});
$this->app->singleton( Validator::class, function (Container $app) {
return new Validator();
});
$this->app->singleton( Rates::class, function (Container $app) {
$defaultCacheDriver = $app['cache']->getDefaultDriver();
$cacheDriver = $app['cache']->driver( $defaultCacheDriver );
return new Rates( null, $cacheDriver );
});
} | php | public function register()
{
$this->app->singleton( Countries::class, function (Container $app) {
return new Countries();
});
$this->app->singleton( Validator::class, function (Container $app) {
return new Validator();
});
$this->app->singleton( Rates::class, function (Container $app) {
$defaultCacheDriver = $app['cache']->getDefaultDriver();
$cacheDriver = $app['cache']->driver( $defaultCacheDriver );
return new Rates( null, $cacheDriver );
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"Countries",
"::",
"class",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"return",
"new",
"Countries",
"(",
")",
";",
"}",
")",
";",
"$",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/dannyvankooten/laravel-vat/blob/e214b18d2d7ae1205f1337be5b13a508150245cd/src/VatServiceProvider.php#L46-L61 |
tetranz/select2entity-bundle | Form/DataTransformer/EntityToPropertyTransformer.php | EntityToPropertyTransformer.transform | public function transform($entity)
{
$data = array();
if (empty($entity)) {
return $data;
}
$text = is_null($this->textProperty)
? (string) $entity
: $this->accessor->getValue($entity, $this->textProperty);
if ($this->em->contains($entity)) {
$value = (string) $this->accessor->getValue($entity, $this->primaryKey);
} else {
$value = $this->newTagPrefix . $text;
$text = $text.$this->newTagText;
}
$data[$value] = $text;
return $data;
} | php | public function transform($entity)
{
$data = array();
if (empty($entity)) {
return $data;
}
$text = is_null($this->textProperty)
? (string) $entity
: $this->accessor->getValue($entity, $this->textProperty);
if ($this->em->contains($entity)) {
$value = (string) $this->accessor->getValue($entity, $this->primaryKey);
} else {
$value = $this->newTagPrefix . $text;
$text = $text.$this->newTagText;
}
$data[$value] = $text;
return $data;
} | [
"public",
"function",
"transform",
"(",
"$",
"entity",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"entity",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"text",
"=",
"is_null",
"(",
"$",
"this",
"-... | Transform entity to array
@param mixed $entity
@return array | [
"Transform",
"entity",
"to",
"array"
] | train | https://github.com/tetranz/select2entity-bundle/blob/23d6162014ac1d2d7d104885b960e85cbd110ff4/Form/DataTransformer/EntityToPropertyTransformer.php#L59-L80 |
tetranz/select2entity-bundle | Form/DataTransformer/EntityToPropertyTransformer.php | EntityToPropertyTransformer.reverseTransform | public function reverseTransform($value)
{
if (empty($value)) {
return null;
}
// Add a potential new tag entry
$tagPrefixLength = strlen($this->newTagPrefix);
$cleanValue = substr($value, $tagPrefixLength);
$valuePrefix = substr($value, 0, $tagPrefixLength);
if ($valuePrefix == $this->newTagPrefix) {
// In that case, we have a new entry
$entity = new $this->className;
$this->accessor->setValue($entity, $this->textProperty, $cleanValue);
} else {
// We do not search for a new entry, as it does not exist yet, by definition
try {
$entity = $this->em->createQueryBuilder()
->select('entity')
->from($this->className, 'entity')
->where('entity.'.$this->primaryKey.' = :id')
->setParameter('id', $value)
->getQuery()
->getSingleResult();
}
catch (\Exception $ex) {
// this will happen if the form submits invalid data
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
}
}
if (!$entity) {
return null;
}
return $entity;
} | php | public function reverseTransform($value)
{
if (empty($value)) {
return null;
}
// Add a potential new tag entry
$tagPrefixLength = strlen($this->newTagPrefix);
$cleanValue = substr($value, $tagPrefixLength);
$valuePrefix = substr($value, 0, $tagPrefixLength);
if ($valuePrefix == $this->newTagPrefix) {
// In that case, we have a new entry
$entity = new $this->className;
$this->accessor->setValue($entity, $this->textProperty, $cleanValue);
} else {
// We do not search for a new entry, as it does not exist yet, by definition
try {
$entity = $this->em->createQueryBuilder()
->select('entity')
->from($this->className, 'entity')
->where('entity.'.$this->primaryKey.' = :id')
->setParameter('id', $value)
->getQuery()
->getSingleResult();
}
catch (\Exception $ex) {
// this will happen if the form submits invalid data
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
}
}
if (!$entity) {
return null;
}
return $entity;
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Add a potential new tag entry",
"$",
"tagPrefixLength",
"=",
"strlen",
"(",
"$",
"this",
"->",
"new... | Transform single id value to an entity
@param string $value
@return mixed|null|object | [
"Transform",
"single",
"id",
"value",
"to",
"an",
"entity"
] | train | https://github.com/tetranz/select2entity-bundle/blob/23d6162014ac1d2d7d104885b960e85cbd110ff4/Form/DataTransformer/EntityToPropertyTransformer.php#L88-L124 |
tetranz/select2entity-bundle | Form/DataTransformer/EntitiesToPropertyTransformer.php | EntitiesToPropertyTransformer.reverseTransform | public function reverseTransform($values)
{
if (!is_array($values) || empty($values)) {
return array();
}
// add new tag entries
$newObjects = array();
$tagPrefixLength = strlen($this->newTagPrefix);
foreach ($values as $key => $value) {
$cleanValue = substr($value, $tagPrefixLength);
$valuePrefix = substr($value, 0, $tagPrefixLength);
if ($valuePrefix == $this->newTagPrefix) {
$object = new $this->className;
$this->accessor->setValue($object, $this->textProperty, $cleanValue);
$newObjects[] = $object;
unset($values[$key]);
}
}
try {
// get multiple entities with one query
$entities = $this->em->createQueryBuilder()
->select('entity')
->from($this->className, 'entity')
->where('entity.'.$this->primaryKey.' IN (:ids)')
->setParameter('ids', $values)
->getQuery()
->getResult();
}
catch (\Exception $ex) {
// this will happen if the form submits invalid data
throw new TransformationFailedException('One or more id values are invalid');
}
return array_merge($entities, $newObjects);
} | php | public function reverseTransform($values)
{
if (!is_array($values) || empty($values)) {
return array();
}
// add new tag entries
$newObjects = array();
$tagPrefixLength = strlen($this->newTagPrefix);
foreach ($values as $key => $value) {
$cleanValue = substr($value, $tagPrefixLength);
$valuePrefix = substr($value, 0, $tagPrefixLength);
if ($valuePrefix == $this->newTagPrefix) {
$object = new $this->className;
$this->accessor->setValue($object, $this->textProperty, $cleanValue);
$newObjects[] = $object;
unset($values[$key]);
}
}
try {
// get multiple entities with one query
$entities = $this->em->createQueryBuilder()
->select('entity')
->from($this->className, 'entity')
->where('entity.'.$this->primaryKey.' IN (:ids)')
->setParameter('ids', $values)
->getQuery()
->getResult();
}
catch (\Exception $ex) {
// this will happen if the form submits invalid data
throw new TransformationFailedException('One or more id values are invalid');
}
return array_merge($entities, $newObjects);
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
"||",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"// add new tag entries",
"$",
"newObj... | Transform array to a collection of entities
@param array $values
@return array | [
"Transform",
"array",
"to",
"a",
"collection",
"of",
"entities"
] | train | https://github.com/tetranz/select2entity-bundle/blob/23d6162014ac1d2d7d104885b960e85cbd110ff4/Form/DataTransformer/EntitiesToPropertyTransformer.php#L90-L126 |
tetranz/select2entity-bundle | Service/AutocompleteService.php | AutocompleteService.getAutocompleteResults | public function getAutocompleteResults(Request $request, $type)
{
$form = $this->formFactory->create($type);
$fieldOptions = $form->get($request->get('field_name'))->getConfig()->getOptions();
/** @var EntityRepository $repo */
$repo = $this->doctrine->getRepository($fieldOptions['class']);
$term = $request->get('q');
$countQB = $repo->createQueryBuilder('e');
$countQB
->select($countQB->expr()->count('e'))
->where('e.'.$fieldOptions['property'].' LIKE :term')
->setParameter('term', '%' . $term . '%')
;
$maxResults = $fieldOptions['page_limit'];
$offset = ($request->get('page', 1) - 1) * $maxResults;
$resultQb = $repo->createQueryBuilder('e');
$resultQb
->where('e.'.$fieldOptions['property'].' LIKE :term')
->setParameter('term', '%' . $term . '%')
->setMaxResults($maxResults)
->setFirstResult($offset)
;
if (is_callable($fieldOptions['callback'])) {
$cb = $fieldOptions['callback'];
$cb($countQB, $request);
$cb($resultQb, $request);
}
$count = $countQB->getQuery()->getSingleScalarResult();
$paginationResults = $resultQb->getQuery()->getResult();
$result = ['results' => null, 'more' => $count > ($offset + $maxResults)];
$accessor = PropertyAccess::createPropertyAccessor();
$result['results'] = array_map(function ($item) use ($accessor, $fieldOptions) {
return ['id' => $accessor->getValue($item, $fieldOptions['primary_key']), 'text' => $accessor->getValue($item, $fieldOptions['property'])];
}, $paginationResults);
return $result;
} | php | public function getAutocompleteResults(Request $request, $type)
{
$form = $this->formFactory->create($type);
$fieldOptions = $form->get($request->get('field_name'))->getConfig()->getOptions();
/** @var EntityRepository $repo */
$repo = $this->doctrine->getRepository($fieldOptions['class']);
$term = $request->get('q');
$countQB = $repo->createQueryBuilder('e');
$countQB
->select($countQB->expr()->count('e'))
->where('e.'.$fieldOptions['property'].' LIKE :term')
->setParameter('term', '%' . $term . '%')
;
$maxResults = $fieldOptions['page_limit'];
$offset = ($request->get('page', 1) - 1) * $maxResults;
$resultQb = $repo->createQueryBuilder('e');
$resultQb
->where('e.'.$fieldOptions['property'].' LIKE :term')
->setParameter('term', '%' . $term . '%')
->setMaxResults($maxResults)
->setFirstResult($offset)
;
if (is_callable($fieldOptions['callback'])) {
$cb = $fieldOptions['callback'];
$cb($countQB, $request);
$cb($resultQb, $request);
}
$count = $countQB->getQuery()->getSingleScalarResult();
$paginationResults = $resultQb->getQuery()->getResult();
$result = ['results' => null, 'more' => $count > ($offset + $maxResults)];
$accessor = PropertyAccess::createPropertyAccessor();
$result['results'] = array_map(function ($item) use ($accessor, $fieldOptions) {
return ['id' => $accessor->getValue($item, $fieldOptions['primary_key']), 'text' => $accessor->getValue($item, $fieldOptions['property'])];
}, $paginationResults);
return $result;
} | [
"public",
"function",
"getAutocompleteResults",
"(",
"Request",
"$",
"request",
",",
"$",
"type",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"formFactory",
"->",
"create",
"(",
"$",
"type",
")",
";",
"$",
"fieldOptions",
"=",
"$",
"form",
"->",
"ge... | @param Request $request
@param string|FormTypeInterface $type
@return array | [
"@param",
"Request",
"$request",
"@param",
"string|FormTypeInterface",
"$type"
] | train | https://github.com/tetranz/select2entity-bundle/blob/23d6162014ac1d2d7d104885b960e85cbd110ff4/Service/AutocompleteService.php#L40-L87 |
tetranz/select2entity-bundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('tetranz_select2_entity');
$rootNode
->children()
->scalarNode('minimum_input_length')->defaultValue(1)->end()
->scalarNode('scroll')->defaultFalse()->end()
->scalarNode('page_limit')->defaultValue(10)->end()
->scalarNode('allow_clear')->defaultFalse()->end()
->arrayNode('allow_add')->addDefaultsIfNotSet()
->children()
->scalarNode('enabled')->defaultFalse()->end()
->scalarNode('new_tag_text')->defaultValue(' (NEW)')->end()
->scalarNode('new_tag_prefix')->defaultValue('__')->end()
->scalarNode('tag_separators')->defaultValue('[",", " "]')->end()
->end()
->end()
->scalarNode('delay')->defaultValue(250)->end()
->scalarNode('language')->defaultValue('en')->end()
->scalarNode('cache')->defaultTrue()->end()
// default to 1ms for backwards compatibility for older versions where 'cache' is true but the
// user is not aware of the updated caching feature. This way the cache will, by default, not
// be very effective. Realistically this should be like 60000ms (60 seconds).
->scalarNode('cache_timeout')->defaultValue(1)->end()
->scalarNode('width')->defaultNull()->end()
->scalarNode('object_manager')->defaultValue(1)->end()
->end();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('tetranz_select2_entity');
$rootNode
->children()
->scalarNode('minimum_input_length')->defaultValue(1)->end()
->scalarNode('scroll')->defaultFalse()->end()
->scalarNode('page_limit')->defaultValue(10)->end()
->scalarNode('allow_clear')->defaultFalse()->end()
->arrayNode('allow_add')->addDefaultsIfNotSet()
->children()
->scalarNode('enabled')->defaultFalse()->end()
->scalarNode('new_tag_text')->defaultValue(' (NEW)')->end()
->scalarNode('new_tag_prefix')->defaultValue('__')->end()
->scalarNode('tag_separators')->defaultValue('[",", " "]')->end()
->end()
->end()
->scalarNode('delay')->defaultValue(250)->end()
->scalarNode('language')->defaultValue('en')->end()
->scalarNode('cache')->defaultTrue()->end()
// default to 1ms for backwards compatibility for older versions where 'cache' is true but the
// user is not aware of the updated caching feature. This way the cache will, by default, not
// be very effective. Realistically this should be like 60000ms (60 seconds).
->scalarNode('cache_timeout')->defaultValue(1)->end()
->scalarNode('width')->defaultNull()->end()
->scalarNode('object_manager')->defaultValue(1)->end()
->end();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'tetranz_select2_entity'",
")",
";",
"$",
"rootNode",
"->",
"children",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/tetranz/select2entity-bundle/blob/23d6162014ac1d2d7d104885b960e85cbd110ff4/DependencyInjection/Configuration.php#L18-L53 |
TYPO3/Surf | src/Task/Transfer/RsyncTask.php | RsyncTask.execute | public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
{
$localPackagePath = $deployment->getWorkspacePath($application);
$releasePath = $deployment->getApplicationReleasePath($application);
$remotePath = Files::concatenatePaths([$application->getDeploymentPath(), 'cache/transfer']);
// make sure there is a remote .cache folder
$command = 'mkdir -p ' . $remotePath;
$this->shell->executeOrSimulate($command, $node, $deployment);
$username = $node->hasOption('username') ? $node->getOption('username') . '@' : '';
$hostname = $node->getHostname();
$noPubkeyAuthentication = $node->hasOption('password') ? ' -o PubkeyAuthentication=no' : '';
$port = $node->hasOption('port') ? ' -p ' . escapeshellarg($node->getOption('port')) : '';
$key = $node->hasOption('privateKeyFile') ? ' -i ' . escapeshellarg($node->getOption('privateKeyFile')) : '';
$quietFlag = (isset($options['verbose']) && $options['verbose']) ? '' : '-q';
$rshFlag = ($node->isLocalhost() ? '' : '--rsh="ssh' . $noPubkeyAuthentication . $port . $key . '" ');
$rsyncExcludes = isset($options['rsyncExcludes']) ? $options['rsyncExcludes'] : ['.git'];
$excludeFlags = $this->getExcludeFlags($rsyncExcludes);
$rsyncFlags = (isset($options['rsyncFlags']) ? $options['rsyncFlags'] : '--recursive --times --perms --links --delete --delete-excluded') . $excludeFlags;
$destinationArgument = ($node->isLocalhost() ? $remotePath : "{$username}{$hostname}:{$remotePath}");
$command = "rsync {$quietFlag} --compress {$rshFlag} {$rsyncFlags} " . escapeshellarg($localPackagePath . '/.') . ' ' . escapeshellarg($destinationArgument);
if ($node->hasOption('password')) {
$passwordSshLoginScriptPathAndFilename = Files::concatenatePaths([dirname(dirname(dirname(__DIR__))), 'Resources', 'Private/Scripts/PasswordSshLogin.expect']);
if (Phar::running() !== '') {
$passwordSshLoginScriptContents = file_get_contents($passwordSshLoginScriptPathAndFilename);
$passwordSshLoginScriptPathAndFilename = Files::concatenatePaths([$deployment->getTemporaryPath(), 'PasswordSshLogin.expect']);
file_put_contents($passwordSshLoginScriptPathAndFilename, $passwordSshLoginScriptContents);
}
$command = sprintf('expect %s %s %s', escapeshellarg($passwordSshLoginScriptPathAndFilename), escapeshellarg($node->getOption('password')), $command);
}
$localhost = new Node('localhost');
$localhost->onLocalhost();
$this->shell->executeOrSimulate($command, $localhost, $deployment);
if (isset($passwordSshLoginScriptPathAndFilename) && Phar::running() !== '') {
unlink($passwordSshLoginScriptPathAndFilename);
}
$command = strtr("cp -RPp $remotePath/. $releasePath", "\t\n", ' ');
// TODO Copy revision file (if it exists) for application to deployment path with release identifier
$this->shell->executeOrSimulate($command, $node, $deployment);
} | php | public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
{
$localPackagePath = $deployment->getWorkspacePath($application);
$releasePath = $deployment->getApplicationReleasePath($application);
$remotePath = Files::concatenatePaths([$application->getDeploymentPath(), 'cache/transfer']);
// make sure there is a remote .cache folder
$command = 'mkdir -p ' . $remotePath;
$this->shell->executeOrSimulate($command, $node, $deployment);
$username = $node->hasOption('username') ? $node->getOption('username') . '@' : '';
$hostname = $node->getHostname();
$noPubkeyAuthentication = $node->hasOption('password') ? ' -o PubkeyAuthentication=no' : '';
$port = $node->hasOption('port') ? ' -p ' . escapeshellarg($node->getOption('port')) : '';
$key = $node->hasOption('privateKeyFile') ? ' -i ' . escapeshellarg($node->getOption('privateKeyFile')) : '';
$quietFlag = (isset($options['verbose']) && $options['verbose']) ? '' : '-q';
$rshFlag = ($node->isLocalhost() ? '' : '--rsh="ssh' . $noPubkeyAuthentication . $port . $key . '" ');
$rsyncExcludes = isset($options['rsyncExcludes']) ? $options['rsyncExcludes'] : ['.git'];
$excludeFlags = $this->getExcludeFlags($rsyncExcludes);
$rsyncFlags = (isset($options['rsyncFlags']) ? $options['rsyncFlags'] : '--recursive --times --perms --links --delete --delete-excluded') . $excludeFlags;
$destinationArgument = ($node->isLocalhost() ? $remotePath : "{$username}{$hostname}:{$remotePath}");
$command = "rsync {$quietFlag} --compress {$rshFlag} {$rsyncFlags} " . escapeshellarg($localPackagePath . '/.') . ' ' . escapeshellarg($destinationArgument);
if ($node->hasOption('password')) {
$passwordSshLoginScriptPathAndFilename = Files::concatenatePaths([dirname(dirname(dirname(__DIR__))), 'Resources', 'Private/Scripts/PasswordSshLogin.expect']);
if (Phar::running() !== '') {
$passwordSshLoginScriptContents = file_get_contents($passwordSshLoginScriptPathAndFilename);
$passwordSshLoginScriptPathAndFilename = Files::concatenatePaths([$deployment->getTemporaryPath(), 'PasswordSshLogin.expect']);
file_put_contents($passwordSshLoginScriptPathAndFilename, $passwordSshLoginScriptContents);
}
$command = sprintf('expect %s %s %s', escapeshellarg($passwordSshLoginScriptPathAndFilename), escapeshellarg($node->getOption('password')), $command);
}
$localhost = new Node('localhost');
$localhost->onLocalhost();
$this->shell->executeOrSimulate($command, $localhost, $deployment);
if (isset($passwordSshLoginScriptPathAndFilename) && Phar::running() !== '') {
unlink($passwordSshLoginScriptPathAndFilename);
}
$command = strtr("cp -RPp $remotePath/. $releasePath", "\t\n", ' ');
// TODO Copy revision file (if it exists) for application to deployment path with release identifier
$this->shell->executeOrSimulate($command, $node, $deployment);
} | [
"public",
"function",
"execute",
"(",
"Node",
"$",
"node",
",",
"Application",
"$",
"application",
",",
"Deployment",
"$",
"deployment",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"localPackagePath",
"=",
"$",
"deployment",
"->",
"getWorks... | Execute this task
@param \TYPO3\Surf\Domain\Model\Node $node
@param \TYPO3\Surf\Domain\Model\Application $application
@param \TYPO3\Surf\Domain\Model\Deployment $deployment
@param array $options | [
"Execute",
"this",
"task"
] | train | https://github.com/TYPO3/Surf/blob/0292b88a0cd21dd96174f3306deb98952a0c03a7/src/Task/Transfer/RsyncTask.php#L37-L86 |
TYPO3/Surf | src/Task/Transfer/RsyncTask.php | RsyncTask.rollback | public function rollback(Node $node, Application $application, Deployment $deployment, array $options = [])
{
$releasePath = $deployment->getApplicationReleasePath($application);
$this->shell->execute('rm -Rf ' . $releasePath, $node, $deployment, true);
} | php | public function rollback(Node $node, Application $application, Deployment $deployment, array $options = [])
{
$releasePath = $deployment->getApplicationReleasePath($application);
$this->shell->execute('rm -Rf ' . $releasePath, $node, $deployment, true);
} | [
"public",
"function",
"rollback",
"(",
"Node",
"$",
"node",
",",
"Application",
"$",
"application",
",",
"Deployment",
"$",
"deployment",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"releasePath",
"=",
"$",
"deployment",
"->",
"getApplicati... | Rollback this task
@param \TYPO3\Surf\Domain\Model\Node $node
@param \TYPO3\Surf\Domain\Model\Application $application
@param \TYPO3\Surf\Domain\Model\Deployment $deployment
@param array $options | [
"Rollback",
"this",
"task"
] | train | https://github.com/TYPO3/Surf/blob/0292b88a0cd21dd96174f3306deb98952a0c03a7/src/Task/Transfer/RsyncTask.php#L109-L113 |
TYPO3/Surf | src/Domain/Model/Application.php | Application.getSharedDirectory | public function getSharedDirectory()
{
$result = self::DEFAULT_SHARED_DIR;
if ($this->hasOption('sharedDirectory') && !empty($this->getOption('sharedDirectory'))) {
$sharedPath = $this->getOption('sharedDirectory');
if (preg_match('/(^|\/)\.\.(\/|$)/', $sharedPath)) {
throw new InvalidConfigurationException(
sprintf(
'Relative constructs as "../" are not allowed in option "sharedDirectory". Given option: "%s"',
$sharedPath
),
1490107183141
);
}
$result = rtrim($sharedPath, '/');
}
return $result;
} | php | public function getSharedDirectory()
{
$result = self::DEFAULT_SHARED_DIR;
if ($this->hasOption('sharedDirectory') && !empty($this->getOption('sharedDirectory'))) {
$sharedPath = $this->getOption('sharedDirectory');
if (preg_match('/(^|\/)\.\.(\/|$)/', $sharedPath)) {
throw new InvalidConfigurationException(
sprintf(
'Relative constructs as "../" are not allowed in option "sharedDirectory". Given option: "%s"',
$sharedPath
),
1490107183141
);
}
$result = rtrim($sharedPath, '/');
}
return $result;
} | [
"public",
"function",
"getSharedDirectory",
"(",
")",
"{",
"$",
"result",
"=",
"self",
"::",
"DEFAULT_SHARED_DIR",
";",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"'sharedDirectory'",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"getOption",
"(",
... | Returns the shared directory
takes directory name from option "sharedDirectory"
if option is not set or empty constant DEFAULT_SHARED_DIR "shared" is used
@return string
@throws InvalidConfigurationException | [
"Returns",
"the",
"shared",
"directory"
] | train | https://github.com/TYPO3/Surf/blob/0292b88a0cd21dd96174f3306deb98952a0c03a7/src/Domain/Model/Application.php#L195-L212 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.