id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
27,700
OXID-eSales/paymorrow-module
core/oxpsoxid2paymorrow.php
OxpsOxid2Paymorrow.buildPaymorrowGateway
public function buildPaymorrowGateway() { $oPmGateway = $this->getPaymorrowGateway(); $oPmGateway->setPmClient( $this->getPaymorrowClient() ); $oPmGateway->setEshopDataProvider( $this->getEshopDataProvider() ); $oPmGateway->setEndPointUrl( $this->getPaymorrowSettings()->getEndPointURL() ); /** * Using singleton pattern in order to get access to this object later * and check response from Paymorrow */ $oPmGateway->setResponseHandler( oxRegistry::get( 'OxpsPaymorrowResponseHandler' ) ); return $oPmGateway; }
php
public function buildPaymorrowGateway() { $oPmGateway = $this->getPaymorrowGateway(); $oPmGateway->setPmClient( $this->getPaymorrowClient() ); $oPmGateway->setEshopDataProvider( $this->getEshopDataProvider() ); $oPmGateway->setEndPointUrl( $this->getPaymorrowSettings()->getEndPointURL() ); /** * Using singleton pattern in order to get access to this object later * and check response from Paymorrow */ $oPmGateway->setResponseHandler( oxRegistry::get( 'OxpsPaymorrowResponseHandler' ) ); return $oPmGateway; }
[ "public", "function", "buildPaymorrowGateway", "(", ")", "{", "$", "oPmGateway", "=", "$", "this", "->", "getPaymorrowGateway", "(", ")", ";", "$", "oPmGateway", "->", "setPmClient", "(", "$", "this", "->", "getPaymorrowClient", "(", ")", ")", ";", "$", "oPmGateway", "->", "setEshopDataProvider", "(", "$", "this", "->", "getEshopDataProvider", "(", ")", ")", ";", "$", "oPmGateway", "->", "setEndPointUrl", "(", "$", "this", "->", "getPaymorrowSettings", "(", ")", "->", "getEndPointURL", "(", ")", ")", ";", "/**\n * Using singleton pattern in order to get access to this object later\n * and check response from Paymorrow\n */", "$", "oPmGateway", "->", "setResponseHandler", "(", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowResponseHandler'", ")", ")", ";", "return", "$", "oPmGateway", ";", "}" ]
Get initialized Paymorrow gateway instance. @return OxpsPaymorrowGateway
[ "Get", "initialized", "Paymorrow", "gateway", "instance", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpsoxid2paymorrow.php#L125-L139
27,701
OXID-eSales/paymorrow-module
core/oxpsoxid2paymorrow.php
OxpsOxid2Paymorrow.getBuiltPaymorrowRequestController
public function getBuiltPaymorrowRequestController() { $oPmRequestController = $this->getPaymorrowRequestController(); $oPmGateway = $this->buildPaymorrowGateway(); $oPmRequestController->setGateway( $oPmGateway ); return $oPmRequestController; }
php
public function getBuiltPaymorrowRequestController() { $oPmRequestController = $this->getPaymorrowRequestController(); $oPmGateway = $this->buildPaymorrowGateway(); $oPmRequestController->setGateway( $oPmGateway ); return $oPmRequestController; }
[ "public", "function", "getBuiltPaymorrowRequestController", "(", ")", "{", "$", "oPmRequestController", "=", "$", "this", "->", "getPaymorrowRequestController", "(", ")", ";", "$", "oPmGateway", "=", "$", "this", "->", "buildPaymorrowGateway", "(", ")", ";", "$", "oPmRequestController", "->", "setGateway", "(", "$", "oPmGateway", ")", ";", "return", "$", "oPmRequestController", ";", "}" ]
Get built Paymorrow request controller with Paymorrow gateway set. @return RequestController
[ "Get", "built", "Paymorrow", "request", "controller", "with", "Paymorrow", "gateway", "set", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpsoxid2paymorrow.php#L146-L155
27,702
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowprepareorder.php
OxpsPaymorrowPrepareOrder.prepareOrder
public function prepareOrder() { $this->setPaymorrowPaymentMethodId(); /** @var OxpsPaymorrowRequestControllerProxy $pmGateWay */ $pmGateWay = oxNew('OxpsPaymorrowRequestControllerProxy'); $oUtils = oxRegistry::getUtils(); $oUtils->setHeader("Content-Type: application/json"); $oUtils->showMessageAndExit($pmGateWay->prepareOrder($_POST)); }
php
public function prepareOrder() { $this->setPaymorrowPaymentMethodId(); /** @var OxpsPaymorrowRequestControllerProxy $pmGateWay */ $pmGateWay = oxNew('OxpsPaymorrowRequestControllerProxy'); $oUtils = oxRegistry::getUtils(); $oUtils->setHeader("Content-Type: application/json"); $oUtils->showMessageAndExit($pmGateWay->prepareOrder($_POST)); }
[ "public", "function", "prepareOrder", "(", ")", "{", "$", "this", "->", "setPaymorrowPaymentMethodId", "(", ")", ";", "/** @var OxpsPaymorrowRequestControllerProxy $pmGateWay */", "$", "pmGateWay", "=", "oxNew", "(", "'OxpsPaymorrowRequestControllerProxy'", ")", ";", "$", "oUtils", "=", "oxRegistry", "::", "getUtils", "(", ")", ";", "$", "oUtils", "->", "setHeader", "(", "\"Content-Type: application/json\"", ")", ";", "$", "oUtils", "->", "showMessageAndExit", "(", "$", "pmGateWay", "->", "prepareOrder", "(", "$", "_POST", ")", ")", ";", "}" ]
Paymorrow function for Verifying Form Data against Paymorrow Services. Also set selected payment method ID revealed by Paymorrow payment method name.
[ "Paymorrow", "function", "for", "Verifying", "Form", "Data", "against", "Paymorrow", "Services", ".", "Also", "set", "selected", "payment", "method", "ID", "revealed", "by", "Paymorrow", "payment", "method", "name", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowprepareorder.php#L54-L64
27,703
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowprepareorder.php
OxpsPaymorrowPrepareOrder.setPaymorrowPaymentMethodId
protected function setPaymorrowPaymentMethodId() { /** @var oxPayment|OxpsPaymorrowOxPayment $payment */ $payment = oxNew('oxPayment'); $paymentIdField = self::OXPS_PAYMENT_ID_FIELD; $paymentName = (string) $this->getConfig()->getRequestParameter(self::OXPS_PM_PAYMENT_NAME_FIELD); if ($payment->loadByPaymorrowName($paymentName) and !$this->getConfig()->getRequestParameter($paymentIdField) ) { $this->appendPostData(array($paymentIdField => (string) $payment->getId())); } }
php
protected function setPaymorrowPaymentMethodId() { /** @var oxPayment|OxpsPaymorrowOxPayment $payment */ $payment = oxNew('oxPayment'); $paymentIdField = self::OXPS_PAYMENT_ID_FIELD; $paymentName = (string) $this->getConfig()->getRequestParameter(self::OXPS_PM_PAYMENT_NAME_FIELD); if ($payment->loadByPaymorrowName($paymentName) and !$this->getConfig()->getRequestParameter($paymentIdField) ) { $this->appendPostData(array($paymentIdField => (string) $payment->getId())); } }
[ "protected", "function", "setPaymorrowPaymentMethodId", "(", ")", "{", "/** @var oxPayment|OxpsPaymorrowOxPayment $payment */", "$", "payment", "=", "oxNew", "(", "'oxPayment'", ")", ";", "$", "paymentIdField", "=", "self", "::", "OXPS_PAYMENT_ID_FIELD", ";", "$", "paymentName", "=", "(", "string", ")", "$", "this", "->", "getConfig", "(", ")", "->", "getRequestParameter", "(", "self", "::", "OXPS_PM_PAYMENT_NAME_FIELD", ")", ";", "if", "(", "$", "payment", "->", "loadByPaymorrowName", "(", "$", "paymentName", ")", "and", "!", "$", "this", "->", "getConfig", "(", ")", "->", "getRequestParameter", "(", "$", "paymentIdField", ")", ")", "{", "$", "this", "->", "appendPostData", "(", "array", "(", "$", "paymentIdField", "=>", "(", "string", ")", "$", "payment", "->", "getId", "(", ")", ")", ")", ";", "}", "}" ]
Load payment instance by Paymorrow payment method name and set it to both, request and session if not yet set.
[ "Load", "payment", "instance", "by", "Paymorrow", "payment", "method", "name", "and", "set", "it", "to", "both", "request", "and", "session", "if", "not", "yet", "set", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowprepareorder.php#L71-L83
27,704
OXID-eSales/paymorrow-module
components/widgets/oxpspaymorrowinit.php
OxpsPaymorrowInit.getPaymorrowJavaScriptPmInitFull
public function getPaymorrowJavaScriptPmInitFull() { $sPmPrintData = $this->_getPaymorrowPrintData(); $sPmControllerPrepareOrder = $this->getPaymorrowControllerPrepareOrderProcessPaymentURL(); $sSelectedMethod = $this->getSelectedPaymorrowMethod(); $sNextButtonId = 'paymentNextStepBottom'; $sSDD = sprintf( 'pmInitFull("SDD", "pmsdd", "rb_payment_sdd", "dl_payment_sdd", "payment", %s, "%s", %s, "%s");', $sPmPrintData, $sPmControllerPrepareOrder, ($sSelectedMethod == 'pm_sdd') ? 'true' : 'false', $sNextButtonId ); $sInvoice = sprintf( 'pmInitFull("INVOICE", "pminvoice", "rb_payment_invoice", "dl_payment_invoice", "payment", %s, "%s", %s, "%s");', $sPmPrintData, $sPmControllerPrepareOrder, ($sSelectedMethod == 'pm_invoice') ? 'true' : 'false', $sNextButtonId ); return sprintf('$(document).ready(function(){%s%s});', $sSDD, $sInvoice); }
php
public function getPaymorrowJavaScriptPmInitFull() { $sPmPrintData = $this->_getPaymorrowPrintData(); $sPmControllerPrepareOrder = $this->getPaymorrowControllerPrepareOrderProcessPaymentURL(); $sSelectedMethod = $this->getSelectedPaymorrowMethod(); $sNextButtonId = 'paymentNextStepBottom'; $sSDD = sprintf( 'pmInitFull("SDD", "pmsdd", "rb_payment_sdd", "dl_payment_sdd", "payment", %s, "%s", %s, "%s");', $sPmPrintData, $sPmControllerPrepareOrder, ($sSelectedMethod == 'pm_sdd') ? 'true' : 'false', $sNextButtonId ); $sInvoice = sprintf( 'pmInitFull("INVOICE", "pminvoice", "rb_payment_invoice", "dl_payment_invoice", "payment", %s, "%s", %s, "%s");', $sPmPrintData, $sPmControllerPrepareOrder, ($sSelectedMethod == 'pm_invoice') ? 'true' : 'false', $sNextButtonId ); return sprintf('$(document).ready(function(){%s%s});', $sSDD, $sInvoice); }
[ "public", "function", "getPaymorrowJavaScriptPmInitFull", "(", ")", "{", "$", "sPmPrintData", "=", "$", "this", "->", "_getPaymorrowPrintData", "(", ")", ";", "$", "sPmControllerPrepareOrder", "=", "$", "this", "->", "getPaymorrowControllerPrepareOrderProcessPaymentURL", "(", ")", ";", "$", "sSelectedMethod", "=", "$", "this", "->", "getSelectedPaymorrowMethod", "(", ")", ";", "$", "sNextButtonId", "=", "'paymentNextStepBottom'", ";", "$", "sSDD", "=", "sprintf", "(", "'pmInitFull(\"SDD\", \"pmsdd\", \"rb_payment_sdd\", \"dl_payment_sdd\", \"payment\", %s, \"%s\", %s, \"%s\");'", ",", "$", "sPmPrintData", ",", "$", "sPmControllerPrepareOrder", ",", "(", "$", "sSelectedMethod", "==", "'pm_sdd'", ")", "?", "'true'", ":", "'false'", ",", "$", "sNextButtonId", ")", ";", "$", "sInvoice", "=", "sprintf", "(", "'pmInitFull(\"INVOICE\", \"pminvoice\", \"rb_payment_invoice\", \"dl_payment_invoice\", \"payment\", %s, \"%s\", %s, \"%s\");'", ",", "$", "sPmPrintData", ",", "$", "sPmControllerPrepareOrder", ",", "(", "$", "sSelectedMethod", "==", "'pm_invoice'", ")", "?", "'true'", ":", "'false'", ",", "$", "sNextButtonId", ")", ";", "return", "sprintf", "(", "'$(document).ready(function(){%s%s});'", ",", "$", "sSDD", ",", "$", "sInvoice", ")", ";", "}" ]
Returns a JavaScript with Paymorrow payment methods initialization functions wrapped in document.ready. @nice-to-have Use a template for JS generation rather than doing in within PHP. @return string
[ "Returns", "a", "JavaScript", "with", "Paymorrow", "payment", "methods", "initialization", "functions", "wrapped", "in", "document", ".", "ready", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/components/widgets/oxpspaymorrowinit.php#L84-L108
27,705
OXID-eSales/paymorrow-module
components/widgets/oxpspaymorrowinit.php
OxpsPaymorrowInit.getSelectedPaymorrowMethod
public function getSelectedPaymorrowMethod() { $sSessionPaymentId = (string) oxRegistry::getSession()->getVariable( 'paymentid' ); /** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */ $oPayment = oxNew( 'OxpsPaymorrowOxPayment' ); if ( empty( $sSessionPaymentId ) or !$oPayment->load( $sSessionPaymentId ) or !$oPayment->isPaymorrowActiveAndMapped() ) { $oPayment->loadPaymorrowDefault(); } return (string) $oPayment->getPaymorrowPaymentType(); }
php
public function getSelectedPaymorrowMethod() { $sSessionPaymentId = (string) oxRegistry::getSession()->getVariable( 'paymentid' ); /** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */ $oPayment = oxNew( 'OxpsPaymorrowOxPayment' ); if ( empty( $sSessionPaymentId ) or !$oPayment->load( $sSessionPaymentId ) or !$oPayment->isPaymorrowActiveAndMapped() ) { $oPayment->loadPaymorrowDefault(); } return (string) $oPayment->getPaymorrowPaymentType(); }
[ "public", "function", "getSelectedPaymorrowMethod", "(", ")", "{", "$", "sSessionPaymentId", "=", "(", "string", ")", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'paymentid'", ")", ";", "/** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */", "$", "oPayment", "=", "oxNew", "(", "'OxpsPaymorrowOxPayment'", ")", ";", "if", "(", "empty", "(", "$", "sSessionPaymentId", ")", "or", "!", "$", "oPayment", "->", "load", "(", "$", "sSessionPaymentId", ")", "or", "!", "$", "oPayment", "->", "isPaymorrowActiveAndMapped", "(", ")", ")", "{", "$", "oPayment", "->", "loadPaymorrowDefault", "(", ")", ";", "}", "return", "(", "string", ")", "$", "oPayment", "->", "getPaymorrowPaymentType", "(", ")", ";", "}" ]
Get a code of selected Paymorrow payment method. First session is checked for what user have selected, then payment methods configuration is checked. It applies only on payment methods linked to Paymorrow. @return string Paymorrow payment method code or empty string.
[ "Get", "a", "code", "of", "selected", "Paymorrow", "payment", "method", ".", "First", "session", "is", "checked", "for", "what", "user", "have", "selected", "then", "payment", "methods", "configuration", "is", "checked", ".", "It", "applies", "only", "on", "payment", "methods", "linked", "to", "Paymorrow", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/components/widgets/oxpspaymorrowinit.php#L117-L131
27,706
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasketitem.php
OxpsPaymorrowOxBasketItem.getProductNumber
public function getProductNumber() { /** @var $this OxpsPaymorrowOxBasketItem|oxBasketItem */ /** @var oxArticle $oArticle */ $oArticle = $this->getArticle(); return isset( $oArticle->oxarticles__oxartnum->value ) ? (string) $oArticle->oxarticles__oxartnum->value : ''; }
php
public function getProductNumber() { /** @var $this OxpsPaymorrowOxBasketItem|oxBasketItem */ /** @var oxArticle $oArticle */ $oArticle = $this->getArticle(); return isset( $oArticle->oxarticles__oxartnum->value ) ? (string) $oArticle->oxarticles__oxartnum->value : ''; }
[ "public", "function", "getProductNumber", "(", ")", "{", "/** @var $this OxpsPaymorrowOxBasketItem|oxBasketItem */", "/** @var oxArticle $oArticle */", "$", "oArticle", "=", "$", "this", "->", "getArticle", "(", ")", ";", "return", "isset", "(", "$", "oArticle", "->", "oxarticles__oxartnum", "->", "value", ")", "?", "(", "string", ")", "$", "oArticle", "->", "oxarticles__oxartnum", "->", "value", ":", "''", ";", "}" ]
Get related article number. @return string
[ "Get", "related", "article", "number", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasketitem.php#L61-L69
27,707
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasketitem.php
OxpsPaymorrowOxBasketItem.getPaymorrowBasketItemSummary
public function getPaymorrowBasketItemSummary( $iLineItemCount ) { /** @var OxpsPaymorrowOxBasketItem|oxBasketItem $this */ $sPaymorrowLineItemPrefix = self::getPaymorrowBasketSummaryLineItemPrefix( $iLineItemCount ); return array( $sPaymorrowLineItemPrefix . 'quantity' => (double) $this->getAmount(), $sPaymorrowLineItemPrefix . 'articleId' => $this->_toUtf( $this->getProductNumber() ), $sPaymorrowLineItemPrefix . 'name' => $this->_toUtf( $this->getTitle(), 50 ), $sPaymorrowLineItemPrefix . 'type' => 'GOODS', $sPaymorrowLineItemPrefix . 'unitPriceGross' => (double) $this->getUnitPrice()->getBruttoPrice(), $sPaymorrowLineItemPrefix . 'grossAmount' => (double) $this->getPrice()->getBruttoPrice(), $sPaymorrowLineItemPrefix . 'vatAmount' => (double) $this->getPrice()->getVatValue(), $sPaymorrowLineItemPrefix . 'vatRate' => (double) $this->getVatPercent(), ); }
php
public function getPaymorrowBasketItemSummary( $iLineItemCount ) { /** @var OxpsPaymorrowOxBasketItem|oxBasketItem $this */ $sPaymorrowLineItemPrefix = self::getPaymorrowBasketSummaryLineItemPrefix( $iLineItemCount ); return array( $sPaymorrowLineItemPrefix . 'quantity' => (double) $this->getAmount(), $sPaymorrowLineItemPrefix . 'articleId' => $this->_toUtf( $this->getProductNumber() ), $sPaymorrowLineItemPrefix . 'name' => $this->_toUtf( $this->getTitle(), 50 ), $sPaymorrowLineItemPrefix . 'type' => 'GOODS', $sPaymorrowLineItemPrefix . 'unitPriceGross' => (double) $this->getUnitPrice()->getBruttoPrice(), $sPaymorrowLineItemPrefix . 'grossAmount' => (double) $this->getPrice()->getBruttoPrice(), $sPaymorrowLineItemPrefix . 'vatAmount' => (double) $this->getPrice()->getVatValue(), $sPaymorrowLineItemPrefix . 'vatRate' => (double) $this->getVatPercent(), ); }
[ "public", "function", "getPaymorrowBasketItemSummary", "(", "$", "iLineItemCount", ")", "{", "/** @var OxpsPaymorrowOxBasketItem|oxBasketItem $this */", "$", "sPaymorrowLineItemPrefix", "=", "self", "::", "getPaymorrowBasketSummaryLineItemPrefix", "(", "$", "iLineItemCount", ")", ";", "return", "array", "(", "$", "sPaymorrowLineItemPrefix", ".", "'quantity'", "=>", "(", "double", ")", "$", "this", "->", "getAmount", "(", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'articleId'", "=>", "$", "this", "->", "_toUtf", "(", "$", "this", "->", "getProductNumber", "(", ")", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'name'", "=>", "$", "this", "->", "_toUtf", "(", "$", "this", "->", "getTitle", "(", ")", ",", "50", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'type'", "=>", "'GOODS'", ",", "$", "sPaymorrowLineItemPrefix", ".", "'unitPriceGross'", "=>", "(", "double", ")", "$", "this", "->", "getUnitPrice", "(", ")", "->", "getBruttoPrice", "(", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'grossAmount'", "=>", "(", "double", ")", "$", "this", "->", "getPrice", "(", ")", "->", "getBruttoPrice", "(", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'vatAmount'", "=>", "(", "double", ")", "$", "this", "->", "getPrice", "(", ")", "->", "getVatValue", "(", ")", ",", "$", "sPaymorrowLineItemPrefix", ".", "'vatRate'", "=>", "(", "double", ")", "$", "this", "->", "getVatPercent", "(", ")", ",", ")", ";", "}" ]
Compiles summary data array of basket item for Paymorrow. @param int $iLineItemCount @return array
[ "Compiles", "summary", "data", "array", "of", "basket", "item", "for", "Paymorrow", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasketitem.php#L78-L94
27,708
hostnet/accessor-generator-plugin-lib
src/Plugin.php
Plugin.getFilesAndReflectionClassesFromPackage
private function getFilesAndReflectionClassesFromPackage(PackageInterface $package) { $cache_id = $package->getName(); if (isset($this->metadata[$cache_id])) { return $this->metadata[$cache_id]; } $this->metadata[$cache_id] = []; foreach ($this->getFilesForPackage($package) as $filename) { $filename = (string) $filename; if (isset($this->metadata[$cache_id][$filename])) { continue; } $this->metadata[$cache_id][$filename] = new ReflectionClass($filename); } return $this->metadata[$package->getName()]; }
php
private function getFilesAndReflectionClassesFromPackage(PackageInterface $package) { $cache_id = $package->getName(); if (isset($this->metadata[$cache_id])) { return $this->metadata[$cache_id]; } $this->metadata[$cache_id] = []; foreach ($this->getFilesForPackage($package) as $filename) { $filename = (string) $filename; if (isset($this->metadata[$cache_id][$filename])) { continue; } $this->metadata[$cache_id][$filename] = new ReflectionClass($filename); } return $this->metadata[$package->getName()]; }
[ "private", "function", "getFilesAndReflectionClassesFromPackage", "(", "PackageInterface", "$", "package", ")", "{", "$", "cache_id", "=", "$", "package", "->", "getName", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "metadata", "[", "$", "cache_id", "]", ")", ")", "{", "return", "$", "this", "->", "metadata", "[", "$", "cache_id", "]", ";", "}", "$", "this", "->", "metadata", "[", "$", "cache_id", "]", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getFilesForPackage", "(", "$", "package", ")", "as", "$", "filename", ")", "{", "$", "filename", "=", "(", "string", ")", "$", "filename", ";", "if", "(", "isset", "(", "$", "this", "->", "metadata", "[", "$", "cache_id", "]", "[", "$", "filename", "]", ")", ")", "{", "continue", ";", "}", "$", "this", "->", "metadata", "[", "$", "cache_id", "]", "[", "$", "filename", "]", "=", "new", "ReflectionClass", "(", "$", "filename", ")", ";", "}", "return", "$", "this", "->", "metadata", "[", "$", "package", "->", "getName", "(", ")", "]", ";", "}" ]
Returns a key-value array of ReflectionClass instances for all the file names found in the given package. This method returns a cached instance when executed more than once for the same package. @param PackageInterface $package @return mixed @throws Reflection\Exception\FileException
[ "Returns", "a", "key", "-", "value", "array", "of", "ReflectionClass", "instances", "for", "all", "the", "file", "names", "found", "in", "the", "given", "package", ".", "This", "method", "returns", "a", "cached", "instance", "when", "executed", "more", "than", "once", "for", "the", "same", "package", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Plugin.php#L214-L233
27,709
hostnet/accessor-generator-plugin-lib
src/Plugin.php
Plugin.getFilesForPackage
private function getFilesForPackage(PackageInterface $package) { if ($package instanceof RootPackageInterface) { $path = '.'; } else { $path = $this->composer->getInstallationManager()->getInstallPath($package); } $path .= '/src'; $finder = new Finder(); return $finder ->ignoreVCS(true) ->ignoreDotFiles(true) ->exclude(['Generated']) ->name('*.php') ->in($path) ->getIterator(); }
php
private function getFilesForPackage(PackageInterface $package) { if ($package instanceof RootPackageInterface) { $path = '.'; } else { $path = $this->composer->getInstallationManager()->getInstallPath($package); } $path .= '/src'; $finder = new Finder(); return $finder ->ignoreVCS(true) ->ignoreDotFiles(true) ->exclude(['Generated']) ->name('*.php') ->in($path) ->getIterator(); }
[ "private", "function", "getFilesForPackage", "(", "PackageInterface", "$", "package", ")", "{", "if", "(", "$", "package", "instanceof", "RootPackageInterface", ")", "{", "$", "path", "=", "'.'", ";", "}", "else", "{", "$", "path", "=", "$", "this", "->", "composer", "->", "getInstallationManager", "(", ")", "->", "getInstallPath", "(", "$", "package", ")", ";", "}", "$", "path", ".=", "'/src'", ";", "$", "finder", "=", "new", "Finder", "(", ")", ";", "return", "$", "finder", "->", "ignoreVCS", "(", "true", ")", "->", "ignoreDotFiles", "(", "true", ")", "->", "exclude", "(", "[", "'Generated'", "]", ")", "->", "name", "(", "'*.php'", ")", "->", "in", "(", "$", "path", ")", "->", "getIterator", "(", ")", ";", "}" ]
Find all the PHP files within a package. Excludes - all files in VCS directories - all files in vendor folders - all files in Generated folders - all hidden files @throws \LogicException @throws \InvalidArgumentException @param PackageInterface $package @return \Iterator|\SplFileInfo[]
[ "Find", "all", "the", "PHP", "files", "within", "a", "package", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Plugin.php#L250-L268
27,710
techdivision/import-product
src/Observers/ProductInventoryUpdateObserver.php
ProductInventoryUpdateObserver.initializeStockItem
protected function initializeStockItem(array $attr) { // load the stock item with the passed item/product/stock ID $entity = $this->loadStockItem( $attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID], $attr[MemberNames::STOCK_ID] ); // merge the attributes with the entity, if available if ($entity) { return $this->mergeEntity($entity, $attr); } // otherwise simply return the attributes return $attr; }
php
protected function initializeStockItem(array $attr) { // load the stock item with the passed item/product/stock ID $entity = $this->loadStockItem( $attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID], $attr[MemberNames::STOCK_ID] ); // merge the attributes with the entity, if available if ($entity) { return $this->mergeEntity($entity, $attr); } // otherwise simply return the attributes return $attr; }
[ "protected", "function", "initializeStockItem", "(", "array", "$", "attr", ")", "{", "// load the stock item with the passed item/product/stock ID", "$", "entity", "=", "$", "this", "->", "loadStockItem", "(", "$", "attr", "[", "MemberNames", "::", "PRODUCT_ID", "]", ",", "$", "attr", "[", "MemberNames", "::", "WEBSITE_ID", "]", ",", "$", "attr", "[", "MemberNames", "::", "STOCK_ID", "]", ")", ";", "// merge the attributes with the entity, if available", "if", "(", "$", "entity", ")", "{", "return", "$", "this", "->", "mergeEntity", "(", "$", "entity", ",", "$", "attr", ")", ";", "}", "// otherwise simply return the attributes", "return", "$", "attr", ";", "}" ]
Initialize the stock item with the passed attributes and returns an instance. @param array $attr The stock item attributes @return array The initialized stock item
[ "Initialize", "the", "stock", "item", "with", "the", "passed", "attributes", "and", "returns", "an", "instance", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/ProductInventoryUpdateObserver.php#L44-L61
27,711
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser.getUserPaymorrowDateOfBirth
public function getUserPaymorrowDateOfBirth( $blSplit = false ) { $mDate = $this->oxuser__oxbirthdate->value; if ( !empty( $blSplit ) ) { $aDate = explode( '-', $mDate ); $mDate = array( $this->_getDateComponentAsInteger( $aDate, 0, '0000' ), $this->_getDateComponentAsInteger( $aDate, 1 ), $this->_getDateComponentAsInteger( $aDate, 2 ), ); } return $mDate; }
php
public function getUserPaymorrowDateOfBirth( $blSplit = false ) { $mDate = $this->oxuser__oxbirthdate->value; if ( !empty( $blSplit ) ) { $aDate = explode( '-', $mDate ); $mDate = array( $this->_getDateComponentAsInteger( $aDate, 0, '0000' ), $this->_getDateComponentAsInteger( $aDate, 1 ), $this->_getDateComponentAsInteger( $aDate, 2 ), ); } return $mDate; }
[ "public", "function", "getUserPaymorrowDateOfBirth", "(", "$", "blSplit", "=", "false", ")", "{", "$", "mDate", "=", "$", "this", "->", "oxuser__oxbirthdate", "->", "value", ";", "if", "(", "!", "empty", "(", "$", "blSplit", ")", ")", "{", "$", "aDate", "=", "explode", "(", "'-'", ",", "$", "mDate", ")", ";", "$", "mDate", "=", "array", "(", "$", "this", "->", "_getDateComponentAsInteger", "(", "$", "aDate", ",", "0", ",", "'0000'", ")", ",", "$", "this", "->", "_getDateComponentAsInteger", "(", "$", "aDate", ",", "1", ")", ",", "$", "this", "->", "_getDateComponentAsInteger", "(", "$", "aDate", ",", "2", ")", ",", ")", ";", "}", "return", "$", "mDate", ";", "}" ]
Get user birth date. @param bool $blSplit If true return array with year, month, day, if false the date as string (default) @return string|array
[ "Get", "user", "birth", "date", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L80-L94
27,712
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser.getUserPaymorrowIpAddress
public function getUserPaymorrowIpAddress() { /** @var $oUtilsServer oxUtilsServer */ $oUtilsServer = oxRegistry::get( "oxUtilsServer" ); $sIpAddress = $oUtilsServer->getRemoteAddress(); return strpos( $sIpAddress, ':' ) ? $oUtilsServer->getServerVar( 'REMOTE_ADDR' ) : $sIpAddress; }
php
public function getUserPaymorrowIpAddress() { /** @var $oUtilsServer oxUtilsServer */ $oUtilsServer = oxRegistry::get( "oxUtilsServer" ); $sIpAddress = $oUtilsServer->getRemoteAddress(); return strpos( $sIpAddress, ':' ) ? $oUtilsServer->getServerVar( 'REMOTE_ADDR' ) : $sIpAddress; }
[ "public", "function", "getUserPaymorrowIpAddress", "(", ")", "{", "/** @var $oUtilsServer oxUtilsServer */", "$", "oUtilsServer", "=", "oxRegistry", "::", "get", "(", "\"oxUtilsServer\"", ")", ";", "$", "sIpAddress", "=", "$", "oUtilsServer", "->", "getRemoteAddress", "(", ")", ";", "return", "strpos", "(", "$", "sIpAddress", ",", "':'", ")", "?", "$", "oUtilsServer", "->", "getServerVar", "(", "'REMOTE_ADDR'", ")", ":", "$", "sIpAddress", ";", "}" ]
Get client remote IP address. For IPv6 got from utils, gets value from REMOTE_ADDR variable directly. @return string
[ "Get", "client", "remote", "IP", "address", ".", "For", "IPv6", "got", "from", "utils", "gets", "value", "from", "REMOTE_ADDR", "variable", "directly", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L154-L161
27,713
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser.getUserPaymorrowCountry
public function getUserPaymorrowCountry( $sCountryId = '' ) { /** @var oxCountry $oCountry */ $oCountry = oxNew( 'oxCountry' ); $oCountry->load( empty( $sCountryId ) ? $this->oxuser__oxcountryid->value : (string) $sCountryId ); return $oCountry->oxcountry__oxisoalpha2->value; }
php
public function getUserPaymorrowCountry( $sCountryId = '' ) { /** @var oxCountry $oCountry */ $oCountry = oxNew( 'oxCountry' ); $oCountry->load( empty( $sCountryId ) ? $this->oxuser__oxcountryid->value : (string) $sCountryId ); return $oCountry->oxcountry__oxisoalpha2->value; }
[ "public", "function", "getUserPaymorrowCountry", "(", "$", "sCountryId", "=", "''", ")", "{", "/** @var oxCountry $oCountry */", "$", "oCountry", "=", "oxNew", "(", "'oxCountry'", ")", ";", "$", "oCountry", "->", "load", "(", "empty", "(", "$", "sCountryId", ")", "?", "$", "this", "->", "oxuser__oxcountryid", "->", "value", ":", "(", "string", ")", "$", "sCountryId", ")", ";", "return", "$", "oCountry", "->", "oxcountry__oxisoalpha2", "->", "value", ";", "}" ]
Get user billing address country code. @param string $sCountryId Optional country ID to load. If empty, default user billing country is loaded. @return string
[ "Get", "user", "billing", "address", "country", "code", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L288-L296
27,714
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser.getUserGroupNames
public function getUserGroupNames() { /** @var OxpsPaymorrowOxUser|oxUser $this */ /** @var oxList $oGroups */ if ( !( $oGroups = $this->getUserGroups() ) ) { return ''; } $aGroups = array(); foreach ( $oGroups as $oGroup ) { if ( $this->_isGroupValid( $oGroup ) ) { $aGroups[] = $oGroup->oxgroups__oxtitle->value; } } return implode( ', ', $aGroups ); }
php
public function getUserGroupNames() { /** @var OxpsPaymorrowOxUser|oxUser $this */ /** @var oxList $oGroups */ if ( !( $oGroups = $this->getUserGroups() ) ) { return ''; } $aGroups = array(); foreach ( $oGroups as $oGroup ) { if ( $this->_isGroupValid( $oGroup ) ) { $aGroups[] = $oGroup->oxgroups__oxtitle->value; } } return implode( ', ', $aGroups ); }
[ "public", "function", "getUserGroupNames", "(", ")", "{", "/** @var OxpsPaymorrowOxUser|oxUser $this */", "/** @var oxList $oGroups */", "if", "(", "!", "(", "$", "oGroups", "=", "$", "this", "->", "getUserGroups", "(", ")", ")", ")", "{", "return", "''", ";", "}", "$", "aGroups", "=", "array", "(", ")", ";", "foreach", "(", "$", "oGroups", "as", "$", "oGroup", ")", "{", "if", "(", "$", "this", "->", "_isGroupValid", "(", "$", "oGroup", ")", ")", "{", "$", "aGroups", "[", "]", "=", "$", "oGroup", "->", "oxgroups__oxtitle", "->", "value", ";", "}", "}", "return", "implode", "(", "', '", ",", "$", "aGroups", ")", ";", "}" ]
Get user group names as comma separated string. @return string
[ "Get", "user", "group", "names", "as", "comma", "separated", "string", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L353-L371
27,715
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser.mapDataAndSaveObject
public function mapDataAndSaveObject( array $aData, array $aMap, $oObject = null ) { if ( is_null( $oObject ) ) { $oObject = $this; } if ( $this->_mapDataFieldsToObject( $aData, $aMap, $oObject ) ) { return $oObject->save(); } return null; }
php
public function mapDataAndSaveObject( array $aData, array $aMap, $oObject = null ) { if ( is_null( $oObject ) ) { $oObject = $this; } if ( $this->_mapDataFieldsToObject( $aData, $aMap, $oObject ) ) { return $oObject->save(); } return null; }
[ "public", "function", "mapDataAndSaveObject", "(", "array", "$", "aData", ",", "array", "$", "aMap", ",", "$", "oObject", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "oObject", ")", ")", "{", "$", "oObject", "=", "$", "this", ";", "}", "if", "(", "$", "this", "->", "_mapDataFieldsToObject", "(", "$", "aData", ",", "$", "aMap", ",", "$", "oObject", ")", ")", "{", "return", "$", "oObject", "->", "save", "(", ")", ";", "}", "return", "null", ";", "}" ]
Find and map object fields in data array, assign the values and save object. Updates only with not empty values and if values duffer from existing ones. @param array $aData @param array $aMap @param object|null $oObject @return bool|null
[ "Find", "and", "map", "object", "fields", "in", "data", "array", "assign", "the", "values", "and", "save", "object", ".", "Updates", "only", "with", "not", "empty", "values", "and", "if", "values", "duffer", "from", "existing", "ones", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L383-L394
27,716
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser._getDateComponentAsInteger
protected function _getDateComponentAsInteger( $aDate, $iKey, $sZeroString = '00' ) { if ( empty( $aDate[$iKey] ) or ( $aDate[$iKey] == $sZeroString ) ) { return 0; } return (int) $aDate[$iKey]; }
php
protected function _getDateComponentAsInteger( $aDate, $iKey, $sZeroString = '00' ) { if ( empty( $aDate[$iKey] ) or ( $aDate[$iKey] == $sZeroString ) ) { return 0; } return (int) $aDate[$iKey]; }
[ "protected", "function", "_getDateComponentAsInteger", "(", "$", "aDate", ",", "$", "iKey", ",", "$", "sZeroString", "=", "'00'", ")", "{", "if", "(", "empty", "(", "$", "aDate", "[", "$", "iKey", "]", ")", "or", "(", "$", "aDate", "[", "$", "iKey", "]", "==", "$", "sZeroString", ")", ")", "{", "return", "0", ";", "}", "return", "(", "int", ")", "$", "aDate", "[", "$", "iKey", "]", ";", "}" ]
Get date component from an array by key as an integer. @param array $aDate Date components as array. @param int $iKey Date component index. @param string $sZeroString A zero representing string value, default is "00". @return int
[ "Get", "date", "component", "from", "an", "array", "by", "key", "as", "an", "integer", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L406-L413
27,717
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser._isGroupValid
protected function _isGroupValid( $oGroup ) { return ( !empty( $oGroup->oxgroups__oxactive->value ) and !empty( $oGroup->oxgroups__oxtitle->value ) ); }
php
protected function _isGroupValid( $oGroup ) { return ( !empty( $oGroup->oxgroups__oxactive->value ) and !empty( $oGroup->oxgroups__oxtitle->value ) ); }
[ "protected", "function", "_isGroupValid", "(", "$", "oGroup", ")", "{", "return", "(", "!", "empty", "(", "$", "oGroup", "->", "oxgroups__oxactive", "->", "value", ")", "and", "!", "empty", "(", "$", "oGroup", "->", "oxgroups__oxtitle", "->", "value", ")", ")", ";", "}" ]
Check if group is active and has non-empty title. @param object $oGroup @return bool
[ "Check", "if", "group", "is", "active", "and", "has", "non", "-", "empty", "title", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L422-L425
27,718
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser._mapDataFieldsToObject
protected function _mapDataFieldsToObject( array $aData, array $aMap, $oObject ) { $blValueSet = false; foreach ( $aData as $sKey => $mValue ) { $sValue = trim( (string) $mValue ); if ( $this->_isObjectFieldWithValidValue( $sKey, $sValue, $aMap, $oObject ) ) { $sField = $aMap[$sKey]; $oObject->$sField = new oxField( $sValue ); $blValueSet = true; } } return $blValueSet; }
php
protected function _mapDataFieldsToObject( array $aData, array $aMap, $oObject ) { $blValueSet = false; foreach ( $aData as $sKey => $mValue ) { $sValue = trim( (string) $mValue ); if ( $this->_isObjectFieldWithValidValue( $sKey, $sValue, $aMap, $oObject ) ) { $sField = $aMap[$sKey]; $oObject->$sField = new oxField( $sValue ); $blValueSet = true; } } return $blValueSet; }
[ "protected", "function", "_mapDataFieldsToObject", "(", "array", "$", "aData", ",", "array", "$", "aMap", ",", "$", "oObject", ")", "{", "$", "blValueSet", "=", "false", ";", "foreach", "(", "$", "aData", "as", "$", "sKey", "=>", "$", "mValue", ")", "{", "$", "sValue", "=", "trim", "(", "(", "string", ")", "$", "mValue", ")", ";", "if", "(", "$", "this", "->", "_isObjectFieldWithValidValue", "(", "$", "sKey", ",", "$", "sValue", ",", "$", "aMap", ",", "$", "oObject", ")", ")", "{", "$", "sField", "=", "$", "aMap", "[", "$", "sKey", "]", ";", "$", "oObject", "->", "$", "sField", "=", "new", "oxField", "(", "$", "sValue", ")", ";", "$", "blValueSet", "=", "true", ";", "}", "}", "return", "$", "blValueSet", ";", "}" ]
Check each data array field if it could be mapped to object and set the value if it is not empty and differ. @param array $aData @param array $aMap @param object $oObject @return bool True if at least one field updated, false otherwise.
[ "Check", "each", "data", "array", "field", "if", "it", "could", "be", "mapped", "to", "object", "and", "set", "the", "value", "if", "it", "is", "not", "empty", "and", "differ", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L436-L451
27,719
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuser.php
OxpsPaymorrowOxUser._isObjectFieldWithValidValue
protected function _isObjectFieldWithValidValue( $sKey, $sValue, $aMap, $oObject ) { if ( !array_key_exists( $sKey, $aMap ) ) { return false; } $sField = $aMap[$sKey]; if ( empty( $sValue ) or ( $oObject->$sField->value == $sValue ) ) { return false; } return true; }
php
protected function _isObjectFieldWithValidValue( $sKey, $sValue, $aMap, $oObject ) { if ( !array_key_exists( $sKey, $aMap ) ) { return false; } $sField = $aMap[$sKey]; if ( empty( $sValue ) or ( $oObject->$sField->value == $sValue ) ) { return false; } return true; }
[ "protected", "function", "_isObjectFieldWithValidValue", "(", "$", "sKey", ",", "$", "sValue", ",", "$", "aMap", ",", "$", "oObject", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "sKey", ",", "$", "aMap", ")", ")", "{", "return", "false", ";", "}", "$", "sField", "=", "$", "aMap", "[", "$", "sKey", "]", ";", "if", "(", "empty", "(", "$", "sValue", ")", "or", "(", "$", "oObject", "->", "$", "sField", "->", "value", "==", "$", "sValue", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check if field is in the map array and value is nor blank, neither same as already set. @param string $sKey @param string $sValue @param array $aMap @param object $oObject @return bool True if key is mapped with new non-blank value, false otherwise.
[ "Check", "if", "field", "is", "in", "the", "map", "array", "and", "value", "is", "nor", "blank", "neither", "same", "as", "already", "set", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuser.php#L463-L476
27,720
hostnet/accessor-generator-plugin-lib
src/Annotation/Generate.php
Generate.getMostLimitedVisibility
public static function getMostLimitedVisibility(...$requirements): string { foreach ([self::VISIBILITY_NONE, self::VISIBILITY_PRIVATE, self::VISIBILITY_PROTECTED] as $search_string) { foreach ($requirements as $requirement) { if ($requirement === $search_string) { return $search_string; } } } return self::VISIBILITY_PUBLIC; }
php
public static function getMostLimitedVisibility(...$requirements): string { foreach ([self::VISIBILITY_NONE, self::VISIBILITY_PRIVATE, self::VISIBILITY_PROTECTED] as $search_string) { foreach ($requirements as $requirement) { if ($requirement === $search_string) { return $search_string; } } } return self::VISIBILITY_PUBLIC; }
[ "public", "static", "function", "getMostLimitedVisibility", "(", "...", "$", "requirements", ")", ":", "string", "{", "foreach", "(", "[", "self", "::", "VISIBILITY_NONE", ",", "self", "::", "VISIBILITY_PRIVATE", ",", "self", "::", "VISIBILITY_PROTECTED", "]", "as", "$", "search_string", ")", "{", "foreach", "(", "$", "requirements", "as", "$", "requirement", ")", "{", "if", "(", "$", "requirement", "===", "$", "search_string", ")", "{", "return", "$", "search_string", ";", "}", "}", "}", "return", "self", "::", "VISIBILITY_PUBLIC", ";", "}" ]
Resolves the most limited visibility for method generation. If A defines public and B defines private, the returned visibility modifier will be private. Precedence is as following: - none - private - protected - public @param array ...$requirements @return string
[ "Resolves", "the", "most", "limited", "visibility", "for", "method", "generation", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Annotation/Generate.php#L224-L235
27,721
hostnet/accessor-generator-plugin-lib
src/Annotation/Generate.php
Generate.setDefaultVisibility
public function setDefaultVisibility(string $visibility): void { if (null === $this->get) { $this->get = $visibility; } if (null === $this->set) { $this->set = $visibility; } if (null === $this->add) { $this->add = $visibility; } if (null !== $this->remove) { return; } $this->remove = $visibility; }
php
public function setDefaultVisibility(string $visibility): void { if (null === $this->get) { $this->get = $visibility; } if (null === $this->set) { $this->set = $visibility; } if (null === $this->add) { $this->add = $visibility; } if (null !== $this->remove) { return; } $this->remove = $visibility; }
[ "public", "function", "setDefaultVisibility", "(", "string", "$", "visibility", ")", ":", "void", "{", "if", "(", "null", "===", "$", "this", "->", "get", ")", "{", "$", "this", "->", "get", "=", "$", "visibility", ";", "}", "if", "(", "null", "===", "$", "this", "->", "set", ")", "{", "$", "this", "->", "set", "=", "$", "visibility", ";", "}", "if", "(", "null", "===", "$", "this", "->", "add", ")", "{", "$", "this", "->", "add", "=", "$", "visibility", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "remove", ")", "{", "return", ";", "}", "$", "this", "->", "remove", "=", "$", "visibility", ";", "}" ]
Sets the given visibility to all accessors if they are not explicitly defined. @param string $visibility
[ "Sets", "the", "given", "visibility", "to", "all", "accessors", "if", "they", "are", "not", "explicitly", "defined", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Annotation/Generate.php#L242-L261
27,722
techdivision/import-product
src/Observers/ProductInventoryObserver.php
ProductInventoryObserver.prepareStockItemAttributes
protected function prepareStockItemAttributes() { return array_merge($this->prepareAttributes(), $this->attributeLoader->load($this, $this->getHeaderStockMappings())); }
php
protected function prepareStockItemAttributes() { return array_merge($this->prepareAttributes(), $this->attributeLoader->load($this, $this->getHeaderStockMappings())); }
[ "protected", "function", "prepareStockItemAttributes", "(", ")", "{", "return", "array_merge", "(", "$", "this", "->", "prepareAttributes", "(", ")", ",", "$", "this", "->", "attributeLoader", "->", "load", "(", "$", "this", ",", "$", "this", "->", "getHeaderStockMappings", "(", ")", ")", ")", ";", "}" ]
Prepare the stock item attributes of the entity that has to be persisted. @return array The prepared stock status item
[ "Prepare", "the", "stock", "item", "attributes", "of", "the", "entity", "that", "has", "to", "be", "persisted", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/ProductInventoryObserver.php#L125-L128
27,723
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider.collectCommonData
public function collectCommonData() { /** @var OxpsPaymorrowSettings $oPmSettings */ $oPmSettings = oxNew( 'OxpsPaymorrowSettings' ); /** @var oxUser|OxpsPaymorrowOxUser $oUser */ $oUser = $this->getUser(); return array( 'merchantId' => $oPmSettings->getMerchantId(), 'mpiSignature' => $oPmSettings->getMpiSignature(), 'request_languageCode' => $oUser->getUserPaymorrowRequestLanguage(), 'request_id' => $this->getUniqueString(), ); }
php
public function collectCommonData() { /** @var OxpsPaymorrowSettings $oPmSettings */ $oPmSettings = oxNew( 'OxpsPaymorrowSettings' ); /** @var oxUser|OxpsPaymorrowOxUser $oUser */ $oUser = $this->getUser(); return array( 'merchantId' => $oPmSettings->getMerchantId(), 'mpiSignature' => $oPmSettings->getMpiSignature(), 'request_languageCode' => $oUser->getUserPaymorrowRequestLanguage(), 'request_id' => $this->getUniqueString(), ); }
[ "public", "function", "collectCommonData", "(", ")", "{", "/** @var OxpsPaymorrowSettings $oPmSettings */", "$", "oPmSettings", "=", "oxNew", "(", "'OxpsPaymorrowSettings'", ")", ";", "/** @var oxUser|OxpsPaymorrowOxUser $oUser */", "$", "oUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "return", "array", "(", "'merchantId'", "=>", "$", "oPmSettings", "->", "getMerchantId", "(", ")", ",", "'mpiSignature'", "=>", "$", "oPmSettings", "->", "getMpiSignature", "(", ")", ",", "'request_languageCode'", "=>", "$", "oUser", "->", "getUserPaymorrowRequestLanguage", "(", ")", ",", "'request_id'", "=>", "$", "this", "->", "getUniqueString", "(", ")", ",", ")", ";", "}" ]
Compiles an array with mandatory authentication data. @return array
[ "Compiles", "an", "array", "with", "mandatory", "authentication", "data", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L49-L63
27,724
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider.collectEshopData
public function collectEshopData( $blLogData = true ) { /** @var OxpsPaymorrowOxUser|oxUser $oUser */ $oUser = $this->getUser(); // If user does not exist return null if ( !$oUser->exists() ) { return null; } /** @var OxpsPaymorrowSettings $oPmSettings */ $oPmSettings = oxNew( 'OxpsPaymorrowSettings' ); // Mandatory authentication data $aData = $this->collectCommonData(); $aData['addressEditing_disabled'] = 'N'; $aData['order_id'] = $this->_getBasketAndSessionHash(); $aData['source'] = 'PAYMORROW_GATEWAY_JS'; $aData['operationMode'] = $oPmSettings->getPaymorrowOperationMode(); // Order data $aData = $this->_addOrderData( $aData, $oUser ); // User profile data $aData = $this->_addUserProfileData( $aData, $oUser ); // User shipping address data $aData = $this->_addUserShippingAddressData( $aData, $oUser ); // User order history data $aData = $this->_addOrderHistoryData( $aData, $oUser ); // Device and client data $aData = $this->_addDeviceAndClientData( $aData, $oUser ); if ( !empty( $blLogData ) ) { /** @var OxpsPaymorrowLogger $oLogger */ $oLogger = oxRegistry::get( 'OxpsPaymorrowLogger' ); $oLogger->logWithType( $aData, 'collectEshopData' ); } return $aData; }
php
public function collectEshopData( $blLogData = true ) { /** @var OxpsPaymorrowOxUser|oxUser $oUser */ $oUser = $this->getUser(); // If user does not exist return null if ( !$oUser->exists() ) { return null; } /** @var OxpsPaymorrowSettings $oPmSettings */ $oPmSettings = oxNew( 'OxpsPaymorrowSettings' ); // Mandatory authentication data $aData = $this->collectCommonData(); $aData['addressEditing_disabled'] = 'N'; $aData['order_id'] = $this->_getBasketAndSessionHash(); $aData['source'] = 'PAYMORROW_GATEWAY_JS'; $aData['operationMode'] = $oPmSettings->getPaymorrowOperationMode(); // Order data $aData = $this->_addOrderData( $aData, $oUser ); // User profile data $aData = $this->_addUserProfileData( $aData, $oUser ); // User shipping address data $aData = $this->_addUserShippingAddressData( $aData, $oUser ); // User order history data $aData = $this->_addOrderHistoryData( $aData, $oUser ); // Device and client data $aData = $this->_addDeviceAndClientData( $aData, $oUser ); if ( !empty( $blLogData ) ) { /** @var OxpsPaymorrowLogger $oLogger */ $oLogger = oxRegistry::get( 'OxpsPaymorrowLogger' ); $oLogger->logWithType( $aData, 'collectEshopData' ); } return $aData; }
[ "public", "function", "collectEshopData", "(", "$", "blLogData", "=", "true", ")", "{", "/** @var OxpsPaymorrowOxUser|oxUser $oUser */", "$", "oUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "// If user does not exist return null", "if", "(", "!", "$", "oUser", "->", "exists", "(", ")", ")", "{", "return", "null", ";", "}", "/** @var OxpsPaymorrowSettings $oPmSettings */", "$", "oPmSettings", "=", "oxNew", "(", "'OxpsPaymorrowSettings'", ")", ";", "// Mandatory authentication data", "$", "aData", "=", "$", "this", "->", "collectCommonData", "(", ")", ";", "$", "aData", "[", "'addressEditing_disabled'", "]", "=", "'N'", ";", "$", "aData", "[", "'order_id'", "]", "=", "$", "this", "->", "_getBasketAndSessionHash", "(", ")", ";", "$", "aData", "[", "'source'", "]", "=", "'PAYMORROW_GATEWAY_JS'", ";", "$", "aData", "[", "'operationMode'", "]", "=", "$", "oPmSettings", "->", "getPaymorrowOperationMode", "(", ")", ";", "// Order data", "$", "aData", "=", "$", "this", "->", "_addOrderData", "(", "$", "aData", ",", "$", "oUser", ")", ";", "// User profile data", "$", "aData", "=", "$", "this", "->", "_addUserProfileData", "(", "$", "aData", ",", "$", "oUser", ")", ";", "// User shipping address data", "$", "aData", "=", "$", "this", "->", "_addUserShippingAddressData", "(", "$", "aData", ",", "$", "oUser", ")", ";", "// User order history data", "$", "aData", "=", "$", "this", "->", "_addOrderHistoryData", "(", "$", "aData", ",", "$", "oUser", ")", ";", "// Device and client data", "$", "aData", "=", "$", "this", "->", "_addDeviceAndClientData", "(", "$", "aData", ",", "$", "oUser", ")", ";", "if", "(", "!", "empty", "(", "$", "blLogData", ")", ")", "{", "/** @var OxpsPaymorrowLogger $oLogger */", "$", "oLogger", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", ";", "$", "oLogger", "->", "logWithType", "(", "$", "aData", ",", "'collectEshopData'", ")", ";", "}", "return", "$", "aData", ";", "}" ]
Compiles an array with all user and order data to pass to Paymorrow. @param bool $blLogData @return array
[ "Compiles", "an", "array", "with", "all", "user", "and", "order", "data", "to", "pass", "to", "Paymorrow", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L72-L116
27,725
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider.collectConfirmData
public function collectConfirmData() { $aData = $this->collectEshopData(false); // Add transaction data from session $aData['pm_order_transaction_id'] = oxRegistry::get('OxpsPaymorrowModule')->getPaymentTransactionId(); $aData['order_id'] = oxRegistry::getSession()->getVariable('pm_order_id'); // Add verification data /** @var OxpsPaymorrowGateway $oGateway */ $oGateway = oxRegistry::get('OxpsOxid2Paymorrow')->getPaymorrowGateway(); $aData['verification_customer_email'] = $this->_findInArray($aData, 'customer_email'); $aData['verification_shippingHash'] = $oGateway->getAddressHash( array( 'lastName' => $this->_findInArray($aData, 'customer_lastName'), 'street' => $this->_findInArray($aData, 'customer_shippingAddress_street'), 'houseNo' => $this->_findInArray($aData, 'customer_shippingAddress_houseNo'), 'zip' => $this->_findInArray($aData, 'customer_shippingAddress_postalCode'), ) ); $aData['verification_billingHash'] = $oGateway->getAddressHash( array( 'lastName' => $this->_findInArray($aData, 'customer_lastName'), 'street' => $this->_findInArray($aData, 'customer_billingAddress_street'), 'houseNo' => $this->_findInArray($aData, 'customer_billingAddress_houseNo'), 'zip' => $this->_findInArray($aData, 'customer_billingAddress_postalCode'), ) ); $aData['verification_order_grossAmount'] = $this->_findInArray($aData, 'order_grossAmount'); /** @var OxpsPaymorrowLogger $oLogger */ $oLogger = oxRegistry::get('OxpsPaymorrowLogger'); $oLogger->logWithType($aData, 'collectConfirmData'); return $aData; }
php
public function collectConfirmData() { $aData = $this->collectEshopData(false); // Add transaction data from session $aData['pm_order_transaction_id'] = oxRegistry::get('OxpsPaymorrowModule')->getPaymentTransactionId(); $aData['order_id'] = oxRegistry::getSession()->getVariable('pm_order_id'); // Add verification data /** @var OxpsPaymorrowGateway $oGateway */ $oGateway = oxRegistry::get('OxpsOxid2Paymorrow')->getPaymorrowGateway(); $aData['verification_customer_email'] = $this->_findInArray($aData, 'customer_email'); $aData['verification_shippingHash'] = $oGateway->getAddressHash( array( 'lastName' => $this->_findInArray($aData, 'customer_lastName'), 'street' => $this->_findInArray($aData, 'customer_shippingAddress_street'), 'houseNo' => $this->_findInArray($aData, 'customer_shippingAddress_houseNo'), 'zip' => $this->_findInArray($aData, 'customer_shippingAddress_postalCode'), ) ); $aData['verification_billingHash'] = $oGateway->getAddressHash( array( 'lastName' => $this->_findInArray($aData, 'customer_lastName'), 'street' => $this->_findInArray($aData, 'customer_billingAddress_street'), 'houseNo' => $this->_findInArray($aData, 'customer_billingAddress_houseNo'), 'zip' => $this->_findInArray($aData, 'customer_billingAddress_postalCode'), ) ); $aData['verification_order_grossAmount'] = $this->_findInArray($aData, 'order_grossAmount'); /** @var OxpsPaymorrowLogger $oLogger */ $oLogger = oxRegistry::get('OxpsPaymorrowLogger'); $oLogger->logWithType($aData, 'collectConfirmData'); return $aData; }
[ "public", "function", "collectConfirmData", "(", ")", "{", "$", "aData", "=", "$", "this", "->", "collectEshopData", "(", "false", ")", ";", "// Add transaction data from session", "$", "aData", "[", "'pm_order_transaction_id'", "]", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowModule'", ")", "->", "getPaymentTransactionId", "(", ")", ";", "$", "aData", "[", "'order_id'", "]", "=", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'pm_order_id'", ")", ";", "// Add verification data", "/** @var OxpsPaymorrowGateway $oGateway */", "$", "oGateway", "=", "oxRegistry", "::", "get", "(", "'OxpsOxid2Paymorrow'", ")", "->", "getPaymorrowGateway", "(", ")", ";", "$", "aData", "[", "'verification_customer_email'", "]", "=", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_email'", ")", ";", "$", "aData", "[", "'verification_shippingHash'", "]", "=", "$", "oGateway", "->", "getAddressHash", "(", "array", "(", "'lastName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_lastName'", ")", ",", "'street'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_street'", ")", ",", "'houseNo'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_houseNo'", ")", ",", "'zip'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_postalCode'", ")", ",", ")", ")", ";", "$", "aData", "[", "'verification_billingHash'", "]", "=", "$", "oGateway", "->", "getAddressHash", "(", "array", "(", "'lastName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_lastName'", ")", ",", "'street'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_street'", ")", ",", "'houseNo'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_houseNo'", ")", ",", "'zip'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_postalCode'", ")", ",", ")", ")", ";", "$", "aData", "[", "'verification_order_grossAmount'", "]", "=", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'order_grossAmount'", ")", ";", "/** @var OxpsPaymorrowLogger $oLogger */", "$", "oLogger", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", ";", "$", "oLogger", "->", "logWithType", "(", "$", "aData", ",", "'collectConfirmData'", ")", ";", "return", "$", "aData", ";", "}" ]
Compiles an array with order confirmation data to pass to Paymorrow. @return array
[ "Compiles", "an", "array", "with", "order", "confirmation", "data", "to", "pass", "to", "Paymorrow", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L123-L159
27,726
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider.printPmData
public function printPmData() { $aData = $this->collectEshopData(); $aPrintData = array( 'phone' => $this->_findInArray( $aData, 'customer_phoneNumber' ), 'mobile' => $this->_findInArray( $aData, 'customer_mobileNumber' ), 'session_id' => $this->_findInArray( $aData, 'client_browser_session_id' ), 'cookie_id' => $this->_findInArray( $aData, 'client_cookies_id' ), 'firstName' => $this->_findInArray( $aData, 'customer_firstName' ), 'lastName' => $this->_findInArray( $aData, 'customer_lastName' ), 'dob' => $this->_findInArray( $aData, 'customer_dateOfBirth' ), 'gender' => $this->_findInArray( $aData, 'customer_gender' ), 'email' => $this->_findInArray( $aData, 'customer_email' ), 'street' => $this->_findInArray( $aData, 'customer_billingAddress_street' ), 'houseNumber' => $this->_findInArray( $aData, 'customer_billingAddress_houseNo' ), 'locality' => $this->_findInArray( $aData, 'customer_billingAddress_city' ), 'postalCode' => $this->_findInArray( $aData, 'customer_billingAddress_postalCode' ), 'country' => $this->_findInArray( $aData, 'customer_billingAddress_country' ), 'shippingStreet' => $this->_findInArray( $aData, 'customer_shippingAddress_street' ), 'shippingHouseNumber' => $this->_findInArray( $aData, 'customer_shippingAddress_houseNo' ), 'shippingLocality' => $this->_findInArray( $aData, 'customer_shippingAddress_city' ), 'shippingPostalCode' => $this->_findInArray( $aData, 'customer_shippingAddress_postalCode' ), 'shippingCountry' => $this->_findInArray( $aData, 'customer_shippingAddress_country' ), 'shippingFirstName' => $this->_findInArray( $aData, 'customer_shippingAddress_firstName' ), 'shippingLastName' => $this->_findInArray( $aData, 'customer_shippingAddress_lastName' ), 'orderAmount' => $this->_findInArray( $aData, 'order_grossAmount' ), 'langcode' => $this->_findInArray( $aData, 'request_languageCode' ), 'client_ip' => $this->_findInArray( $aData, 'client_ipAddress' ), 'currencyCode' => $this->_findInArray( $aData, 'order_currency' ), ); // Check if there are session fields set and add to print data if available $aSessionData = (array) oxRegistry::getSession()->getVariable( 'pm_init_data' ); if ( !empty( $aSessionData ) ) { $aPrintData = array_merge( $aPrintData, $aSessionData ); } return json_encode( $aPrintData ); }
php
public function printPmData() { $aData = $this->collectEshopData(); $aPrintData = array( 'phone' => $this->_findInArray( $aData, 'customer_phoneNumber' ), 'mobile' => $this->_findInArray( $aData, 'customer_mobileNumber' ), 'session_id' => $this->_findInArray( $aData, 'client_browser_session_id' ), 'cookie_id' => $this->_findInArray( $aData, 'client_cookies_id' ), 'firstName' => $this->_findInArray( $aData, 'customer_firstName' ), 'lastName' => $this->_findInArray( $aData, 'customer_lastName' ), 'dob' => $this->_findInArray( $aData, 'customer_dateOfBirth' ), 'gender' => $this->_findInArray( $aData, 'customer_gender' ), 'email' => $this->_findInArray( $aData, 'customer_email' ), 'street' => $this->_findInArray( $aData, 'customer_billingAddress_street' ), 'houseNumber' => $this->_findInArray( $aData, 'customer_billingAddress_houseNo' ), 'locality' => $this->_findInArray( $aData, 'customer_billingAddress_city' ), 'postalCode' => $this->_findInArray( $aData, 'customer_billingAddress_postalCode' ), 'country' => $this->_findInArray( $aData, 'customer_billingAddress_country' ), 'shippingStreet' => $this->_findInArray( $aData, 'customer_shippingAddress_street' ), 'shippingHouseNumber' => $this->_findInArray( $aData, 'customer_shippingAddress_houseNo' ), 'shippingLocality' => $this->_findInArray( $aData, 'customer_shippingAddress_city' ), 'shippingPostalCode' => $this->_findInArray( $aData, 'customer_shippingAddress_postalCode' ), 'shippingCountry' => $this->_findInArray( $aData, 'customer_shippingAddress_country' ), 'shippingFirstName' => $this->_findInArray( $aData, 'customer_shippingAddress_firstName' ), 'shippingLastName' => $this->_findInArray( $aData, 'customer_shippingAddress_lastName' ), 'orderAmount' => $this->_findInArray( $aData, 'order_grossAmount' ), 'langcode' => $this->_findInArray( $aData, 'request_languageCode' ), 'client_ip' => $this->_findInArray( $aData, 'client_ipAddress' ), 'currencyCode' => $this->_findInArray( $aData, 'order_currency' ), ); // Check if there are session fields set and add to print data if available $aSessionData = (array) oxRegistry::getSession()->getVariable( 'pm_init_data' ); if ( !empty( $aSessionData ) ) { $aPrintData = array_merge( $aPrintData, $aSessionData ); } return json_encode( $aPrintData ); }
[ "public", "function", "printPmData", "(", ")", "{", "$", "aData", "=", "$", "this", "->", "collectEshopData", "(", ")", ";", "$", "aPrintData", "=", "array", "(", "'phone'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_phoneNumber'", ")", ",", "'mobile'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_mobileNumber'", ")", ",", "'session_id'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'client_browser_session_id'", ")", ",", "'cookie_id'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'client_cookies_id'", ")", ",", "'firstName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_firstName'", ")", ",", "'lastName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_lastName'", ")", ",", "'dob'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_dateOfBirth'", ")", ",", "'gender'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_gender'", ")", ",", "'email'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_email'", ")", ",", "'street'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_street'", ")", ",", "'houseNumber'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_houseNo'", ")", ",", "'locality'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_city'", ")", ",", "'postalCode'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_postalCode'", ")", ",", "'country'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_billingAddress_country'", ")", ",", "'shippingStreet'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_street'", ")", ",", "'shippingHouseNumber'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_houseNo'", ")", ",", "'shippingLocality'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_city'", ")", ",", "'shippingPostalCode'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_postalCode'", ")", ",", "'shippingCountry'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_country'", ")", ",", "'shippingFirstName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_firstName'", ")", ",", "'shippingLastName'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'customer_shippingAddress_lastName'", ")", ",", "'orderAmount'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'order_grossAmount'", ")", ",", "'langcode'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'request_languageCode'", ")", ",", "'client_ip'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'client_ipAddress'", ")", ",", "'currencyCode'", "=>", "$", "this", "->", "_findInArray", "(", "$", "aData", ",", "'order_currency'", ")", ",", ")", ";", "// Check if there are session fields set and add to print data if available", "$", "aSessionData", "=", "(", "array", ")", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'pm_init_data'", ")", ";", "if", "(", "!", "empty", "(", "$", "aSessionData", ")", ")", "{", "$", "aPrintData", "=", "array_merge", "(", "$", "aPrintData", ",", "$", "aSessionData", ")", ";", "}", "return", "json_encode", "(", "$", "aPrintData", ")", ";", "}" ]
Get user data for the payment form initialization in JSON format. @return string
[ "Get", "user", "data", "for", "the", "payment", "form", "initialization", "in", "JSON", "format", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L167-L206
27,727
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider.toUtf
public static function toUtf( $sSting, $mLimitLength = null ) { if ( !oxRegistry::getConfig()->getConfigParam( 'iUtfMode' ) ) { $sSting = iconv( 'ISO-8859-15', 'UTF-8', $sSting ); } if ( is_integer( $mLimitLength ) and $mLimitLength > 0 ) { $sSting = mb_substr( $sSting, 0, $mLimitLength, 'UTF-8' ); } return $sSting; }
php
public static function toUtf( $sSting, $mLimitLength = null ) { if ( !oxRegistry::getConfig()->getConfigParam( 'iUtfMode' ) ) { $sSting = iconv( 'ISO-8859-15', 'UTF-8', $sSting ); } if ( is_integer( $mLimitLength ) and $mLimitLength > 0 ) { $sSting = mb_substr( $sSting, 0, $mLimitLength, 'UTF-8' ); } return $sSting; }
[ "public", "static", "function", "toUtf", "(", "$", "sSting", ",", "$", "mLimitLength", "=", "null", ")", "{", "if", "(", "!", "oxRegistry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(", "'iUtfMode'", ")", ")", "{", "$", "sSting", "=", "iconv", "(", "'ISO-8859-15'", ",", "'UTF-8'", ",", "$", "sSting", ")", ";", "}", "if", "(", "is_integer", "(", "$", "mLimitLength", ")", "and", "$", "mLimitLength", ">", "0", ")", "{", "$", "sSting", "=", "mb_substr", "(", "$", "sSting", ",", "0", ",", "$", "mLimitLength", ",", "'UTF-8'", ")", ";", "}", "return", "$", "sSting", ";", "}" ]
Convert default OXID encoding ISO-8859-15 to UTF-8. Additionally it checks if shop it not on UTF-8 encoding already. Optionally crops string to fit provided length. @codeCoverageIgnore @param string $sSting @param null|int $mLimitLength @return string
[ "Convert", "default", "OXID", "encoding", "ISO", "-", "8859", "-", "15", "to", "UTF", "-", "8", ".", "Additionally", "it", "checks", "if", "shop", "it", "not", "on", "UTF", "-", "8", "encoding", "already", ".", "Optionally", "crops", "string", "to", "fit", "provided", "length", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L233-L244
27,728
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._findInArray
protected function _findInArray( array $aData, $mKey, $sDefault = '' ) { $sVal = $sDefault; if ( array_key_exists( $mKey, $aData ) and is_scalar( $aData[$mKey] ) ) { $sVal = trim( (string) $aData[$mKey] ); } return $sVal; }
php
protected function _findInArray( array $aData, $mKey, $sDefault = '' ) { $sVal = $sDefault; if ( array_key_exists( $mKey, $aData ) and is_scalar( $aData[$mKey] ) ) { $sVal = trim( (string) $aData[$mKey] ); } return $sVal; }
[ "protected", "function", "_findInArray", "(", "array", "$", "aData", ",", "$", "mKey", ",", "$", "sDefault", "=", "''", ")", "{", "$", "sVal", "=", "$", "sDefault", ";", "if", "(", "array_key_exists", "(", "$", "mKey", ",", "$", "aData", ")", "and", "is_scalar", "(", "$", "aData", "[", "$", "mKey", "]", ")", ")", "{", "$", "sVal", "=", "trim", "(", "(", "string", ")", "$", "aData", "[", "$", "mKey", "]", ")", ";", "}", "return", "$", "sVal", ";", "}" ]
Get array value by key. @param array $aData @param mixed $mKey @param mixed $sDefault @return string
[ "Get", "array", "value", "by", "key", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L256-L265
27,729
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._getBrowserHeaders
protected function _getBrowserHeaders() { $sHeaders = ''; $aHeaders = apache_request_headers(); foreach ( $aHeaders as $sHeader => $sValue ) { $sHeaders .= " $sHeader: $sValue\n"; } return base64_encode( $sHeaders ); }
php
protected function _getBrowserHeaders() { $sHeaders = ''; $aHeaders = apache_request_headers(); foreach ( $aHeaders as $sHeader => $sValue ) { $sHeaders .= " $sHeader: $sValue\n"; } return base64_encode( $sHeaders ); }
[ "protected", "function", "_getBrowserHeaders", "(", ")", "{", "$", "sHeaders", "=", "''", ";", "$", "aHeaders", "=", "apache_request_headers", "(", ")", ";", "foreach", "(", "$", "aHeaders", "as", "$", "sHeader", "=>", "$", "sValue", ")", "{", "$", "sHeaders", ".=", "\" $sHeader: $sValue\\n\"", ";", "}", "return", "base64_encode", "(", "$", "sHeaders", ")", ";", "}" ]
Get request headers string. @codeCoverageIgnore @return string
[ "Get", "request", "headers", "string", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L274-L284
27,730
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._getBasketAndSessionHash
protected function _getBasketAndSessionHash() { $oSession = oxRegistry::getSession(); $oBasket = $oSession->getBasket(); return md5( $oSession->getId() . serialize( $oBasket ) . $this->getUniqueString( self::OXPS_PAYMORROW_ORDER_HASH_SALT ) ); }
php
protected function _getBasketAndSessionHash() { $oSession = oxRegistry::getSession(); $oBasket = $oSession->getBasket(); return md5( $oSession->getId() . serialize( $oBasket ) . $this->getUniqueString( self::OXPS_PAYMORROW_ORDER_HASH_SALT ) ); }
[ "protected", "function", "_getBasketAndSessionHash", "(", ")", "{", "$", "oSession", "=", "oxRegistry", "::", "getSession", "(", ")", ";", "$", "oBasket", "=", "$", "oSession", "->", "getBasket", "(", ")", ";", "return", "md5", "(", "$", "oSession", "->", "getId", "(", ")", ".", "serialize", "(", "$", "oBasket", ")", ".", "$", "this", "->", "getUniqueString", "(", "self", "::", "OXPS_PAYMORROW_ORDER_HASH_SALT", ")", ")", ";", "}" ]
Compiles a hash string to identify a basket in current session. Used as temporary order ID. @return string
[ "Compiles", "a", "hash", "string", "to", "identify", "a", "basket", "in", "current", "session", ".", "Used", "as", "temporary", "order", "ID", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L292-L301
27,731
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._addOrderData
protected function _addOrderData( array $aData, oxUser $oUser ) { /** @var OxpsPaymorrowOxBasket|oxBasket $oBasket */ $oBasket = $oUser->getUserPaymorrowUserBasketFromSession(); // Common order fields $aData['order_grossAmount'] = (double) $oBasket->getPaymorrowTotalAmount(); $aData['order_vatAmount'] = (double) $oBasket->getPaymorrowTotalVatAmount(); $aData['order_currency'] = self::toUtf( $oBasket->getPaymorrowBasketCurrency() ); // Summarized line items array: products, costs, vouchers $aData = array_merge( $aData, $oBasket->getPaymorrowBasketLineItems() ); return $aData; }
php
protected function _addOrderData( array $aData, oxUser $oUser ) { /** @var OxpsPaymorrowOxBasket|oxBasket $oBasket */ $oBasket = $oUser->getUserPaymorrowUserBasketFromSession(); // Common order fields $aData['order_grossAmount'] = (double) $oBasket->getPaymorrowTotalAmount(); $aData['order_vatAmount'] = (double) $oBasket->getPaymorrowTotalVatAmount(); $aData['order_currency'] = self::toUtf( $oBasket->getPaymorrowBasketCurrency() ); // Summarized line items array: products, costs, vouchers $aData = array_merge( $aData, $oBasket->getPaymorrowBasketLineItems() ); return $aData; }
[ "protected", "function", "_addOrderData", "(", "array", "$", "aData", ",", "oxUser", "$", "oUser", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $oBasket */", "$", "oBasket", "=", "$", "oUser", "->", "getUserPaymorrowUserBasketFromSession", "(", ")", ";", "// Common order fields", "$", "aData", "[", "'order_grossAmount'", "]", "=", "(", "double", ")", "$", "oBasket", "->", "getPaymorrowTotalAmount", "(", ")", ";", "$", "aData", "[", "'order_vatAmount'", "]", "=", "(", "double", ")", "$", "oBasket", "->", "getPaymorrowTotalVatAmount", "(", ")", ";", "$", "aData", "[", "'order_currency'", "]", "=", "self", "::", "toUtf", "(", "$", "oBasket", "->", "getPaymorrowBasketCurrency", "(", ")", ")", ";", "// Summarized line items array: products, costs, vouchers", "$", "aData", "=", "array_merge", "(", "$", "aData", ",", "$", "oBasket", "->", "getPaymorrowBasketLineItems", "(", ")", ")", ";", "return", "$", "aData", ";", "}" ]
Add order related data to array. @param array $aData @param OxpsPaymorrowOxUser|oxUser $oUser @return array
[ "Add", "order", "related", "data", "to", "array", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L312-L326
27,732
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._addOrderHistoryData
protected function _addOrderHistoryData( array $aData, oxUser $oUser ) { /** @var oxList $oOrdersList */ $oOrdersList = $oUser->getOrders( 10 ); if ( empty( $oOrdersList ) or !$oOrdersList->count() ) { return $aData; } $sFieldPrefix = 'customer_history_%d_%s'; $iItemNumber = 1; foreach ( $oOrdersList as $oOrder ) { /** @var OxpsPaymorrowOxOrder|oxOrder $oOrder */ $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderDate' )] = $oOrder->getOrderDate(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'totalAmount' )] = $oOrder->getTotalOrderSum(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'paymentMethod' )] = $oOrder->getPaymentMethodName(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderStatus' )] = $oOrder->getOrderStatus(); $iItemNumber++; } return $aData; }
php
protected function _addOrderHistoryData( array $aData, oxUser $oUser ) { /** @var oxList $oOrdersList */ $oOrdersList = $oUser->getOrders( 10 ); if ( empty( $oOrdersList ) or !$oOrdersList->count() ) { return $aData; } $sFieldPrefix = 'customer_history_%d_%s'; $iItemNumber = 1; foreach ( $oOrdersList as $oOrder ) { /** @var OxpsPaymorrowOxOrder|oxOrder $oOrder */ $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderDate' )] = $oOrder->getOrderDate(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'totalAmount' )] = $oOrder->getTotalOrderSum(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'paymentMethod' )] = $oOrder->getPaymentMethodName(); $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderStatus' )] = $oOrder->getOrderStatus(); $iItemNumber++; } return $aData; }
[ "protected", "function", "_addOrderHistoryData", "(", "array", "$", "aData", ",", "oxUser", "$", "oUser", ")", "{", "/** @var oxList $oOrdersList */", "$", "oOrdersList", "=", "$", "oUser", "->", "getOrders", "(", "10", ")", ";", "if", "(", "empty", "(", "$", "oOrdersList", ")", "or", "!", "$", "oOrdersList", "->", "count", "(", ")", ")", "{", "return", "$", "aData", ";", "}", "$", "sFieldPrefix", "=", "'customer_history_%d_%s'", ";", "$", "iItemNumber", "=", "1", ";", "foreach", "(", "$", "oOrdersList", "as", "$", "oOrder", ")", "{", "/** @var OxpsPaymorrowOxOrder|oxOrder $oOrder */", "$", "aData", "[", "sprintf", "(", "$", "sFieldPrefix", ",", "$", "iItemNumber", ",", "'orderDate'", ")", "]", "=", "$", "oOrder", "->", "getOrderDate", "(", ")", ";", "$", "aData", "[", "sprintf", "(", "$", "sFieldPrefix", ",", "$", "iItemNumber", ",", "'totalAmount'", ")", "]", "=", "$", "oOrder", "->", "getTotalOrderSum", "(", ")", ";", "$", "aData", "[", "sprintf", "(", "$", "sFieldPrefix", ",", "$", "iItemNumber", ",", "'paymentMethod'", ")", "]", "=", "$", "oOrder", "->", "getPaymentMethodName", "(", ")", ";", "$", "aData", "[", "sprintf", "(", "$", "sFieldPrefix", ",", "$", "iItemNumber", ",", "'orderStatus'", ")", "]", "=", "$", "oOrder", "->", "getOrderStatus", "(", ")", ";", "$", "iItemNumber", "++", ";", "}", "return", "$", "aData", ";", "}" ]
Add user order history data. Maximum 10 last orders fields are added. @param array $aData @param oxUser $oUser @return array
[ "Add", "user", "order", "history", "data", ".", "Maximum", "10", "last", "orders", "fields", "are", "added", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L416-L440
27,733
OXID-eSales/paymorrow-module
core/oxpspaymorroweshopdataprovider.php
OxpsPaymorrowEshopDataProvider._addDeviceAndClientData
protected function _addDeviceAndClientData( array $aData, oxUser $oUser ) { $oSession = oxRegistry::getSession(); $sSessionId = $oSession->getId(); $aData['device_checkId'] = $sSessionId; $aData['client_browser_session_id'] = $sSessionId; $aData['client_cookies_id'] = $sSessionId; $aData['client_ipAddress'] = $oUser->getUserPaymorrowIpAddress(); $aData['client_browser_header'] = $this->_getBrowserHeaders(); return $aData; }
php
protected function _addDeviceAndClientData( array $aData, oxUser $oUser ) { $oSession = oxRegistry::getSession(); $sSessionId = $oSession->getId(); $aData['device_checkId'] = $sSessionId; $aData['client_browser_session_id'] = $sSessionId; $aData['client_cookies_id'] = $sSessionId; $aData['client_ipAddress'] = $oUser->getUserPaymorrowIpAddress(); $aData['client_browser_header'] = $this->_getBrowserHeaders(); return $aData; }
[ "protected", "function", "_addDeviceAndClientData", "(", "array", "$", "aData", ",", "oxUser", "$", "oUser", ")", "{", "$", "oSession", "=", "oxRegistry", "::", "getSession", "(", ")", ";", "$", "sSessionId", "=", "$", "oSession", "->", "getId", "(", ")", ";", "$", "aData", "[", "'device_checkId'", "]", "=", "$", "sSessionId", ";", "$", "aData", "[", "'client_browser_session_id'", "]", "=", "$", "sSessionId", ";", "$", "aData", "[", "'client_cookies_id'", "]", "=", "$", "sSessionId", ";", "$", "aData", "[", "'client_ipAddress'", "]", "=", "$", "oUser", "->", "getUserPaymorrowIpAddress", "(", ")", ";", "$", "aData", "[", "'client_browser_header'", "]", "=", "$", "this", "->", "_getBrowserHeaders", "(", ")", ";", "return", "$", "aData", ";", "}" ]
Add device and user client data. @param array $aData @param OxpsPaymorrowOxUser|oxUser $oUser @return array
[ "Add", "device", "and", "user", "client", "data", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorroweshopdataprovider.php#L450-L462
27,734
OXID-eSales/paymorrow-module
controllers/oxpspaymorroworder.php
OxpsPaymorrowOrder._updatePaymentDescription
protected function _updatePaymentDescription(oxPayment $oxPayment) { $oLang = oxRegistry::getLang(); if ($oxPayment->getPaymorrowPaymentType() == 'pm_invoice') { $oxPayment->oxpayments__oxdesc = new oxField( $oLang->translateString('PAYMORROW_PAYMENT_METHOD_NAME_INVOICE') ); } elseif ($oxPayment->getPaymorrowPaymentType() == 'pm_sdd') { $oxPayment->oxpayments__oxdesc = new oxField( $oLang->translateString('PAYMORROW_PAYMENT_METHOD_NAME_DIRECT_DEBIT') ); } $this->_oPayment = $oxPayment; }
php
protected function _updatePaymentDescription(oxPayment $oxPayment) { $oLang = oxRegistry::getLang(); if ($oxPayment->getPaymorrowPaymentType() == 'pm_invoice') { $oxPayment->oxpayments__oxdesc = new oxField( $oLang->translateString('PAYMORROW_PAYMENT_METHOD_NAME_INVOICE') ); } elseif ($oxPayment->getPaymorrowPaymentType() == 'pm_sdd') { $oxPayment->oxpayments__oxdesc = new oxField( $oLang->translateString('PAYMORROW_PAYMENT_METHOD_NAME_DIRECT_DEBIT') ); } $this->_oPayment = $oxPayment; }
[ "protected", "function", "_updatePaymentDescription", "(", "oxPayment", "$", "oxPayment", ")", "{", "$", "oLang", "=", "oxRegistry", "::", "getLang", "(", ")", ";", "if", "(", "$", "oxPayment", "->", "getPaymorrowPaymentType", "(", ")", "==", "'pm_invoice'", ")", "{", "$", "oxPayment", "->", "oxpayments__oxdesc", "=", "new", "oxField", "(", "$", "oLang", "->", "translateString", "(", "'PAYMORROW_PAYMENT_METHOD_NAME_INVOICE'", ")", ")", ";", "}", "elseif", "(", "$", "oxPayment", "->", "getPaymorrowPaymentType", "(", ")", "==", "'pm_sdd'", ")", "{", "$", "oxPayment", "->", "oxpayments__oxdesc", "=", "new", "oxField", "(", "$", "oLang", "->", "translateString", "(", "'PAYMORROW_PAYMENT_METHOD_NAME_DIRECT_DEBIT'", ")", ")", ";", "}", "$", "this", "->", "_oPayment", "=", "$", "oxPayment", ";", "}" ]
Update payment model description fields with custom translations and set the payment. @param OxpsPaymorrowOxPayment|oxPayment $oxPayment
[ "Update", "payment", "model", "description", "fields", "with", "custom", "translations", "and", "set", "the", "payment", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorroworder.php#L74-L89
27,735
OXID-eSales/paymorrow-module
controllers/oxpspaymorroworder.php
OxpsPaymorrowOrder._getNextStep
protected function _getNextStep( $iSuccess ) { /** @var OxpsPaymorrowResponseHandler $oPmResponseHandler */ $oPmResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); /** * If after validating confirmOrder against Paymorrow services there are errors, * return to order step and render error message */ if ( $oPmResponseHandler->hasErrors() ) { $iErrorCode = $oPmResponseHandler->getErrorCode(); /** @var OxpsPaymorrowErrorHandler $oPmErrorHandler */ $oPmErrorHandler = oxNew( 'OxpsPaymorrowErrorHandler' ); $oPmErrorHandler->redirectWithError( $iErrorCode ); } /** * At this step assuming everything went fine * we need to delete SESSION variables created by Paymorrow * to avoid any incompatibilities if user has decided to * order again * * @doc: oxid_js_plugin.doc - 7.1 Controlling of customer’s browser session storage * * sess_challenge is deleted by `ThankYou` controller */ $oSession = oxRegistry::getSession(); $oSession->deleteVariable('pm_verify'); $oSession->deleteVariable('pm_response'); $oSession->deleteVariable('pm_responseINVOICE'); $oSession->deleteVariable('pm_responseSDD'); $oSession->deleteVariable('pm_order_transaction_id'); $oSession->deleteVariable('pm_order_transaction_idINVOICE'); $oSession->deleteVariable('pm_order_transaction_idSDD'); // Set payment method error instead of shipping method error if ( $iSuccess == 4 ) { $iSuccess = 5; } return $this->_OxpsPaymorrowOrder_getNextStep_parent( $iSuccess ); }
php
protected function _getNextStep( $iSuccess ) { /** @var OxpsPaymorrowResponseHandler $oPmResponseHandler */ $oPmResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); /** * If after validating confirmOrder against Paymorrow services there are errors, * return to order step and render error message */ if ( $oPmResponseHandler->hasErrors() ) { $iErrorCode = $oPmResponseHandler->getErrorCode(); /** @var OxpsPaymorrowErrorHandler $oPmErrorHandler */ $oPmErrorHandler = oxNew( 'OxpsPaymorrowErrorHandler' ); $oPmErrorHandler->redirectWithError( $iErrorCode ); } /** * At this step assuming everything went fine * we need to delete SESSION variables created by Paymorrow * to avoid any incompatibilities if user has decided to * order again * * @doc: oxid_js_plugin.doc - 7.1 Controlling of customer’s browser session storage * * sess_challenge is deleted by `ThankYou` controller */ $oSession = oxRegistry::getSession(); $oSession->deleteVariable('pm_verify'); $oSession->deleteVariable('pm_response'); $oSession->deleteVariable('pm_responseINVOICE'); $oSession->deleteVariable('pm_responseSDD'); $oSession->deleteVariable('pm_order_transaction_id'); $oSession->deleteVariable('pm_order_transaction_idINVOICE'); $oSession->deleteVariable('pm_order_transaction_idSDD'); // Set payment method error instead of shipping method error if ( $iSuccess == 4 ) { $iSuccess = 5; } return $this->_OxpsPaymorrowOrder_getNextStep_parent( $iSuccess ); }
[ "protected", "function", "_getNextStep", "(", "$", "iSuccess", ")", "{", "/** @var OxpsPaymorrowResponseHandler $oPmResponseHandler */", "$", "oPmResponseHandler", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowResponseHandler'", ")", ";", "/**\n * If after validating confirmOrder against Paymorrow services there are errors,\n * return to order step and render error message\n */", "if", "(", "$", "oPmResponseHandler", "->", "hasErrors", "(", ")", ")", "{", "$", "iErrorCode", "=", "$", "oPmResponseHandler", "->", "getErrorCode", "(", ")", ";", "/** @var OxpsPaymorrowErrorHandler $oPmErrorHandler */", "$", "oPmErrorHandler", "=", "oxNew", "(", "'OxpsPaymorrowErrorHandler'", ")", ";", "$", "oPmErrorHandler", "->", "redirectWithError", "(", "$", "iErrorCode", ")", ";", "}", "/**\n * At this step assuming everything went fine\n * we need to delete SESSION variables created by Paymorrow\n * to avoid any incompatibilities if user has decided to\n * order again\n *\n * @doc: oxid_js_plugin.doc - 7.1 Controlling of customer’s browser session storage\n *\n * sess_challenge is deleted by `ThankYou` controller\n */", "$", "oSession", "=", "oxRegistry", "::", "getSession", "(", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_verify'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_response'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_responseINVOICE'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_responseSDD'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_order_transaction_id'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_order_transaction_idINVOICE'", ")", ";", "$", "oSession", "->", "deleteVariable", "(", "'pm_order_transaction_idSDD'", ")", ";", "// Set payment method error instead of shipping method error", "if", "(", "$", "iSuccess", "==", "4", ")", "{", "$", "iSuccess", "=", "5", ";", "}", "return", "$", "this", "->", "_OxpsPaymorrowOrder_getNextStep_parent", "(", "$", "iSuccess", ")", ";", "}" ]
Overridden for Paymorrow Services validation @param $iSuccess @return string
[ "Overridden", "for", "Paymorrow", "Services", "validation" ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorroworder.php#L98-L141
27,736
OXID-eSales/paymorrow-module
controllers/oxpspaymorroworder.php
OxpsPaymorrowOrder._checkForErrorsToRedirect
protected function _checkForErrorsToRedirect() { if ( oxRegistry::getSession()->getVariable( 'pm_init_data' ) ) { $sUrl = oxRegistry::getConfig()->getShopCurrentUrl() . "cl=payment"; $sUrl = oxRegistry::get( "oxUtilsUrl" )->processUrl( $sUrl ); oxRegistry::getUtils()->redirect( $sUrl, false ); } }
php
protected function _checkForErrorsToRedirect() { if ( oxRegistry::getSession()->getVariable( 'pm_init_data' ) ) { $sUrl = oxRegistry::getConfig()->getShopCurrentUrl() . "cl=payment"; $sUrl = oxRegistry::get( "oxUtilsUrl" )->processUrl( $sUrl ); oxRegistry::getUtils()->redirect( $sUrl, false ); } }
[ "protected", "function", "_checkForErrorsToRedirect", "(", ")", "{", "if", "(", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'pm_init_data'", ")", ")", "{", "$", "sUrl", "=", "oxRegistry", "::", "getConfig", "(", ")", "->", "getShopCurrentUrl", "(", ")", ".", "\"cl=payment\"", ";", "$", "sUrl", "=", "oxRegistry", "::", "get", "(", "\"oxUtilsUrl\"", ")", "->", "processUrl", "(", "$", "sUrl", ")", ";", "oxRegistry", "::", "getUtils", "(", ")", "->", "redirect", "(", "$", "sUrl", ",", "false", ")", ";", "}", "}" ]
Check session for init error and redirect to payment step is any found. The error or order declination entries are set during order confirmation. This data is used on payment step ho inform user and handle payment forms and it is always unset there. @codeCoverageIgnore
[ "Check", "session", "for", "init", "error", "and", "redirect", "to", "payment", "step", "is", "any", "found", ".", "The", "error", "or", "order", "declination", "entries", "are", "set", "during", "order", "confirmation", ".", "This", "data", "is", "used", "on", "payment", "step", "ho", "inform", "user", "and", "handle", "payment", "forms", "and", "it", "is", "always", "unset", "there", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorroworder.php#L150-L158
27,737
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/DoctrineAnnotationProcessor.php
DoctrineAnnotationProcessor.processBidirectional
private function processBidirectional($annotation, PropertyInformation $information): void { // Parse the mappedBy and inversedBy columns, there is no nice interface // on them so we have to check for existence of the property. if (property_exists($annotation, 'inversedBy') && $annotation->inversedBy) { $information->setReferencedProperty($annotation->inversedBy); } elseif (property_exists($annotation, 'mappedBy') && $annotation->mappedBy) { $information->setReferencedProperty($annotation->mappedBy); } if ($annotation instanceof ManyToOne || $annotation instanceof ManyToMany) { $information->setReferencingCollection(true); } // Set default value for nullable. if ($information->isNullable() === null) { $information->setNullable((new JoinColumn())->nullable); } // Set field name for index on this collection. if (!property_exists($annotation, 'indexBy') || !$annotation->indexBy) { return; } $information->setIndex($annotation->indexBy); }
php
private function processBidirectional($annotation, PropertyInformation $information): void { // Parse the mappedBy and inversedBy columns, there is no nice interface // on them so we have to check for existence of the property. if (property_exists($annotation, 'inversedBy') && $annotation->inversedBy) { $information->setReferencedProperty($annotation->inversedBy); } elseif (property_exists($annotation, 'mappedBy') && $annotation->mappedBy) { $information->setReferencedProperty($annotation->mappedBy); } if ($annotation instanceof ManyToOne || $annotation instanceof ManyToMany) { $information->setReferencingCollection(true); } // Set default value for nullable. if ($information->isNullable() === null) { $information->setNullable((new JoinColumn())->nullable); } // Set field name for index on this collection. if (!property_exists($annotation, 'indexBy') || !$annotation->indexBy) { return; } $information->setIndex($annotation->indexBy); }
[ "private", "function", "processBidirectional", "(", "$", "annotation", ",", "PropertyInformation", "$", "information", ")", ":", "void", "{", "// Parse the mappedBy and inversedBy columns, there is no nice interface", "// on them so we have to check for existence of the property.", "if", "(", "property_exists", "(", "$", "annotation", ",", "'inversedBy'", ")", "&&", "$", "annotation", "->", "inversedBy", ")", "{", "$", "information", "->", "setReferencedProperty", "(", "$", "annotation", "->", "inversedBy", ")", ";", "}", "elseif", "(", "property_exists", "(", "$", "annotation", ",", "'mappedBy'", ")", "&&", "$", "annotation", "->", "mappedBy", ")", "{", "$", "information", "->", "setReferencedProperty", "(", "$", "annotation", "->", "mappedBy", ")", ";", "}", "if", "(", "$", "annotation", "instanceof", "ManyToOne", "||", "$", "annotation", "instanceof", "ManyToMany", ")", "{", "$", "information", "->", "setReferencingCollection", "(", "true", ")", ";", "}", "// Set default value for nullable.", "if", "(", "$", "information", "->", "isNullable", "(", ")", "===", "null", ")", "{", "$", "information", "->", "setNullable", "(", "(", "new", "JoinColumn", "(", ")", ")", "->", "nullable", ")", ";", "}", "// Set field name for index on this collection.", "if", "(", "!", "property_exists", "(", "$", "annotation", ",", "'indexBy'", ")", "||", "!", "$", "annotation", "->", "indexBy", ")", "{", "return", ";", "}", "$", "information", "->", "setIndex", "(", "$", "annotation", "->", "indexBy", ")", ";", "}" ]
Return referenced entity if we have a bidirectional doctrine association. @throws \DomainException @throws \InvalidArgumentException @param mixed $annotation with annotation Annotation @param PropertyInformation $information
[ "Return", "referenced", "entity", "if", "we", "have", "a", "bidirectional", "doctrine", "association", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/DoctrineAnnotationProcessor.php#L114-L139
27,738
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/DoctrineAnnotationProcessor.php
DoctrineAnnotationProcessor.processColumn
protected function processColumn(Column $column, PropertyInformation $information): void { $information->setType($this->transformType($column->type)); $information->setFixedPointNumber(strtolower($column->type) === Type::DECIMAL); $information->setLength($column->length ?: 0); $information->setPrecision($column->precision); $information->setScale($column->scale); $information->setUnique($column->unique !== false); $information->setNullable($column->nullable !== false || \in_array($column->type, self::NULLABLE_TYPES, true)); $information->setIntegerSize($this->getIntegerSizeForType($column->type)); if ($information->isFixedPointNumber() && $information->getPrecision() === 0 && $information->getScale() === 0 ) { throw new InvalidColumnSettingsException( sprintf( 'Decimal type of "%s::%s" has scale and precision set to 0 or not set at all.' . PHP_EOL . 'Usage: e.g. @ORM\Column(type="decimal", precision=2, scale=4).' . PHP_EOL . '"The precision represents the number of digits that are stored for values,' . PHP_EOL . ' and the scale represents the number of digits that can be stored' . PHP_EOL . ' following the decimal point".', $information->getClass(), $information->getName() ) ); } }
php
protected function processColumn(Column $column, PropertyInformation $information): void { $information->setType($this->transformType($column->type)); $information->setFixedPointNumber(strtolower($column->type) === Type::DECIMAL); $information->setLength($column->length ?: 0); $information->setPrecision($column->precision); $information->setScale($column->scale); $information->setUnique($column->unique !== false); $information->setNullable($column->nullable !== false || \in_array($column->type, self::NULLABLE_TYPES, true)); $information->setIntegerSize($this->getIntegerSizeForType($column->type)); if ($information->isFixedPointNumber() && $information->getPrecision() === 0 && $information->getScale() === 0 ) { throw new InvalidColumnSettingsException( sprintf( 'Decimal type of "%s::%s" has scale and precision set to 0 or not set at all.' . PHP_EOL . 'Usage: e.g. @ORM\Column(type="decimal", precision=2, scale=4).' . PHP_EOL . '"The precision represents the number of digits that are stored for values,' . PHP_EOL . ' and the scale represents the number of digits that can be stored' . PHP_EOL . ' following the decimal point".', $information->getClass(), $information->getName() ) ); } }
[ "protected", "function", "processColumn", "(", "Column", "$", "column", ",", "PropertyInformation", "$", "information", ")", ":", "void", "{", "$", "information", "->", "setType", "(", "$", "this", "->", "transformType", "(", "$", "column", "->", "type", ")", ")", ";", "$", "information", "->", "setFixedPointNumber", "(", "strtolower", "(", "$", "column", "->", "type", ")", "===", "Type", "::", "DECIMAL", ")", ";", "$", "information", "->", "setLength", "(", "$", "column", "->", "length", "?", ":", "0", ")", ";", "$", "information", "->", "setPrecision", "(", "$", "column", "->", "precision", ")", ";", "$", "information", "->", "setScale", "(", "$", "column", "->", "scale", ")", ";", "$", "information", "->", "setUnique", "(", "$", "column", "->", "unique", "!==", "false", ")", ";", "$", "information", "->", "setNullable", "(", "$", "column", "->", "nullable", "!==", "false", "||", "\\", "in_array", "(", "$", "column", "->", "type", ",", "self", "::", "NULLABLE_TYPES", ",", "true", ")", ")", ";", "$", "information", "->", "setIntegerSize", "(", "$", "this", "->", "getIntegerSizeForType", "(", "$", "column", "->", "type", ")", ")", ";", "if", "(", "$", "information", "->", "isFixedPointNumber", "(", ")", "&&", "$", "information", "->", "getPrecision", "(", ")", "===", "0", "&&", "$", "information", "->", "getScale", "(", ")", "===", "0", ")", "{", "throw", "new", "InvalidColumnSettingsException", "(", "sprintf", "(", "'Decimal type of \"%s::%s\" has scale and precision set to 0 or not set at all.'", ".", "PHP_EOL", ".", "'Usage: e.g. @ORM\\Column(type=\"decimal\", precision=2, scale=4).'", ".", "PHP_EOL", ".", "'\"The precision represents the number of digits that are stored for values,'", ".", "PHP_EOL", ".", "' and the scale represents the number of digits that can be stored'", ".", "PHP_EOL", ".", "' following the decimal point\".'", ",", "$", "information", "->", "getClass", "(", ")", ",", "$", "information", "->", "getName", "(", ")", ")", ")", ";", "}", "}" ]
Process a Column Annotation, extract information about scale and precision for decimal types, length and size of string and integer types, if the column may be null and if it should be a unique value. @param Column $column @param PropertyInformation $information @throws InvalidColumnSettingsException @throws \DomainException @throws \InvalidArgumentException @throws \RangeException @throws \Hostnet\Component\AccessorGenerator\Reflection\Exception\ClassDefinitionNotFoundException @throws \OutOfBoundsException
[ "Process", "a", "Column", "Annotation", "extract", "information", "about", "scale", "and", "precision", "for", "decimal", "types", "length", "and", "size", "of", "string", "and", "integer", "types", "if", "the", "column", "may", "be", "null", "and", "if", "it", "should", "be", "a", "unique", "value", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/DoctrineAnnotationProcessor.php#L156-L183
27,739
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/DoctrineAnnotationProcessor.php
DoctrineAnnotationProcessor.processJoinColumn
private function processJoinColumn(JoinColumn $join_column, PropertyInformation $information): void { $information->setNullable($join_column->nullable); $information->setUnique($join_column->unique); }
php
private function processJoinColumn(JoinColumn $join_column, PropertyInformation $information): void { $information->setNullable($join_column->nullable); $information->setUnique($join_column->unique); }
[ "private", "function", "processJoinColumn", "(", "JoinColumn", "$", "join_column", ",", "PropertyInformation", "$", "information", ")", ":", "void", "{", "$", "information", "->", "setNullable", "(", "$", "join_column", "->", "nullable", ")", ";", "$", "information", "->", "setUnique", "(", "$", "join_column", "->", "unique", ")", ";", "}" ]
Process a JoinColumn Annotation, extract nullable. @param JoinColumn $join_column @param PropertyInformation $information
[ "Process", "a", "JoinColumn", "Annotation", "extract", "nullable", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/DoctrineAnnotationProcessor.php#L191-L195
27,740
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.processAnnotations
public function processAnnotations(): void { $class = $this->property->getClass(); $imports = $class ? array_change_key_case($class->getUseStatements()) : []; $filename = $class ? $class->getFilename() : 'memory'; // Get all the namespaces in which annotations reside. $namespaces = []; foreach ($this->annotation_processors as $processor) { $namespaces[] = $processor->getProcessableAnnotationNamespace(); } // Filter all imports that could lead to non loaded annotations, // this would let the DocParser explode with an Exception, while // the goal is to ignore other annotations besides the one explicitly // loaded. $without_foreign_annotations = array_filter( $imports, function ($import) use ($namespaces) { foreach ($namespaces as $namespace) { if (stripos($namespace, $import) === 0) { return true; } } return false; } ); $this->parser->setImports($without_foreign_annotations); $this->parser->setIgnoreNotImportedAnnotations(true); $annotations = $this->parser->parse($this->property->getDocComment(), $filename); // If the property is encrypted, column type MUST be string. $is_encrypted = false; $is_string = true; foreach ($this->annotation_processors as $processor) { foreach ($annotations as $annotation) { $processor->processAnnotation($annotation, $this); if ($annotation instanceof Generate && isset($annotation->encryption_alias)) { $is_encrypted = true; } if (!($annotation instanceof Column) || !isset($annotation->type) || \in_array($annotation->type, ['string', 'text']) ) { continue; } $is_string = false; } } if ($is_encrypted && !$is_string) { throw new \RuntimeException(sprintf( 'Property %s in class %s\%s has an encryption_alias set, but is not declared as column type \'string\'', $this->getName(), $this->getNamespace(), $this->getClass() )); } }
php
public function processAnnotations(): void { $class = $this->property->getClass(); $imports = $class ? array_change_key_case($class->getUseStatements()) : []; $filename = $class ? $class->getFilename() : 'memory'; // Get all the namespaces in which annotations reside. $namespaces = []; foreach ($this->annotation_processors as $processor) { $namespaces[] = $processor->getProcessableAnnotationNamespace(); } // Filter all imports that could lead to non loaded annotations, // this would let the DocParser explode with an Exception, while // the goal is to ignore other annotations besides the one explicitly // loaded. $without_foreign_annotations = array_filter( $imports, function ($import) use ($namespaces) { foreach ($namespaces as $namespace) { if (stripos($namespace, $import) === 0) { return true; } } return false; } ); $this->parser->setImports($without_foreign_annotations); $this->parser->setIgnoreNotImportedAnnotations(true); $annotations = $this->parser->parse($this->property->getDocComment(), $filename); // If the property is encrypted, column type MUST be string. $is_encrypted = false; $is_string = true; foreach ($this->annotation_processors as $processor) { foreach ($annotations as $annotation) { $processor->processAnnotation($annotation, $this); if ($annotation instanceof Generate && isset($annotation->encryption_alias)) { $is_encrypted = true; } if (!($annotation instanceof Column) || !isset($annotation->type) || \in_array($annotation->type, ['string', 'text']) ) { continue; } $is_string = false; } } if ($is_encrypted && !$is_string) { throw new \RuntimeException(sprintf( 'Property %s in class %s\%s has an encryption_alias set, but is not declared as column type \'string\'', $this->getName(), $this->getNamespace(), $this->getClass() )); } }
[ "public", "function", "processAnnotations", "(", ")", ":", "void", "{", "$", "class", "=", "$", "this", "->", "property", "->", "getClass", "(", ")", ";", "$", "imports", "=", "$", "class", "?", "array_change_key_case", "(", "$", "class", "->", "getUseStatements", "(", ")", ")", ":", "[", "]", ";", "$", "filename", "=", "$", "class", "?", "$", "class", "->", "getFilename", "(", ")", ":", "'memory'", ";", "// Get all the namespaces in which annotations reside.", "$", "namespaces", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "annotation_processors", "as", "$", "processor", ")", "{", "$", "namespaces", "[", "]", "=", "$", "processor", "->", "getProcessableAnnotationNamespace", "(", ")", ";", "}", "// Filter all imports that could lead to non loaded annotations,", "// this would let the DocParser explode with an Exception, while", "// the goal is to ignore other annotations besides the one explicitly", "// loaded.", "$", "without_foreign_annotations", "=", "array_filter", "(", "$", "imports", ",", "function", "(", "$", "import", ")", "use", "(", "$", "namespaces", ")", "{", "foreach", "(", "$", "namespaces", "as", "$", "namespace", ")", "{", "if", "(", "stripos", "(", "$", "namespace", ",", "$", "import", ")", "===", "0", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", ")", ";", "$", "this", "->", "parser", "->", "setImports", "(", "$", "without_foreign_annotations", ")", ";", "$", "this", "->", "parser", "->", "setIgnoreNotImportedAnnotations", "(", "true", ")", ";", "$", "annotations", "=", "$", "this", "->", "parser", "->", "parse", "(", "$", "this", "->", "property", "->", "getDocComment", "(", ")", ",", "$", "filename", ")", ";", "// If the property is encrypted, column type MUST be string.", "$", "is_encrypted", "=", "false", ";", "$", "is_string", "=", "true", ";", "foreach", "(", "$", "this", "->", "annotation_processors", "as", "$", "processor", ")", "{", "foreach", "(", "$", "annotations", "as", "$", "annotation", ")", "{", "$", "processor", "->", "processAnnotation", "(", "$", "annotation", ",", "$", "this", ")", ";", "if", "(", "$", "annotation", "instanceof", "Generate", "&&", "isset", "(", "$", "annotation", "->", "encryption_alias", ")", ")", "{", "$", "is_encrypted", "=", "true", ";", "}", "if", "(", "!", "(", "$", "annotation", "instanceof", "Column", ")", "||", "!", "isset", "(", "$", "annotation", "->", "type", ")", "||", "\\", "in_array", "(", "$", "annotation", "->", "type", ",", "[", "'string'", ",", "'text'", "]", ")", ")", "{", "continue", ";", "}", "$", "is_string", "=", "false", ";", "}", "}", "if", "(", "$", "is_encrypted", "&&", "!", "$", "is_string", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Property %s in class %s\\%s has an encryption_alias set, but is not declared as column type \\'string\\''", ",", "$", "this", "->", "getName", "(", ")", ",", "$", "this", "->", "getNamespace", "(", ")", ",", "$", "this", "->", "getClass", "(", ")", ")", ")", ";", "}", "}" ]
Start the processing of processAnnotations @return void @throws \OutOfBoundsException @throws \Hostnet\Component\AccessorGenerator\Reflection\Exception\ClassDefinitionNotFoundException @throws \RuntimeException
[ "Start", "the", "processing", "of", "processAnnotations" ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L238-L302
27,741
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.validateType
private function validateType(string $type): string { if ('' === $type) { throw new \DomainException(sprintf('A type name may not be empty')); } if ((int) $type) { throw new \DomainException(sprintf('A type name may not start with a number. Found %s', $type)); } if (\in_array($type, static::getValidTypes(), true)) { // Scalar. return $type; } if ('\\' === $type[0] || ctype_upper($type[0])) { // Class. return $type; } throw new \DomainException(sprintf('The type %s is not supported for code generation', $type)); }
php
private function validateType(string $type): string { if ('' === $type) { throw new \DomainException(sprintf('A type name may not be empty')); } if ((int) $type) { throw new \DomainException(sprintf('A type name may not start with a number. Found %s', $type)); } if (\in_array($type, static::getValidTypes(), true)) { // Scalar. return $type; } if ('\\' === $type[0] || ctype_upper($type[0])) { // Class. return $type; } throw new \DomainException(sprintf('The type %s is not supported for code generation', $type)); }
[ "private", "function", "validateType", "(", "string", "$", "type", ")", ":", "string", "{", "if", "(", "''", "===", "$", "type", ")", "{", "throw", "new", "\\", "DomainException", "(", "sprintf", "(", "'A type name may not be empty'", ")", ")", ";", "}", "if", "(", "(", "int", ")", "$", "type", ")", "{", "throw", "new", "\\", "DomainException", "(", "sprintf", "(", "'A type name may not start with a number. Found %s'", ",", "$", "type", ")", ")", ";", "}", "if", "(", "\\", "in_array", "(", "$", "type", ",", "static", "::", "getValidTypes", "(", ")", ",", "true", ")", ")", "{", "// Scalar.", "return", "$", "type", ";", "}", "if", "(", "'\\\\'", "===", "$", "type", "[", "0", "]", "||", "ctype_upper", "(", "$", "type", "[", "0", "]", ")", ")", "{", "// Class.", "return", "$", "type", ";", "}", "throw", "new", "\\", "DomainException", "(", "sprintf", "(", "'The type %s is not supported for code generation'", ",", "$", "type", ")", ")", ";", "}" ]
Throw exceptions for invalid types or return the valid type. @see http://php.net/manual/en/language.types.php @param string $type @throws \DomainException @throws \InvalidArgumentException @return string
[ "Throw", "exceptions", "for", "invalid", "types", "or", "return", "the", "valid", "type", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L404-L425
27,742
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setType
public function setType(?string $type): self { $this->type = $this->validateType($type); $this->type_hint || $this->type_hint = $this->type; return $this; }
php
public function setType(?string $type): self { $this->type = $this->validateType($type); $this->type_hint || $this->type_hint = $this->type; return $this; }
[ "public", "function", "setType", "(", "?", "string", "$", "type", ")", ":", "self", "{", "$", "this", "->", "type", "=", "$", "this", "->", "validateType", "(", "$", "type", ")", ";", "$", "this", "->", "type_hint", "||", "$", "this", "->", "type_hint", "=", "$", "this", "->", "type", ";", "return", "$", "this", ";", "}" ]
Set the type for this property. The type must be one of the set returned by getValidTypes. @see http://php.net/manual/en/language.types.php @param string|null $type @throws \DomainException @throws \InvalidArgumentException @return PropertyInformation
[ "Set", "the", "type", "for", "this", "property", ".", "The", "type", "must", "be", "one", "of", "the", "set", "returned", "by", "getValidTypes", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L440-L446
27,743
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setTypeHint
public function setTypeHint(string $type_hint): self { $this->type_hint = $this->validateType($type_hint); return $this; }
php
public function setTypeHint(string $type_hint): self { $this->type_hint = $this->validateType($type_hint); return $this; }
[ "public", "function", "setTypeHint", "(", "string", "$", "type_hint", ")", ":", "self", "{", "$", "this", "->", "type_hint", "=", "$", "this", "->", "validateType", "(", "$", "type_hint", ")", ";", "return", "$", "this", ";", "}" ]
Manually set the type hint for this property The type hint must be a valid class name starting with \ or a capital letter or one of the set returned by getValidTypes. Only use this method if you are not pleased by the automatic type hint that was already set by the setType method. @see http://php.net/manual/en/language.types.php @param string $type_hint @throws \DomainException @throws \InvalidArgumentException @return PropertyInformation
[ "Manually", "set", "the", "type", "hint", "for", "this", "property", "The", "type", "hint", "must", "be", "a", "valid", "class", "name", "starting", "with", "\\", "or", "a", "capital", "letter", "or", "one", "of", "the", "set", "returned", "by", "getValidTypes", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L466-L471
27,744
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setFullyQualifiedType
public function setFullyQualifiedType(string $type): self { if ('' === $type) { $this->fully_qualified_type = ''; return $this; } if ($type[0] === '\\') { $this->fully_qualified_type = $type; return $this; } throw new \DomainException(sprintf('The type %s is not a valid fully qualified class name', $type)); }
php
public function setFullyQualifiedType(string $type): self { if ('' === $type) { $this->fully_qualified_type = ''; return $this; } if ($type[0] === '\\') { $this->fully_qualified_type = $type; return $this; } throw new \DomainException(sprintf('The type %s is not a valid fully qualified class name', $type)); }
[ "public", "function", "setFullyQualifiedType", "(", "string", "$", "type", ")", ":", "self", "{", "if", "(", "''", "===", "$", "type", ")", "{", "$", "this", "->", "fully_qualified_type", "=", "''", ";", "return", "$", "this", ";", "}", "if", "(", "$", "type", "[", "0", "]", "===", "'\\\\'", ")", "{", "$", "this", "->", "fully_qualified_type", "=", "$", "type", ";", "return", "$", "this", ";", "}", "throw", "new", "\\", "DomainException", "(", "sprintf", "(", "'The type %s is not a valid fully qualified class name'", ",", "$", "type", ")", ")", ";", "}" ]
Set the fully qualified type for this property. The type must be a valid class name starting from the root namespace, so it should start with a \ @param string $type @throws \DomainException @return PropertyInformation
[ "Set", "the", "fully", "qualified", "type", "for", "this", "property", ".", "The", "type", "must", "be", "a", "valid", "class", "name", "starting", "from", "the", "root", "namespace", "so", "it", "should", "start", "with", "a", "\\" ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L483-L498
27,745
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setEncryptionAlias
public function setEncryptionAlias(string $encryption_alias): self { if (empty($encryption_alias)) { throw new \InvalidArgumentException(sprintf('encryption_alias must not be empty %s', $encryption_alias)); } $this->encryption_alias = $encryption_alias; return $this; }
php
public function setEncryptionAlias(string $encryption_alias): self { if (empty($encryption_alias)) { throw new \InvalidArgumentException(sprintf('encryption_alias must not be empty %s', $encryption_alias)); } $this->encryption_alias = $encryption_alias; return $this; }
[ "public", "function", "setEncryptionAlias", "(", "string", "$", "encryption_alias", ")", ":", "self", "{", "if", "(", "empty", "(", "$", "encryption_alias", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'encryption_alias must not be empty %s'", ",", "$", "encryption_alias", ")", ")", ";", "}", "$", "this", "->", "encryption_alias", "=", "$", "encryption_alias", ";", "return", "$", "this", ";", "}" ]
Set the encryption alias for this property, used to encrypt the value before storing. The alias must be added to the composer.json of the app, with the proper keys defined (depending on if the app will encrypt, decrypt or do both). "extra": { "accessor-generator": { $encryption_alias: { public-key: private-key: ... @param string $encryption_alias @throws \InvalidArgumentException @return PropertyInformation
[ "Set", "the", "encryption", "alias", "for", "this", "property", "used", "to", "encrypt", "the", "value", "before", "storing", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L528-L537
27,746
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setIntegerSize
public function setIntegerSize(int $integer_size): self { // Check Range. $max_int_size = PHP_INT_SIZE << 3; if ($integer_size <= 0 || $integer_size > $max_int_size) { throw new \RangeException( sprintf('Integer size %d, does not fit in domain (0, %d]', $integer_size, $max_int_size) ); } // Assign. $this->integer_size = $integer_size; return $this; }
php
public function setIntegerSize(int $integer_size): self { // Check Range. $max_int_size = PHP_INT_SIZE << 3; if ($integer_size <= 0 || $integer_size > $max_int_size) { throw new \RangeException( sprintf('Integer size %d, does not fit in domain (0, %d]', $integer_size, $max_int_size) ); } // Assign. $this->integer_size = $integer_size; return $this; }
[ "public", "function", "setIntegerSize", "(", "int", "$", "integer_size", ")", ":", "self", "{", "// Check Range.", "$", "max_int_size", "=", "PHP_INT_SIZE", "<<", "3", ";", "if", "(", "$", "integer_size", "<=", "0", "||", "$", "integer_size", ">", "$", "max_int_size", ")", "{", "throw", "new", "\\", "RangeException", "(", "sprintf", "(", "'Integer size %d, does not fit in domain (0, %d]'", ",", "$", "integer_size", ",", "$", "max_int_size", ")", ")", ";", "}", "// Assign.", "$", "this", "->", "integer_size", "=", "$", "integer_size", ";", "return", "$", "this", ";", "}" ]
Set the size of the integer that will be stored, in bits. @throws \InvalidArgumentException @throws \RangeException @param int $integer_size @return PropertyInformation
[ "Set", "the", "size", "of", "the", "integer", "that", "will", "be", "stored", "in", "bits", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L592-L606
27,747
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setPrecision
public function setPrecision(int $precision): self { // Check range. if ($precision < 0 || $precision > 65) { throw new \RangeException(sprintf('Precision %d, should be in interval [1,65]', $precision)); } $this->precision = $precision; return $this; }
php
public function setPrecision(int $precision): self { // Check range. if ($precision < 0 || $precision > 65) { throw new \RangeException(sprintf('Precision %d, should be in interval [1,65]', $precision)); } $this->precision = $precision; return $this; }
[ "public", "function", "setPrecision", "(", "int", "$", "precision", ")", ":", "self", "{", "// Check range.", "if", "(", "$", "precision", "<", "0", "||", "$", "precision", ">", "65", ")", "{", "throw", "new", "\\", "RangeException", "(", "sprintf", "(", "'Precision %d, should be in interval [1,65]'", ",", "$", "precision", ")", ")", ";", "}", "$", "this", "->", "precision", "=", "$", "precision", ";", "return", "$", "this", ";", "}" ]
Set the number of significant digits for a decimal number. This is only applicable to fixed point storage. The type will be a string in that case because PHP has no fixed point numbers. @see http://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html @throws \RangeException It has a range of 1 to 65. @param int $precision @return PropertyInformation
[ "Set", "the", "number", "of", "significant", "digits", "for", "a", "decimal", "number", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L767-L777
27,748
hostnet/accessor-generator-plugin-lib
src/AnnotationProcessor/PropertyInformation.php
PropertyInformation.setScale
public function setScale(int $scale): self { // Check range. if ($scale < 0 || $scale > 30) { throw new \RangeException(sprintf('Scale "%d", should be in interval [0,30]', $scale)); } $this->scale = $scale; return $this; }
php
public function setScale(int $scale): self { // Check range. if ($scale < 0 || $scale > 30) { throw new \RangeException(sprintf('Scale "%d", should be in interval [0,30]', $scale)); } $this->scale = $scale; return $this; }
[ "public", "function", "setScale", "(", "int", "$", "scale", ")", ":", "self", "{", "// Check range.", "if", "(", "$", "scale", "<", "0", "||", "$", "scale", ">", "30", ")", "{", "throw", "new", "\\", "RangeException", "(", "sprintf", "(", "'Scale \"%d\", should be in interval [0,30]'", ",", "$", "scale", ")", ")", ";", "}", "$", "this", "->", "scale", "=", "$", "scale", ";", "return", "$", "this", ";", "}" ]
Set the number of significant digits after the decimal point. This is only applicable to fixed point storage. The type will be a float in that case because PHP has no fixed point numbers. @see http://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html @throws \RangeException @param int $scale @return PropertyInformation
[ "Set", "the", "number", "of", "significant", "digits", "after", "the", "decimal", "point", ".", "This", "is", "only", "applicable", "to", "fixed", "point", "storage", ".", "The", "type", "will", "be", "a", "float", "in", "that", "case", "because", "PHP", "has", "no", "fixed", "point", "numbers", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/AnnotationProcessor/PropertyInformation.php#L802-L812
27,749
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpaymentgateway.php
OxpsPaymorrowOxPaymentGateway._savePaymorrowUserPaymentData
protected function _savePaymorrowUserPaymentData( oxOrder $oOrder, $oPmResponseHandler ) { $aPmResponse = $oPmResponseHandler->getResponse(); $oUserPaymentId = $oOrder->oxorder__oxpaymentid->value; /** @var OxpsPaymorrowOxUserPayment|oxUserPayment $oUserPayment */ $oUserPayment = oxNew( 'oxuserpayment' ); $oUserPayment->load( $oUserPaymentId ); $sPmBankName = $aPmResponse[self::PAYMORROW_RESPONSE_BANK_NAME]; $sPmIbanCode = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_IBAN]; $sPmBicCode = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_BIC]; $sPmOrderId = $aPmResponse[self::PAYMORROW_RESPONSE_ORDER_ID]; $oUserPayment->setPaymorrowBankName( $sPmBankName ); $oUserPayment->setPaymorrowIBAN( $sPmIbanCode ); $oUserPayment->setPaymorrowBIC( $sPmBicCode ); $oUserPayment->setPaymorrowOrderId( $sPmOrderId ); return $oUserPayment->save(); }
php
protected function _savePaymorrowUserPaymentData( oxOrder $oOrder, $oPmResponseHandler ) { $aPmResponse = $oPmResponseHandler->getResponse(); $oUserPaymentId = $oOrder->oxorder__oxpaymentid->value; /** @var OxpsPaymorrowOxUserPayment|oxUserPayment $oUserPayment */ $oUserPayment = oxNew( 'oxuserpayment' ); $oUserPayment->load( $oUserPaymentId ); $sPmBankName = $aPmResponse[self::PAYMORROW_RESPONSE_BANK_NAME]; $sPmIbanCode = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_IBAN]; $sPmBicCode = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_BIC]; $sPmOrderId = $aPmResponse[self::PAYMORROW_RESPONSE_ORDER_ID]; $oUserPayment->setPaymorrowBankName( $sPmBankName ); $oUserPayment->setPaymorrowIBAN( $sPmIbanCode ); $oUserPayment->setPaymorrowBIC( $sPmBicCode ); $oUserPayment->setPaymorrowOrderId( $sPmOrderId ); return $oUserPayment->save(); }
[ "protected", "function", "_savePaymorrowUserPaymentData", "(", "oxOrder", "$", "oOrder", ",", "$", "oPmResponseHandler", ")", "{", "$", "aPmResponse", "=", "$", "oPmResponseHandler", "->", "getResponse", "(", ")", ";", "$", "oUserPaymentId", "=", "$", "oOrder", "->", "oxorder__oxpaymentid", "->", "value", ";", "/** @var OxpsPaymorrowOxUserPayment|oxUserPayment $oUserPayment */", "$", "oUserPayment", "=", "oxNew", "(", "'oxuserpayment'", ")", ";", "$", "oUserPayment", "->", "load", "(", "$", "oUserPaymentId", ")", ";", "$", "sPmBankName", "=", "$", "aPmResponse", "[", "self", "::", "PAYMORROW_RESPONSE_BANK_NAME", "]", ";", "$", "sPmIbanCode", "=", "$", "aPmResponse", "[", "self", "::", "PAYMORROW_RESPONSE_SDD_IBAN", "]", ";", "$", "sPmBicCode", "=", "$", "aPmResponse", "[", "self", "::", "PAYMORROW_RESPONSE_SDD_BIC", "]", ";", "$", "sPmOrderId", "=", "$", "aPmResponse", "[", "self", "::", "PAYMORROW_RESPONSE_ORDER_ID", "]", ";", "$", "oUserPayment", "->", "setPaymorrowBankName", "(", "$", "sPmBankName", ")", ";", "$", "oUserPayment", "->", "setPaymorrowIBAN", "(", "$", "sPmIbanCode", ")", ";", "$", "oUserPayment", "->", "setPaymorrowBIC", "(", "$", "sPmBicCode", ")", ";", "$", "oUserPayment", "->", "setPaymorrowOrderId", "(", "$", "sPmOrderId", ")", ";", "return", "$", "oUserPayment", "->", "save", "(", ")", ";", "}" ]
Saves Paymorrow User Payment data to oxUserPayments table @param oxOrder $oOrder @param OxpsPaymorrowResponseHandler $oPmResponseHandler @return bool|string
[ "Saves", "Paymorrow", "User", "Payment", "data", "to", "oxUserPayments", "table" ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpaymentgateway.php#L104-L125
27,750
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpaymentgateway.php
OxpsPaymorrowOxPaymentGateway._handleOrderResponseErrors
protected function _handleOrderResponseErrors( $oPmResponseHandler ) { $aInitDataForPaymentStep = array(); // If order was declined, collect declination fields and unset error code ("unexpected" error) if ( $oPmResponseHandler->wasDeclined() ) { $aInitDataForPaymentStep = (array) $oPmResponseHandler->getDeclinationDataFromResponse(); } $aErrorsData = (array) $oPmResponseHandler->getErrorDataFromResponse(); // If there are errors add those to the data array if ( !empty( $aErrorsData ) ) { $aInitDataForPaymentStep = array_merge( $aInitDataForPaymentStep, $aErrorsData ); } // If order declination data or errors were present, save the data to session if ( !empty( $aInitDataForPaymentStep ) ) { $oPmResponseHandler->setErrorCode( null ); $this->_setSessionInitData( $aInitDataForPaymentStep ); } }
php
protected function _handleOrderResponseErrors( $oPmResponseHandler ) { $aInitDataForPaymentStep = array(); // If order was declined, collect declination fields and unset error code ("unexpected" error) if ( $oPmResponseHandler->wasDeclined() ) { $aInitDataForPaymentStep = (array) $oPmResponseHandler->getDeclinationDataFromResponse(); } $aErrorsData = (array) $oPmResponseHandler->getErrorDataFromResponse(); // If there are errors add those to the data array if ( !empty( $aErrorsData ) ) { $aInitDataForPaymentStep = array_merge( $aInitDataForPaymentStep, $aErrorsData ); } // If order declination data or errors were present, save the data to session if ( !empty( $aInitDataForPaymentStep ) ) { $oPmResponseHandler->setErrorCode( null ); $this->_setSessionInitData( $aInitDataForPaymentStep ); } }
[ "protected", "function", "_handleOrderResponseErrors", "(", "$", "oPmResponseHandler", ")", "{", "$", "aInitDataForPaymentStep", "=", "array", "(", ")", ";", "// If order was declined, collect declination fields and unset error code (\"unexpected\" error)", "if", "(", "$", "oPmResponseHandler", "->", "wasDeclined", "(", ")", ")", "{", "$", "aInitDataForPaymentStep", "=", "(", "array", ")", "$", "oPmResponseHandler", "->", "getDeclinationDataFromResponse", "(", ")", ";", "}", "$", "aErrorsData", "=", "(", "array", ")", "$", "oPmResponseHandler", "->", "getErrorDataFromResponse", "(", ")", ";", "// If there are errors add those to the data array", "if", "(", "!", "empty", "(", "$", "aErrorsData", ")", ")", "{", "$", "aInitDataForPaymentStep", "=", "array_merge", "(", "$", "aInitDataForPaymentStep", ",", "$", "aErrorsData", ")", ";", "}", "// If order declination data or errors were present, save the data to session", "if", "(", "!", "empty", "(", "$", "aInitDataForPaymentStep", ")", ")", "{", "$", "oPmResponseHandler", "->", "setErrorCode", "(", "null", ")", ";", "$", "this", "->", "_setSessionInitData", "(", "$", "aInitDataForPaymentStep", ")", ";", "}", "}" ]
Check order response for declination status and fields and error fields. Set all relevant fields to session. The session data is used to go with redirection to payment step and used to initialize payment forms. @param OxpsPaymorrowResponseHandler $oPmResponseHandler
[ "Check", "order", "response", "for", "declination", "status", "and", "fields", "and", "error", "fields", ".", "Set", "all", "relevant", "fields", "to", "session", ".", "The", "session", "data", "is", "used", "to", "go", "with", "redirection", "to", "payment", "step", "and", "used", "to", "initialize", "payment", "forms", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpaymentgateway.php#L134-L155
27,751
techdivision/import-product
src/Observers/ProductWebsiteUpdateObserver.php
ProductWebsiteUpdateObserver.initializeProductWebsite
protected function initializeProductWebsite(array $attr) { // try to load the product website relation with the passed product/website ID if ($this->loadProductWebsite($attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID])) { // throw a runtime exception, if the relation already exists throw new \RuntimeException( sprintf( 'Product website relation %d => %d already exsits', $attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID] ) ); } // otherwise simply return the attributes return $attr; }
php
protected function initializeProductWebsite(array $attr) { // try to load the product website relation with the passed product/website ID if ($this->loadProductWebsite($attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID])) { // throw a runtime exception, if the relation already exists throw new \RuntimeException( sprintf( 'Product website relation %d => %d already exsits', $attr[MemberNames::PRODUCT_ID], $attr[MemberNames::WEBSITE_ID] ) ); } // otherwise simply return the attributes return $attr; }
[ "protected", "function", "initializeProductWebsite", "(", "array", "$", "attr", ")", "{", "// try to load the product website relation with the passed product/website ID", "if", "(", "$", "this", "->", "loadProductWebsite", "(", "$", "attr", "[", "MemberNames", "::", "PRODUCT_ID", "]", ",", "$", "attr", "[", "MemberNames", "::", "WEBSITE_ID", "]", ")", ")", "{", "// throw a runtime exception, if the relation already exists", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Product website relation %d => %d already exsits'", ",", "$", "attr", "[", "MemberNames", "::", "PRODUCT_ID", "]", ",", "$", "attr", "[", "MemberNames", "::", "WEBSITE_ID", "]", ")", ")", ";", "}", "// otherwise simply return the attributes", "return", "$", "attr", ";", "}" ]
Initialize the product website with the passed attributes and returns an instance. @param array $attr The product website attributes @return array The initialized product website @throws \RuntimeException Is thrown, if the attributes can not be initialized
[ "Initialize", "the", "product", "website", "with", "the", "passed", "attributes", "and", "returns", "an", "instance", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/ProductWebsiteUpdateObserver.php#L45-L62
27,752
contributte/thepay-api
src/DataApi/DataApiObject.php
DataApiObject.sortDataProperties
private static function sortDataProperties(array $dataProperties): array { $inherited = []; $own = []; $calledClassName = static::class; foreach ($dataProperties as $property) { $propertyClass = $property->getDeclaringClass(); $propertyClassName = $propertyClass->getName(); if ($propertyClassName === $calledClassName) { $own[] = $property; } else { $inherited[] = $property; } } return array_merge($inherited, $own); }
php
private static function sortDataProperties(array $dataProperties): array { $inherited = []; $own = []; $calledClassName = static::class; foreach ($dataProperties as $property) { $propertyClass = $property->getDeclaringClass(); $propertyClassName = $propertyClass->getName(); if ($propertyClassName === $calledClassName) { $own[] = $property; } else { $inherited[] = $property; } } return array_merge($inherited, $own); }
[ "private", "static", "function", "sortDataProperties", "(", "array", "$", "dataProperties", ")", ":", "array", "{", "$", "inherited", "=", "[", "]", ";", "$", "own", "=", "[", "]", ";", "$", "calledClassName", "=", "static", "::", "class", ";", "foreach", "(", "$", "dataProperties", "as", "$", "property", ")", "{", "$", "propertyClass", "=", "$", "property", "->", "getDeclaringClass", "(", ")", ";", "$", "propertyClassName", "=", "$", "propertyClass", "->", "getName", "(", ")", ";", "if", "(", "$", "propertyClassName", "===", "$", "calledClassName", ")", "{", "$", "own", "[", "]", "=", "$", "property", ";", "}", "else", "{", "$", "inherited", "[", "]", "=", "$", "property", ";", "}", "}", "return", "array_merge", "(", "$", "inherited", ",", "$", "own", ")", ";", "}" ]
Prepend inherited properties. @param ReflectionProperty[] $dataProperties @return ReflectionProperty[]
[ "Prepend", "inherited", "properties", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/DataApi/DataApiObject.php#L76-L95
27,753
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.getName
public function getName(): string { // Check cache. if (null === $this->name) { $tokens = $this->getTokenStream(); // Find class token try { $loc = $tokens->scan(0, [T_CLASS, T_TRAIT]); } catch (\OutOfBoundsException $e) { throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.', 0, $e); } // Get the following token if ($loc !== null) { $loc = $tokens->next($loc); } // Make sure it is not :: but a name if ($loc !== null && $tokens->type($loc) === T_STRING) { // Read the name from the token $this->name = $tokens->value($loc); $this->class_location = $loc; } else { // Mark the name as NOT found (in contrast to not initialized) $this->name = false; } } // Return the name if a class was found or throw an exception. if ($this->name) { return $this->name; } throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.'); }
php
public function getName(): string { // Check cache. if (null === $this->name) { $tokens = $this->getTokenStream(); // Find class token try { $loc = $tokens->scan(0, [T_CLASS, T_TRAIT]); } catch (\OutOfBoundsException $e) { throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.', 0, $e); } // Get the following token if ($loc !== null) { $loc = $tokens->next($loc); } // Make sure it is not :: but a name if ($loc !== null && $tokens->type($loc) === T_STRING) { // Read the name from the token $this->name = $tokens->value($loc); $this->class_location = $loc; } else { // Mark the name as NOT found (in contrast to not initialized) $this->name = false; } } // Return the name if a class was found or throw an exception. if ($this->name) { return $this->name; } throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.'); }
[ "public", "function", "getName", "(", ")", ":", "string", "{", "// Check cache.", "if", "(", "null", "===", "$", "this", "->", "name", ")", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "// Find class token", "try", "{", "$", "loc", "=", "$", "tokens", "->", "scan", "(", "0", ",", "[", "T_CLASS", ",", "T_TRAIT", "]", ")", ";", "}", "catch", "(", "\\", "OutOfBoundsException", "$", "e", ")", "{", "throw", "new", "ClassDefinitionNotFoundException", "(", "'No class is found inside '", ".", "$", "this", "->", "filename", ".", "'.'", ",", "0", ",", "$", "e", ")", ";", "}", "// Get the following token", "if", "(", "$", "loc", "!==", "null", ")", "{", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "}", "// Make sure it is not :: but a name", "if", "(", "$", "loc", "!==", "null", "&&", "$", "tokens", "->", "type", "(", "$", "loc", ")", "===", "T_STRING", ")", "{", "// Read the name from the token", "$", "this", "->", "name", "=", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "$", "this", "->", "class_location", "=", "$", "loc", ";", "}", "else", "{", "// Mark the name as NOT found (in contrast to not initialized)", "$", "this", "->", "name", "=", "false", ";", "}", "}", "// Return the name if a class was found or throw an exception.", "if", "(", "$", "this", "->", "name", ")", "{", "return", "$", "this", "->", "name", ";", "}", "throw", "new", "ClassDefinitionNotFoundException", "(", "'No class is found inside '", ".", "$", "this", "->", "filename", ".", "'.'", ")", ";", "}" ]
Returns the name of the class, inside this file. This is the simple class name and not the fully qualified class name. @throws Exception\ClassDefinitionNotFoundException @throws \OutOfBoundsException @return string
[ "Returns", "the", "name", "of", "the", "class", "inside", "this", "file", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L125-L159
27,754
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.getNamespace
public function getNamespace(): string { // Check cache. if (null === $this->namespace) { $tokens = $this->getTokenStream(); // Find namespace token try { $loc = $tokens->scan(0, [T_NAMESPACE]); } catch (\OutOfBoundsException $e) { return $this->namespace = ''; } // Get the next token (start with namespace) if ($loc !== null) { $loc = $tokens->next($loc); } // If the start of the namespace is found, // parse it, otherwise save empty namespace. $this->namespace = ''; if ($loc !== null) { $this->namespace = $this->parseNamespace($loc); } } return $this->namespace; }
php
public function getNamespace(): string { // Check cache. if (null === $this->namespace) { $tokens = $this->getTokenStream(); // Find namespace token try { $loc = $tokens->scan(0, [T_NAMESPACE]); } catch (\OutOfBoundsException $e) { return $this->namespace = ''; } // Get the next token (start with namespace) if ($loc !== null) { $loc = $tokens->next($loc); } // If the start of the namespace is found, // parse it, otherwise save empty namespace. $this->namespace = ''; if ($loc !== null) { $this->namespace = $this->parseNamespace($loc); } } return $this->namespace; }
[ "public", "function", "getNamespace", "(", ")", ":", "string", "{", "// Check cache.", "if", "(", "null", "===", "$", "this", "->", "namespace", ")", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "// Find namespace token", "try", "{", "$", "loc", "=", "$", "tokens", "->", "scan", "(", "0", ",", "[", "T_NAMESPACE", "]", ")", ";", "}", "catch", "(", "\\", "OutOfBoundsException", "$", "e", ")", "{", "return", "$", "this", "->", "namespace", "=", "''", ";", "}", "// Get the next token (start with namespace)", "if", "(", "$", "loc", "!==", "null", ")", "{", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "}", "// If the start of the namespace is found,", "// parse it, otherwise save empty namespace.", "$", "this", "->", "namespace", "=", "''", ";", "if", "(", "$", "loc", "!==", "null", ")", "{", "$", "this", "->", "namespace", "=", "$", "this", "->", "parseNamespace", "(", "$", "loc", ")", ";", "}", "}", "return", "$", "this", "->", "namespace", ";", "}" ]
Returns the namespace of the class in this file or an empty string if no namespace was declared. @return string
[ "Returns", "the", "namespace", "of", "the", "class", "in", "this", "file", "or", "an", "empty", "string", "if", "no", "namespace", "was", "declared", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L167-L193
27,755
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.getProperties
public function getProperties(): array { // Check cache if (null === $this->properties) { $tokens = $this->getTokenStream(); // Create empty set, to denote that // we parsed all the properties $this->properties = []; // Start parsing from the class name location // and trigger ClassDefinitionNotFoundException when called // on a file not containing a class. $vis_loc = $this->getClassNameLocation(); // Scan for public, protected and private because // these keywords denote the start of a property. // var is excluded because its use is deprecated. while ($vis_loc = $tokens->scan($vis_loc, [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_VAR])) { // Seek forward, skipping static, if it was found and check if we // really have a property here, otherwise confine and try to find more // properties. // We also skip final, to improve error handling and consistent behaviour, // otherwise final private $foo would be parsed and private final $bar // would not be parsed. $var_loc = $tokens->next($vis_loc, [T_COMMENT, T_WHITESPACE, T_STATIC, T_FINAL]); if ($tokens->type($var_loc) !== T_VARIABLE) { continue; } $doc_comment = $this->parseDocComment($vis_loc); // doc comment $modifiers = $this->parsePropertyModifiers($vis_loc); // public, protected, private, static $name = substr($tokens->value($var_loc), 1); // property name $default = $this->parseDefaultValue($var_loc); // default value $property = new ReflectionProperty($name, $modifiers, $default, $doc_comment, $this); $this->properties[] = $property; } } return $this->properties; }
php
public function getProperties(): array { // Check cache if (null === $this->properties) { $tokens = $this->getTokenStream(); // Create empty set, to denote that // we parsed all the properties $this->properties = []; // Start parsing from the class name location // and trigger ClassDefinitionNotFoundException when called // on a file not containing a class. $vis_loc = $this->getClassNameLocation(); // Scan for public, protected and private because // these keywords denote the start of a property. // var is excluded because its use is deprecated. while ($vis_loc = $tokens->scan($vis_loc, [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_VAR])) { // Seek forward, skipping static, if it was found and check if we // really have a property here, otherwise confine and try to find more // properties. // We also skip final, to improve error handling and consistent behaviour, // otherwise final private $foo would be parsed and private final $bar // would not be parsed. $var_loc = $tokens->next($vis_loc, [T_COMMENT, T_WHITESPACE, T_STATIC, T_FINAL]); if ($tokens->type($var_loc) !== T_VARIABLE) { continue; } $doc_comment = $this->parseDocComment($vis_loc); // doc comment $modifiers = $this->parsePropertyModifiers($vis_loc); // public, protected, private, static $name = substr($tokens->value($var_loc), 1); // property name $default = $this->parseDefaultValue($var_loc); // default value $property = new ReflectionProperty($name, $modifiers, $default, $doc_comment, $this); $this->properties[] = $property; } } return $this->properties; }
[ "public", "function", "getProperties", "(", ")", ":", "array", "{", "// Check cache", "if", "(", "null", "===", "$", "this", "->", "properties", ")", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "// Create empty set, to denote that", "// we parsed all the properties", "$", "this", "->", "properties", "=", "[", "]", ";", "// Start parsing from the class name location", "// and trigger ClassDefinitionNotFoundException when called", "// on a file not containing a class.", "$", "vis_loc", "=", "$", "this", "->", "getClassNameLocation", "(", ")", ";", "// Scan for public, protected and private because", "// these keywords denote the start of a property.", "// var is excluded because its use is deprecated.", "while", "(", "$", "vis_loc", "=", "$", "tokens", "->", "scan", "(", "$", "vis_loc", ",", "[", "T_PRIVATE", ",", "T_PROTECTED", ",", "T_PUBLIC", ",", "T_VAR", "]", ")", ")", "{", "// Seek forward, skipping static, if it was found and check if we", "// really have a property here, otherwise confine and try to find more", "// properties.", "// We also skip final, to improve error handling and consistent behaviour,", "// otherwise final private $foo would be parsed and private final $bar", "// would not be parsed.", "$", "var_loc", "=", "$", "tokens", "->", "next", "(", "$", "vis_loc", ",", "[", "T_COMMENT", ",", "T_WHITESPACE", ",", "T_STATIC", ",", "T_FINAL", "]", ")", ";", "if", "(", "$", "tokens", "->", "type", "(", "$", "var_loc", ")", "!==", "T_VARIABLE", ")", "{", "continue", ";", "}", "$", "doc_comment", "=", "$", "this", "->", "parseDocComment", "(", "$", "vis_loc", ")", ";", "// doc comment", "$", "modifiers", "=", "$", "this", "->", "parsePropertyModifiers", "(", "$", "vis_loc", ")", ";", "// public, protected, private, static", "$", "name", "=", "substr", "(", "$", "tokens", "->", "value", "(", "$", "var_loc", ")", ",", "1", ")", ";", "// property name", "$", "default", "=", "$", "this", "->", "parseDefaultValue", "(", "$", "var_loc", ")", ";", "// default value", "$", "property", "=", "new", "ReflectionProperty", "(", "$", "name", ",", "$", "modifiers", ",", "$", "default", ",", "$", "doc_comment", ",", "$", "this", ")", ";", "$", "this", "->", "properties", "[", "]", "=", "$", "property", ";", "}", "}", "return", "$", "this", "->", "properties", ";", "}" ]
Returns all private, protected and public properties for this class. Properties declared with var are not provided as var declarations are deprecated. Only declared properties are returned. Properties created at runtime are not taken into consideration. @throws ClassDefinitionNotFoundException @return ReflectionProperty[]
[ "Returns", "all", "private", "protected", "and", "public", "properties", "for", "this", "class", ".", "Properties", "declared", "with", "var", "are", "not", "provided", "as", "var", "declarations", "are", "deprecated", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L287-L329
27,756
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parseNamespace
private function parseNamespace($loc): string { $tokens = $this->getTokenStream(); $ns = ''; if (\in_array($this->tokens->type($loc), [T_FUNCTION, T_CONST])) { $ns .= $this->tokens->value($loc) . ' '; $loc = $tokens->next($loc); } while (\in_array($tokens->type($loc), [T_NS_SEPARATOR, T_STRING])) { $ns .= $tokens->value($loc); $loc = $tokens->next($loc); } return $ns; }
php
private function parseNamespace($loc): string { $tokens = $this->getTokenStream(); $ns = ''; if (\in_array($this->tokens->type($loc), [T_FUNCTION, T_CONST])) { $ns .= $this->tokens->value($loc) . ' '; $loc = $tokens->next($loc); } while (\in_array($tokens->type($loc), [T_NS_SEPARATOR, T_STRING])) { $ns .= $tokens->value($loc); $loc = $tokens->next($loc); } return $ns; }
[ "private", "function", "parseNamespace", "(", "$", "loc", ")", ":", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "ns", "=", "''", ";", "if", "(", "\\", "in_array", "(", "$", "this", "->", "tokens", "->", "type", "(", "$", "loc", ")", ",", "[", "T_FUNCTION", ",", "T_CONST", "]", ")", ")", "{", "$", "ns", ".=", "$", "this", "->", "tokens", "->", "value", "(", "$", "loc", ")", ".", "' '", ";", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "}", "while", "(", "\\", "in_array", "(", "$", "tokens", "->", "type", "(", "$", "loc", ")", ",", "[", "T_NS_SEPARATOR", ",", "T_STRING", "]", ")", ")", "{", "$", "ns", ".=", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "}", "return", "$", "ns", ";", "}" ]
Parse the namespace and return as string @param int $loc location of the first namespace token (T_STRING) and not the T_NAMESPACE, T_AS or T_USE. @return string
[ "Parse", "the", "namespace", "and", "return", "as", "string" ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L381-L397
27,757
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parseDocComment
private function parseDocComment($loc): string { $tokens = $this->getTokenStream(); // Look back from T_PUBLIC, T_PROTECTED, T_PRIVATE or T_CLASS // for the T_DOC_COMMENT token $loc = $tokens->previous($loc, [T_WHITESPACE, T_STATIC, T_FINAL]); // Check for doc comment if ($loc && $tokens->type($loc) === T_DOC_COMMENT) { $doc_comment = $tokens->value($loc); // strip off indentation $doc_comment = preg_replace('/^[ \t]*\*/m', ' *', $doc_comment); return $doc_comment; } return ''; }
php
private function parseDocComment($loc): string { $tokens = $this->getTokenStream(); // Look back from T_PUBLIC, T_PROTECTED, T_PRIVATE or T_CLASS // for the T_DOC_COMMENT token $loc = $tokens->previous($loc, [T_WHITESPACE, T_STATIC, T_FINAL]); // Check for doc comment if ($loc && $tokens->type($loc) === T_DOC_COMMENT) { $doc_comment = $tokens->value($loc); // strip off indentation $doc_comment = preg_replace('/^[ \t]*\*/m', ' *', $doc_comment); return $doc_comment; } return ''; }
[ "private", "function", "parseDocComment", "(", "$", "loc", ")", ":", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "// Look back from T_PUBLIC, T_PROTECTED, T_PRIVATE or T_CLASS", "// for the T_DOC_COMMENT token", "$", "loc", "=", "$", "tokens", "->", "previous", "(", "$", "loc", ",", "[", "T_WHITESPACE", ",", "T_STATIC", ",", "T_FINAL", "]", ")", ";", "// Check for doc comment", "if", "(", "$", "loc", "&&", "$", "tokens", "->", "type", "(", "$", "loc", ")", "===", "T_DOC_COMMENT", ")", "{", "$", "doc_comment", "=", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "// strip off indentation", "$", "doc_comment", "=", "preg_replace", "(", "'/^[ \\t]*\\*/m'", ",", "' *'", ",", "$", "doc_comment", ")", ";", "return", "$", "doc_comment", ";", "}", "return", "''", ";", "}" ]
Returns the doc comment for a property, method or class. The comment is stripped of leading whitespaces. Returns an empty string if no doc- comment or an empty doc comment was found. @param int $loc location of the visibility modifier or T_CLASS @return string the contents of the doc comment
[ "Returns", "the", "doc", "comment", "for", "a", "property", "method", "or", "class", ".", "The", "comment", "is", "stripped", "of", "leading", "whitespaces", ".", "Returns", "an", "empty", "string", "if", "no", "doc", "-", "comment", "or", "an", "empty", "doc", "comment", "was", "found", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L408-L426
27,758
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parsePropertyModifiers
private function parsePropertyModifiers($loc): int { $tokens = $this->getTokenStream(); $modifiers = 0; // initialize bit filed with all modifiers switched off // Enable visibility bits switch ($tokens->type($loc)) { case T_PRIVATE: $modifiers |= \ReflectionProperty::IS_PRIVATE; break; case T_PROTECTED: $modifiers |= \ReflectionProperty::IS_PROTECTED; break; case T_VAR: case T_PUBLIC: $modifiers |= \ReflectionProperty::IS_PUBLIC; break; } // Look forward and backward for STATIC modifier $prev = $tokens->previous($loc); $next = $tokens->next($loc); // If found write the bits if ($tokens->type($prev) === T_STATIC || $tokens->type($next) === T_STATIC) { $modifiers |= \ReflectionProperty::IS_STATIC; } return $modifiers; }
php
private function parsePropertyModifiers($loc): int { $tokens = $this->getTokenStream(); $modifiers = 0; // initialize bit filed with all modifiers switched off // Enable visibility bits switch ($tokens->type($loc)) { case T_PRIVATE: $modifiers |= \ReflectionProperty::IS_PRIVATE; break; case T_PROTECTED: $modifiers |= \ReflectionProperty::IS_PROTECTED; break; case T_VAR: case T_PUBLIC: $modifiers |= \ReflectionProperty::IS_PUBLIC; break; } // Look forward and backward for STATIC modifier $prev = $tokens->previous($loc); $next = $tokens->next($loc); // If found write the bits if ($tokens->type($prev) === T_STATIC || $tokens->type($next) === T_STATIC) { $modifiers |= \ReflectionProperty::IS_STATIC; } return $modifiers; }
[ "private", "function", "parsePropertyModifiers", "(", "$", "loc", ")", ":", "int", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "modifiers", "=", "0", ";", "// initialize bit filed with all modifiers switched off", "// Enable visibility bits", "switch", "(", "$", "tokens", "->", "type", "(", "$", "loc", ")", ")", "{", "case", "T_PRIVATE", ":", "$", "modifiers", "|=", "\\", "ReflectionProperty", "::", "IS_PRIVATE", ";", "break", ";", "case", "T_PROTECTED", ":", "$", "modifiers", "|=", "\\", "ReflectionProperty", "::", "IS_PROTECTED", ";", "break", ";", "case", "T_VAR", ":", "case", "T_PUBLIC", ":", "$", "modifiers", "|=", "\\", "ReflectionProperty", "::", "IS_PUBLIC", ";", "break", ";", "}", "// Look forward and backward for STATIC modifier", "$", "prev", "=", "$", "tokens", "->", "previous", "(", "$", "loc", ")", ";", "$", "next", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "// If found write the bits", "if", "(", "$", "tokens", "->", "type", "(", "$", "prev", ")", "===", "T_STATIC", "||", "$", "tokens", "->", "type", "(", "$", "next", ")", "===", "T_STATIC", ")", "{", "$", "modifiers", "|=", "\\", "ReflectionProperty", "::", "IS_STATIC", ";", "}", "return", "$", "modifiers", ";", "}" ]
Parse visibility and static modifier of the property in to a bit field combining all the modifiers as is done in by PHP Reflection for the \ReflectionProperty. Note that properties can not be final and thus this function does not scan for T_FINAL. @see \ReflectionProperty @param int $loc location of the visibility modifier @return int
[ "Parse", "visibility", "and", "static", "modifier", "of", "the", "property", "in", "to", "a", "bit", "field", "combining", "all", "the", "modifiers", "as", "is", "done", "in", "by", "PHP", "Reflection", "for", "the", "\\", "ReflectionProperty", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L442-L471
27,759
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parseDefaultValue
private function parseDefaultValue($loc): ?string { $tokens = $this->getTokenStream(); $default = ''; $loc = $tokens->next($loc); if ($tokens->value($loc) === '=') { $loc = $tokens->next($loc); $type = $tokens->type($loc); if (\in_array($type, [T_DNUMBER, T_LNUMBER, T_CONSTANT_ENCAPSED_STRING])) { // Easy numbers and strings. $default = $tokens->value($loc); } elseif (\in_array($type, [T_STRING, T_NS_SEPARATOR])) { // Constants, definitions and null $default = $this->parseNamespace($loc); $loc = $tokens->next($loc, [T_WHITESPACE, T_COMMENT, T_STRING, T_NS_SEPARATOR]); if ($tokens->type($loc) === T_PAAMAYIM_NEKUDOTAYIM) { $loc = $tokens->next($loc); $default .= '::' . $tokens->value($loc); } } elseif (\in_array($type, [T_ARRAY, '['])) { // Array types, both old array() and shorthand [] notation. $default = $this->parseArrayDefinition($loc); } elseif ($type === T_START_HEREDOC) { // Heredoc and Nowdoc $default = $this->parseHereNowDocConcat($loc); } } return $default; }
php
private function parseDefaultValue($loc): ?string { $tokens = $this->getTokenStream(); $default = ''; $loc = $tokens->next($loc); if ($tokens->value($loc) === '=') { $loc = $tokens->next($loc); $type = $tokens->type($loc); if (\in_array($type, [T_DNUMBER, T_LNUMBER, T_CONSTANT_ENCAPSED_STRING])) { // Easy numbers and strings. $default = $tokens->value($loc); } elseif (\in_array($type, [T_STRING, T_NS_SEPARATOR])) { // Constants, definitions and null $default = $this->parseNamespace($loc); $loc = $tokens->next($loc, [T_WHITESPACE, T_COMMENT, T_STRING, T_NS_SEPARATOR]); if ($tokens->type($loc) === T_PAAMAYIM_NEKUDOTAYIM) { $loc = $tokens->next($loc); $default .= '::' . $tokens->value($loc); } } elseif (\in_array($type, [T_ARRAY, '['])) { // Array types, both old array() and shorthand [] notation. $default = $this->parseArrayDefinition($loc); } elseif ($type === T_START_HEREDOC) { // Heredoc and Nowdoc $default = $this->parseHereNowDocConcat($loc); } } return $default; }
[ "private", "function", "parseDefaultValue", "(", "$", "loc", ")", ":", "?", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "default", "=", "''", ";", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "if", "(", "$", "tokens", "->", "value", "(", "$", "loc", ")", "===", "'='", ")", "{", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "$", "type", "=", "$", "tokens", "->", "type", "(", "$", "loc", ")", ";", "if", "(", "\\", "in_array", "(", "$", "type", ",", "[", "T_DNUMBER", ",", "T_LNUMBER", ",", "T_CONSTANT_ENCAPSED_STRING", "]", ")", ")", "{", "// Easy numbers and strings.", "$", "default", "=", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "}", "elseif", "(", "\\", "in_array", "(", "$", "type", ",", "[", "T_STRING", ",", "T_NS_SEPARATOR", "]", ")", ")", "{", "// Constants, definitions and null", "$", "default", "=", "$", "this", "->", "parseNamespace", "(", "$", "loc", ")", ";", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ",", "[", "T_WHITESPACE", ",", "T_COMMENT", ",", "T_STRING", ",", "T_NS_SEPARATOR", "]", ")", ";", "if", "(", "$", "tokens", "->", "type", "(", "$", "loc", ")", "===", "T_PAAMAYIM_NEKUDOTAYIM", ")", "{", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "$", "default", ".=", "'::'", ".", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "}", "}", "elseif", "(", "\\", "in_array", "(", "$", "type", ",", "[", "T_ARRAY", ",", "'['", "]", ")", ")", "{", "// Array types, both old array() and shorthand [] notation.", "$", "default", "=", "$", "this", "->", "parseArrayDefinition", "(", "$", "loc", ")", ";", "}", "elseif", "(", "$", "type", "===", "T_START_HEREDOC", ")", "{", "// Heredoc and Nowdoc", "$", "default", "=", "$", "this", "->", "parseHereNowDocConcat", "(", "$", "loc", ")", ";", "}", "}", "return", "$", "default", ";", "}" ]
Parses the default value assignment for a property and returns the default value or null if there is no default value assigned. The returned value includes single or double quotes as used in the code. This way we can keep those and this also enables us to parse a default value of null. @param int $loc location of the property name (T_STRING) @return string|null Null if there is no default value, string otherwise
[ "Parses", "the", "default", "value", "assignment", "for", "a", "property", "and", "returns", "the", "default", "value", "or", "null", "if", "there", "is", "no", "default", "value", "assigned", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L485-L516
27,760
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parseArrayDefinition
private function parseArrayDefinition($loc): string { $tokens = $this->getTokenStream(); $found = 0; $brace = 0; $code = ''; do { $type = $tokens->type($loc); switch ($type) { case T_ARRAY: $loc = $tokens->scan($loc, ['(']); $brace++; // intentional fallthrough case '[': $code .= '['; $found++; break; case '(': $brace++; $code .= '('; break; case ']': $found--; $code .= ']'; break; case ')': if (--$brace === 0) { $found--; $code .= ']'; } else { $code .= ')'; } break; default: $code .= $this->arrayWhitespace($loc); } } while ($found > 0 && ($loc = $tokens->next($loc))); return $code; }
php
private function parseArrayDefinition($loc): string { $tokens = $this->getTokenStream(); $found = 0; $brace = 0; $code = ''; do { $type = $tokens->type($loc); switch ($type) { case T_ARRAY: $loc = $tokens->scan($loc, ['(']); $brace++; // intentional fallthrough case '[': $code .= '['; $found++; break; case '(': $brace++; $code .= '('; break; case ']': $found--; $code .= ']'; break; case ')': if (--$brace === 0) { $found--; $code .= ']'; } else { $code .= ')'; } break; default: $code .= $this->arrayWhitespace($loc); } } while ($found > 0 && ($loc = $tokens->next($loc))); return $code; }
[ "private", "function", "parseArrayDefinition", "(", "$", "loc", ")", ":", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "found", "=", "0", ";", "$", "brace", "=", "0", ";", "$", "code", "=", "''", ";", "do", "{", "$", "type", "=", "$", "tokens", "->", "type", "(", "$", "loc", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "T_ARRAY", ":", "$", "loc", "=", "$", "tokens", "->", "scan", "(", "$", "loc", ",", "[", "'('", "]", ")", ";", "$", "brace", "++", ";", "// intentional fallthrough", "case", "'['", ":", "$", "code", ".=", "'['", ";", "$", "found", "++", ";", "break", ";", "case", "'('", ":", "$", "brace", "++", ";", "$", "code", ".=", "'('", ";", "break", ";", "case", "']'", ":", "$", "found", "--", ";", "$", "code", ".=", "']'", ";", "break", ";", "case", "')'", ":", "if", "(", "--", "$", "brace", "===", "0", ")", "{", "$", "found", "--", ";", "$", "code", ".=", "']'", ";", "}", "else", "{", "$", "code", ".=", "')'", ";", "}", "break", ";", "default", ":", "$", "code", ".=", "$", "this", "->", "arrayWhitespace", "(", "$", "loc", ")", ";", "}", "}", "while", "(", "$", "found", ">", "0", "&&", "(", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ")", ")", ";", "return", "$", "code", ";", "}" ]
Parse an array definition. The definition can contain arrays itself. The whole content of the array definition is stripped from comments and excessive whitespaces. @param int $loc location of the token stream where the array starts. This should point to a T_ARRAY or [ token. @return string code representation of the parsed array without any comments or excessive whitespace.
[ "Parse", "an", "array", "definition", ".", "The", "definition", "can", "contain", "arrays", "itself", ".", "The", "whole", "content", "of", "the", "array", "definition", "is", "stripped", "from", "comments", "and", "excessive", "whitespaces", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L528-L567
27,761
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.arrayWhitespace
private function arrayWhitespace($loc): ?string { $tokens = $this->getTokenStream(); $type = $tokens->type($loc); switch ($type) { case T_DOUBLE_ARROW: return ' => '; case ',': return ', '; default: return $tokens->value($loc); } }
php
private function arrayWhitespace($loc): ?string { $tokens = $this->getTokenStream(); $type = $tokens->type($loc); switch ($type) { case T_DOUBLE_ARROW: return ' => '; case ',': return ', '; default: return $tokens->value($loc); } }
[ "private", "function", "arrayWhitespace", "(", "$", "loc", ")", ":", "?", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "type", "=", "$", "tokens", "->", "type", "(", "$", "loc", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "T_DOUBLE_ARROW", ":", "return", "' => '", ";", "case", "','", ":", "return", "', '", ";", "default", ":", "return", "$", "tokens", "->", "value", "(", "$", "loc", ")", ";", "}", "}" ]
Returns tokens found within an array definition PSR conforming whitespace to make the code more readable. @param int $loc location in the token stream @return string code with PSR spacing for array notation
[ "Returns", "tokens", "found", "within", "an", "array", "definition", "PSR", "conforming", "whitespace", "to", "make", "the", "code", "more", "readable", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L577-L589
27,762
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.parseHereNowDocConcat
private function parseHereNowDocConcat($loc): ?string { $tokens = $this->getTokenStream(); $type = substr($tokens->value($loc), 3, 1); $loc = $tokens->next($loc); if ($loc) { $string = substr($tokens->value($loc), 0, -1); if ($type === '\'') { return '\'' . implode('\' . "\n" . \'', explode("\n", $string)) . '\''; } return '"' . str_replace("\n", '\n', $string) . '"'; } return null; }
php
private function parseHereNowDocConcat($loc): ?string { $tokens = $this->getTokenStream(); $type = substr($tokens->value($loc), 3, 1); $loc = $tokens->next($loc); if ($loc) { $string = substr($tokens->value($loc), 0, -1); if ($type === '\'') { return '\'' . implode('\' . "\n" . \'', explode("\n", $string)) . '\''; } return '"' . str_replace("\n", '\n', $string) . '"'; } return null; }
[ "private", "function", "parseHereNowDocConcat", "(", "$", "loc", ")", ":", "?", "string", "{", "$", "tokens", "=", "$", "this", "->", "getTokenStream", "(", ")", ";", "$", "type", "=", "substr", "(", "$", "tokens", "->", "value", "(", "$", "loc", ")", ",", "3", ",", "1", ")", ";", "$", "loc", "=", "$", "tokens", "->", "next", "(", "$", "loc", ")", ";", "if", "(", "$", "loc", ")", "{", "$", "string", "=", "substr", "(", "$", "tokens", "->", "value", "(", "$", "loc", ")", ",", "0", ",", "-", "1", ")", ";", "if", "(", "$", "type", "===", "'\\''", ")", "{", "return", "'\\''", ".", "implode", "(", "'\\' . \"\\n\" . \\''", ",", "explode", "(", "\"\\n\"", ",", "$", "string", ")", ")", ".", "'\\''", ";", "}", "return", "'\"'", ".", "str_replace", "(", "\"\\n\"", ",", "'\\n'", ",", "$", "string", ")", ".", "'\"'", ";", "}", "return", "null", ";", "}" ]
Parse heredoc and nowdoc into a concatenated string representation to be useful for default values and inline assignment. @param int $loc @return string|null
[ "Parse", "heredoc", "and", "nowdoc", "into", "a", "concatenated", "string", "representation", "to", "be", "useful", "for", "default", "values", "and", "inline", "assignment", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L599-L615
27,763
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionClass.php
ReflectionClass.getTokenStream
private function getTokenStream(): TokenStream { if (null === $this->tokens) { $this->tokens = new TokenStream(file_get_contents($this->filename)); } return $this->tokens; }
php
private function getTokenStream(): TokenStream { if (null === $this->tokens) { $this->tokens = new TokenStream(file_get_contents($this->filename)); } return $this->tokens; }
[ "private", "function", "getTokenStream", "(", ")", ":", "TokenStream", "{", "if", "(", "null", "===", "$", "this", "->", "tokens", ")", "{", "$", "this", "->", "tokens", "=", "new", "TokenStream", "(", "file_get_contents", "(", "$", "this", "->", "filename", ")", ")", ";", "}", "return", "$", "this", "->", "tokens", ";", "}" ]
Returns the TokenStream instance for the class. @return TokenStream
[ "Returns", "the", "TokenStream", "instance", "for", "the", "class", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionClass.php#L622-L629
27,764
techdivision/import-product
src/Repositories/CacheWarmer/ProductCacheWarmer.php
ProductCacheWarmer.warm
public function warm() { // prepare the caches for the statements foreach ($this->repository->findAll() as $product) { // add the product to the cache, register the SKU reference as well $this->repository->toCache( $product[$this->repository->getPrimaryKeyName()], $product, array($product[MemberNames::SKU] => $product[$this->repository->getPrimaryKeyName()]) ); } }
php
public function warm() { // prepare the caches for the statements foreach ($this->repository->findAll() as $product) { // add the product to the cache, register the SKU reference as well $this->repository->toCache( $product[$this->repository->getPrimaryKeyName()], $product, array($product[MemberNames::SKU] => $product[$this->repository->getPrimaryKeyName()]) ); } }
[ "public", "function", "warm", "(", ")", "{", "// prepare the caches for the statements", "foreach", "(", "$", "this", "->", "repository", "->", "findAll", "(", ")", "as", "$", "product", ")", "{", "// add the product to the cache, register the SKU reference as well", "$", "this", "->", "repository", "->", "toCache", "(", "$", "product", "[", "$", "this", "->", "repository", "->", "getPrimaryKeyName", "(", ")", "]", ",", "$", "product", ",", "array", "(", "$", "product", "[", "MemberNames", "::", "SKU", "]", "=>", "$", "product", "[", "$", "this", "->", "repository", "->", "getPrimaryKeyName", "(", ")", "]", ")", ")", ";", "}", "}" ]
Warms the cache for the passed repository. @return void
[ "Warms", "the", "cache", "for", "the", "passed", "repository", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Repositories/CacheWarmer/ProductCacheWarmer.php#L61-L73
27,765
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Standard.php
Standard.deleteItems
protected function deleteItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) { $manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() ); if( ( $id = $view->param( 'id' ) ) == null ) { $body = (string) $request->getBody(); if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) || !is_array( $payload->data ) ) { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); } $ids = $this->getIds( $payload ); $manager->deleteItems( $ids ); $view->total = count( $ids ); } else { $manager->deleteItem( $id ); $view->total = 1; } return $response; }
php
protected function deleteItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) { $manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() ); if( ( $id = $view->param( 'id' ) ) == null ) { $body = (string) $request->getBody(); if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) || !is_array( $payload->data ) ) { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); } $ids = $this->getIds( $payload ); $manager->deleteItems( $ids ); $view->total = count( $ids ); } else { $manager->deleteItem( $id ); $view->total = 1; } return $response; }
[ "protected", "function", "deleteItems", "(", "\\", "Aimeos", "\\", "MW", "\\", "View", "\\", "Iface", "$", "view", ",", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getPath", "(", ")", ")", ";", "if", "(", "(", "$", "id", "=", "$", "view", "->", "param", "(", "'id'", ")", ")", "==", "null", ")", "{", "$", "body", "=", "(", "string", ")", "$", "request", "->", "getBody", "(", ")", ";", "if", "(", "(", "$", "payload", "=", "json_decode", "(", "$", "body", ")", ")", "===", "null", "||", "!", "isset", "(", "$", "payload", "->", "data", ")", "||", "!", "is_array", "(", "$", "payload", "->", "data", ")", ")", "{", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Exception", "(", "sprintf", "(", "'Invalid JSON in body'", ")", ",", "400", ")", ";", "}", "$", "ids", "=", "$", "this", "->", "getIds", "(", "$", "payload", ")", ";", "$", "manager", "->", "deleteItems", "(", "$", "ids", ")", ";", "$", "view", "->", "total", "=", "count", "(", "$", "ids", ")", ";", "}", "else", "{", "$", "manager", "->", "deleteItem", "(", "$", "id", ")", ";", "$", "view", "->", "total", "=", "1", ";", "}", "return", "$", "response", ";", "}" ]
Deletes one or more items @param \Aimeos\MW\View\Iface $view View instance with "param" view helper @param \Psr\Http\Message\ServerRequestInterface $request Request object @param \Psr\Http\Message\ResponseInterface $response Response object @return \Psr\Http\Message\ResponseInterface Modified response object @throws \Aimeos\Admin\JsonAdm\Exception If the request body is invalid
[ "Deletes", "one", "or", "more", "items" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Standard.php#L507-L530
27,766
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Standard.php
Standard.patchItems
protected function patchItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) { $body = (string) $request->getBody(); if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) ) { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); } $manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() ); if( is_array( $payload->data ) ) { $data = $this->saveData( $manager, $payload ); $view->data = $data; $view->total = count( $data ); $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); } elseif( ( $id = $view->param( 'id' ) ) != null ) { $payload->data->id = $id; $data = $this->saveEntry( $manager, $payload->data ); $view->data = $data; $view->total = 1; } else { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); } return $response; }
php
protected function patchItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) { $body = (string) $request->getBody(); if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) ) { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); } $manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() ); if( is_array( $payload->data ) ) { $data = $this->saveData( $manager, $payload ); $view->data = $data; $view->total = count( $data ); $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); } elseif( ( $id = $view->param( 'id' ) ) != null ) { $payload->data->id = $id; $data = $this->saveEntry( $manager, $payload->data ); $view->data = $data; $view->total = 1; } else { throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); } return $response; }
[ "protected", "function", "patchItems", "(", "\\", "Aimeos", "\\", "MW", "\\", "View", "\\", "Iface", "$", "view", ",", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "body", "=", "(", "string", ")", "$", "request", "->", "getBody", "(", ")", ";", "if", "(", "(", "$", "payload", "=", "json_decode", "(", "$", "body", ")", ")", "===", "null", "||", "!", "isset", "(", "$", "payload", "->", "data", ")", ")", "{", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Exception", "(", "sprintf", "(", "'Invalid JSON in body'", ")", ",", "400", ")", ";", "}", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getPath", "(", ")", ")", ";", "if", "(", "is_array", "(", "$", "payload", "->", "data", ")", ")", "{", "$", "data", "=", "$", "this", "->", "saveData", "(", "$", "manager", ",", "$", "payload", ")", ";", "$", "view", "->", "data", "=", "$", "data", ";", "$", "view", "->", "total", "=", "count", "(", "$", "data", ")", ";", "$", "response", "=", "$", "response", "->", "withHeader", "(", "'Content-Type'", ",", "'application/vnd.api+json; ext=\"bulk\"; supported-ext=\"bulk\"'", ")", ";", "}", "elseif", "(", "(", "$", "id", "=", "$", "view", "->", "param", "(", "'id'", ")", ")", "!=", "null", ")", "{", "$", "payload", "->", "data", "->", "id", "=", "$", "id", ";", "$", "data", "=", "$", "this", "->", "saveEntry", "(", "$", "manager", ",", "$", "payload", "->", "data", ")", ";", "$", "view", "->", "data", "=", "$", "data", ";", "$", "view", "->", "total", "=", "1", ";", "}", "else", "{", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Exception", "(", "sprintf", "(", "'No ID given'", ")", ",", "400", ")", ";", "}", "return", "$", "response", ";", "}" ]
Saves new attributes for one or more items @param \Aimeos\MW\View\Iface $view View that will contain the "data" and "total" properties afterwards @param \Psr\Http\Message\ServerRequestInterface $request Request object @param \Psr\Http\Message\ResponseInterface $response Response object @return \Psr\Http\Message\ResponseInterface Modified response object @throws \Aimeos\Admin\JsonAdm\Exception If "id" parameter isn't available or the body is invalid
[ "Saves", "new", "attributes", "for", "one", "or", "more", "items" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Standard.php#L585-L617
27,767
contributte/thepay-api
src/Helper/Merchant.php
Merchant.buildQuery
public function buildQuery(array $args = []): string { $out = array_merge( $this->payment->getArgs(), // Arguments of the payment $args, // Optional helper arguments ['signature' => $this->payment->getSignature()] // Signature ); $str = []; /** @var string|int $val */ foreach ($out as $key => $val) { $str[] = rawurlencode((string) $key) . '=' . rawurlencode((string) $val); } return implode('&', $str); }
php
public function buildQuery(array $args = []): string { $out = array_merge( $this->payment->getArgs(), // Arguments of the payment $args, // Optional helper arguments ['signature' => $this->payment->getSignature()] // Signature ); $str = []; /** @var string|int $val */ foreach ($out as $key => $val) { $str[] = rawurlencode((string) $key) . '=' . rawurlencode((string) $val); } return implode('&', $str); }
[ "public", "function", "buildQuery", "(", "array", "$", "args", "=", "[", "]", ")", ":", "string", "{", "$", "out", "=", "array_merge", "(", "$", "this", "->", "payment", "->", "getArgs", "(", ")", ",", "// Arguments of the payment", "$", "args", ",", "// Optional helper arguments", "[", "'signature'", "=>", "$", "this", "->", "payment", "->", "getSignature", "(", ")", "]", "// Signature", ")", ";", "$", "str", "=", "[", "]", ";", "/** @var string|int $val */", "foreach", "(", "$", "out", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "str", "[", "]", "=", "rawurlencode", "(", "(", "string", ")", "$", "key", ")", ".", "'='", ".", "rawurlencode", "(", "(", "string", ")", "$", "val", ")", ";", "}", "return", "implode", "(", "'&'", ",", "$", "str", ")", ";", "}" ]
Build the query part of the URL from payment data and optional helper data. @param array $args Associative array of optional arguments that should be appended to the URL. @return string Query part of the URL with all parameters correctly escaped
[ "Build", "the", "query", "part", "of", "the", "URL", "from", "payment", "data", "and", "optional", "helper", "data", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Helper/Merchant.php#L47-L62
27,768
contributte/thepay-api
src/Payment.php
Payment.getArgs
public function getArgs(): array { $input = []; $input['merchantId'] = $this->config->merchantId; $input['accountId'] = $this->config->accountId; $value = $this->value; if ($value !== null) { $input['value'] = number_format($value, 2, '.', ''); } if ($this->currency !== null) { $input['currency'] = $this->currency; } if ($this->description !== null) { $input['description'] = $this->description; } if ($this->merchantData !== null) { $input['merchantData'] = $this->merchantData; } if ($this->customerData !== null) { $input['customerData'] = $this->customerData; } if ($this->customerEmail !== null) { $input['customerEmail'] = $this->customerEmail; } if ($this->returnUrl !== null) { $input['returnUrl'] = $this->returnUrl; } if ($this->backToEshopUrl !== null) { $input['backToEshopUrl'] = $this->backToEshopUrl; } if ($this->methodId !== null) { $input['methodId'] = $this->methodId; } if ($this->deposit !== null) { $input['deposit'] = $this->getDeposit() ? '1' : '0'; } if ($this->isRecurring !== null) { $input['isRecurring'] = $this->getIsRecurring() ? '1' : '0'; } if ($this->merchantSpecificSymbol !== null) { $input['merchantSpecificSymbol'] = $this->merchantSpecificSymbol; } if ($this->eetDph !== null && !$this->eetDph->isEmpty()) { $input = array_merge($input, $this->eetDph->toArray()); } return $input; }
php
public function getArgs(): array { $input = []; $input['merchantId'] = $this->config->merchantId; $input['accountId'] = $this->config->accountId; $value = $this->value; if ($value !== null) { $input['value'] = number_format($value, 2, '.', ''); } if ($this->currency !== null) { $input['currency'] = $this->currency; } if ($this->description !== null) { $input['description'] = $this->description; } if ($this->merchantData !== null) { $input['merchantData'] = $this->merchantData; } if ($this->customerData !== null) { $input['customerData'] = $this->customerData; } if ($this->customerEmail !== null) { $input['customerEmail'] = $this->customerEmail; } if ($this->returnUrl !== null) { $input['returnUrl'] = $this->returnUrl; } if ($this->backToEshopUrl !== null) { $input['backToEshopUrl'] = $this->backToEshopUrl; } if ($this->methodId !== null) { $input['methodId'] = $this->methodId; } if ($this->deposit !== null) { $input['deposit'] = $this->getDeposit() ? '1' : '0'; } if ($this->isRecurring !== null) { $input['isRecurring'] = $this->getIsRecurring() ? '1' : '0'; } if ($this->merchantSpecificSymbol !== null) { $input['merchantSpecificSymbol'] = $this->merchantSpecificSymbol; } if ($this->eetDph !== null && !$this->eetDph->isEmpty()) { $input = array_merge($input, $this->eetDph->toArray()); } return $input; }
[ "public", "function", "getArgs", "(", ")", ":", "array", "{", "$", "input", "=", "[", "]", ";", "$", "input", "[", "'merchantId'", "]", "=", "$", "this", "->", "config", "->", "merchantId", ";", "$", "input", "[", "'accountId'", "]", "=", "$", "this", "->", "config", "->", "accountId", ";", "$", "value", "=", "$", "this", "->", "value", ";", "if", "(", "$", "value", "!==", "null", ")", "{", "$", "input", "[", "'value'", "]", "=", "number_format", "(", "$", "value", ",", "2", ",", "'.'", ",", "''", ")", ";", "}", "if", "(", "$", "this", "->", "currency", "!==", "null", ")", "{", "$", "input", "[", "'currency'", "]", "=", "$", "this", "->", "currency", ";", "}", "if", "(", "$", "this", "->", "description", "!==", "null", ")", "{", "$", "input", "[", "'description'", "]", "=", "$", "this", "->", "description", ";", "}", "if", "(", "$", "this", "->", "merchantData", "!==", "null", ")", "{", "$", "input", "[", "'merchantData'", "]", "=", "$", "this", "->", "merchantData", ";", "}", "if", "(", "$", "this", "->", "customerData", "!==", "null", ")", "{", "$", "input", "[", "'customerData'", "]", "=", "$", "this", "->", "customerData", ";", "}", "if", "(", "$", "this", "->", "customerEmail", "!==", "null", ")", "{", "$", "input", "[", "'customerEmail'", "]", "=", "$", "this", "->", "customerEmail", ";", "}", "if", "(", "$", "this", "->", "returnUrl", "!==", "null", ")", "{", "$", "input", "[", "'returnUrl'", "]", "=", "$", "this", "->", "returnUrl", ";", "}", "if", "(", "$", "this", "->", "backToEshopUrl", "!==", "null", ")", "{", "$", "input", "[", "'backToEshopUrl'", "]", "=", "$", "this", "->", "backToEshopUrl", ";", "}", "if", "(", "$", "this", "->", "methodId", "!==", "null", ")", "{", "$", "input", "[", "'methodId'", "]", "=", "$", "this", "->", "methodId", ";", "}", "if", "(", "$", "this", "->", "deposit", "!==", "null", ")", "{", "$", "input", "[", "'deposit'", "]", "=", "$", "this", "->", "getDeposit", "(", ")", "?", "'1'", ":", "'0'", ";", "}", "if", "(", "$", "this", "->", "isRecurring", "!==", "null", ")", "{", "$", "input", "[", "'isRecurring'", "]", "=", "$", "this", "->", "getIsRecurring", "(", ")", "?", "'1'", ":", "'0'", ";", "}", "if", "(", "$", "this", "->", "merchantSpecificSymbol", "!==", "null", ")", "{", "$", "input", "[", "'merchantSpecificSymbol'", "]", "=", "$", "this", "->", "merchantSpecificSymbol", ";", "}", "if", "(", "$", "this", "->", "eetDph", "!==", "null", "&&", "!", "$", "this", "->", "eetDph", "->", "isEmpty", "(", ")", ")", "{", "$", "input", "=", "array_merge", "(", "$", "input", ",", "$", "this", "->", "eetDph", "->", "toArray", "(", ")", ")", ";", "}", "return", "$", "input", ";", "}" ]
List arguments to put into the URL. Returns associative array of arguments that should be contained in the ThePay gate call. @return mixed[]
[ "List", "arguments", "to", "put", "into", "the", "URL", ".", "Returns", "associative", "array", "of", "arguments", "that", "should", "be", "contained", "in", "the", "ThePay", "gate", "call", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Payment.php#L323-L384
27,769
contributte/thepay-api
src/Payment.php
Payment.getSignature
public function getSignature(): string { $input = $this->getArgs(); $items = []; foreach ($input as $key => $val) { $items[] = sprintf('%s=%s', $key, $val); } $items[] = 'password=' . $this->getMerchantConfig()->password; return self::hashFunction(implode('&', $items)); }
php
public function getSignature(): string { $input = $this->getArgs(); $items = []; foreach ($input as $key => $val) { $items[] = sprintf('%s=%s', $key, $val); } $items[] = 'password=' . $this->getMerchantConfig()->password; return self::hashFunction(implode('&', $items)); }
[ "public", "function", "getSignature", "(", ")", ":", "string", "{", "$", "input", "=", "$", "this", "->", "getArgs", "(", ")", ";", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "input", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "items", "[", "]", "=", "sprintf", "(", "'%s=%s'", ",", "$", "key", ",", "$", "val", ")", ";", "}", "$", "items", "[", "]", "=", "'password='", ".", "$", "this", "->", "getMerchantConfig", "(", ")", "->", "password", ";", "return", "self", "::", "hashFunction", "(", "implode", "(", "'&'", ",", "$", "items", ")", ")", ";", "}" ]
Returns signature to authenticate the payment. The signature consists of hash of all specified parameters and the merchant password specified in the configuration. So no one can alter the payment, because the password is not known.
[ "Returns", "signature", "to", "authenticate", "the", "payment", ".", "The", "signature", "consists", "of", "hash", "of", "all", "specified", "parameters", "and", "the", "merchant", "password", "specified", "in", "the", "configuration", ".", "So", "no", "one", "can", "alter", "the", "payment", "because", "the", "password", "is", "not", "known", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Payment.php#L392-L404
27,770
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.wasAccepted
public function wasAccepted() { if ( $this->hasErrors() ) { return false; } $aResponse = $this->getResponse(); if ( !empty( $aResponse['pm_order_status'] ) && $aResponse['pm_order_status'] === 'ACCEPTED' ) { return true; } return false; }
php
public function wasAccepted() { if ( $this->hasErrors() ) { return false; } $aResponse = $this->getResponse(); if ( !empty( $aResponse['pm_order_status'] ) && $aResponse['pm_order_status'] === 'ACCEPTED' ) { return true; } return false; }
[ "public", "function", "wasAccepted", "(", ")", "{", "if", "(", "$", "this", "->", "hasErrors", "(", ")", ")", "{", "return", "false", ";", "}", "$", "aResponse", "=", "$", "this", "->", "getResponse", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "aResponse", "[", "'pm_order_status'", "]", ")", "&&", "$", "aResponse", "[", "'pm_order_status'", "]", "===", "'ACCEPTED'", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check of order was accepted with no error codes. @return bool
[ "Check", "of", "order", "was", "accepted", "with", "no", "error", "codes", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L170-L183
27,771
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.getErrorCodeFromResponseData
public function getErrorCodeFromResponseData( array $aResponseData ) { foreach ( $aResponseData as $sKey => $iValue ) { if ( preg_match( '/error_(\d+)_code/', $sKey ) ) { return (int) $iValue; } } return 999; // UNEXPECTED_ERROR }
php
public function getErrorCodeFromResponseData( array $aResponseData ) { foreach ( $aResponseData as $sKey => $iValue ) { if ( preg_match( '/error_(\d+)_code/', $sKey ) ) { return (int) $iValue; } } return 999; // UNEXPECTED_ERROR }
[ "public", "function", "getErrorCodeFromResponseData", "(", "array", "$", "aResponseData", ")", "{", "foreach", "(", "$", "aResponseData", "as", "$", "sKey", "=>", "$", "iValue", ")", "{", "if", "(", "preg_match", "(", "'/error_(\\d+)_code/'", ",", "$", "sKey", ")", ")", "{", "return", "(", "int", ")", "$", "iValue", ";", "}", "}", "return", "999", ";", "// UNEXPECTED_ERROR", "}" ]
Returns first match of client error code. @param array $aResponseData @return integer
[ "Returns", "first", "match", "of", "client", "error", "code", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L192-L201
27,772
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.getDeclinationDataFromResponse
public function getDeclinationDataFromResponse() { $aDeclinationData = array(); $aResponse = $this->getResponse(); $aExpectedKeys = array('paymentMethod_name', 'paymentMethod_status', 'paymentMethod_declineType'); foreach ( $aExpectedKeys as $sKey ) { if ( array_key_exists( $sKey, $aResponse ) ) { $aDeclinationData[$sKey] = $aResponse[$sKey]; } } return $aDeclinationData; }
php
public function getDeclinationDataFromResponse() { $aDeclinationData = array(); $aResponse = $this->getResponse(); $aExpectedKeys = array('paymentMethod_name', 'paymentMethod_status', 'paymentMethod_declineType'); foreach ( $aExpectedKeys as $sKey ) { if ( array_key_exists( $sKey, $aResponse ) ) { $aDeclinationData[$sKey] = $aResponse[$sKey]; } } return $aDeclinationData; }
[ "public", "function", "getDeclinationDataFromResponse", "(", ")", "{", "$", "aDeclinationData", "=", "array", "(", ")", ";", "$", "aResponse", "=", "$", "this", "->", "getResponse", "(", ")", ";", "$", "aExpectedKeys", "=", "array", "(", "'paymentMethod_name'", ",", "'paymentMethod_status'", ",", "'paymentMethod_declineType'", ")", ";", "foreach", "(", "$", "aExpectedKeys", "as", "$", "sKey", ")", "{", "if", "(", "array_key_exists", "(", "$", "sKey", ",", "$", "aResponse", ")", ")", "{", "$", "aDeclinationData", "[", "$", "sKey", "]", "=", "$", "aResponse", "[", "$", "sKey", "]", ";", "}", "}", "return", "$", "aDeclinationData", ";", "}" ]
Collects payment method data from order declination response. @return array
[ "Collects", "payment", "method", "data", "from", "order", "declination", "response", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L208-L221
27,773
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.parseGetConfigurationResponse
public function parseGetConfigurationResponse( array $aResponseData ) { $aConfigurationData = array(); $iKey = 1; $iMaxIterations = 10000; while ( !empty( $aResponseData["pm_configuration_${iKey}_key"] ) and ( $iKey <= $iMaxIterations ) ) { $aConfigurationData[$aResponseData["pm_configuration_${iKey}_key"]] = isset( $aResponseData["pm_configuration_${iKey}_value"] ) ? trim( (string) $aResponseData["pm_configuration_${iKey}_value"] ) : ''; $iKey++; } return $aConfigurationData; }
php
public function parseGetConfigurationResponse( array $aResponseData ) { $aConfigurationData = array(); $iKey = 1; $iMaxIterations = 10000; while ( !empty( $aResponseData["pm_configuration_${iKey}_key"] ) and ( $iKey <= $iMaxIterations ) ) { $aConfigurationData[$aResponseData["pm_configuration_${iKey}_key"]] = isset( $aResponseData["pm_configuration_${iKey}_value"] ) ? trim( (string) $aResponseData["pm_configuration_${iKey}_value"] ) : ''; $iKey++; } return $aConfigurationData; }
[ "public", "function", "parseGetConfigurationResponse", "(", "array", "$", "aResponseData", ")", "{", "$", "aConfigurationData", "=", "array", "(", ")", ";", "$", "iKey", "=", "1", ";", "$", "iMaxIterations", "=", "10000", ";", "while", "(", "!", "empty", "(", "$", "aResponseData", "[", "\"pm_configuration_${iKey}_key\"", "]", ")", "and", "(", "$", "iKey", "<=", "$", "iMaxIterations", ")", ")", "{", "$", "aConfigurationData", "[", "$", "aResponseData", "[", "\"pm_configuration_${iKey}_key\"", "]", "]", "=", "isset", "(", "$", "aResponseData", "[", "\"pm_configuration_${iKey}_value\"", "]", ")", "?", "trim", "(", "(", "string", ")", "$", "aResponseData", "[", "\"pm_configuration_${iKey}_value\"", "]", ")", ":", "''", ";", "$", "iKey", "++", ";", "}", "return", "$", "aConfigurationData", ";", "}" ]
Parse getConfiguration call response for Paymorrow settings. @param array $aResponseData @return array Assoc array with key as setting name for each corresponding value.
[ "Parse", "getConfiguration", "call", "response", "for", "Paymorrow", "settings", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L249-L264
27,774
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.handlePrepareOrderResponseOK
public function handlePrepareOrderResponseOK( $aResponseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aResponseData, 'PM_handlePrepareOrderResponseOK' ); $this->setResponse( $aResponseData ); // Trigger user profile update using normalized response data oxRegistry::get( 'OxpsPaymorrowModule' )->updateProfile( $aResponseData ); return true; }
php
public function handlePrepareOrderResponseOK( $aResponseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aResponseData, 'PM_handlePrepareOrderResponseOK' ); $this->setResponse( $aResponseData ); // Trigger user profile update using normalized response data oxRegistry::get( 'OxpsPaymorrowModule' )->updateProfile( $aResponseData ); return true; }
[ "public", "function", "handlePrepareOrderResponseOK", "(", "$", "aResponseData", ")", "{", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "aResponseData", ",", "'PM_handlePrepareOrderResponseOK'", ")", ";", "$", "this", "->", "setResponse", "(", "$", "aResponseData", ")", ";", "// Trigger user profile update using normalized response data", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowModule'", ")", "->", "updateProfile", "(", "$", "aResponseData", ")", ";", "return", "true", ";", "}" ]
Order preparation successful response handler. @param array $aResponseData @return bool
[ "Order", "preparation", "successful", "response", "handler", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L273-L282
27,775
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.handleConfirmOrderResponseOK
public function handleConfirmOrderResponseOK( $responseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $responseData, 'PM_handleConfirmOrderResponseOK' ); $this->setResponse( $responseData ); return true; }
php
public function handleConfirmOrderResponseOK( $responseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $responseData, 'PM_handleConfirmOrderResponseOK' ); $this->setResponse( $responseData ); return true; }
[ "public", "function", "handleConfirmOrderResponseOK", "(", "$", "responseData", ")", "{", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "responseData", ",", "'PM_handleConfirmOrderResponseOK'", ")", ";", "$", "this", "->", "setResponse", "(", "$", "responseData", ")", ";", "return", "true", ";", "}" ]
Order confirmation successful response handler. @param array $responseData @return bool
[ "Order", "confirmation", "successful", "response", "handler", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L305-L311
27,776
OXID-eSales/paymorrow-module
core/oxpspaymorrowresponsehandler.php
OxpsPaymorrowResponseHandler.handleConfirmOrderResponseError
public function handleConfirmOrderResponseError( $responseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $responseData, 'PM_handleConfirmOrderResponseError' ); $this->setResponse( $responseData ); $this->setErrorCode( $this->getErrorCodeFromResponseData( $responseData ) ); return false; }
php
public function handleConfirmOrderResponseError( $responseData ) { oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $responseData, 'PM_handleConfirmOrderResponseError' ); $this->setResponse( $responseData ); $this->setErrorCode( $this->getErrorCodeFromResponseData( $responseData ) ); return false; }
[ "public", "function", "handleConfirmOrderResponseError", "(", "$", "responseData", ")", "{", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "responseData", ",", "'PM_handleConfirmOrderResponseError'", ")", ";", "$", "this", "->", "setResponse", "(", "$", "responseData", ")", ";", "$", "this", "->", "setErrorCode", "(", "$", "this", "->", "getErrorCodeFromResponseData", "(", "$", "responseData", ")", ")", ";", "return", "false", ";", "}" ]
Order confirmation error response handler. @param array $responseData @return bool
[ "Order", "confirmation", "error", "response", "handler", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresponsehandler.php#L320-L327
27,777
moodev/php-weasel
lib/Weasel/JsonMarshaller/Config/ClassAnnotationDriver.php
ClassAnnotationDriver._getSubClassName
protected function _getSubClassName(\ReflectionClass $rClass) { $subClassReader = $this->annotationReaderFactory->getReaderForClass($rClass); /** * @var Annotations\JsonTypeName $subNameA */ $subNameA = $subClassReader->getSingleClassAnnotation($this->annNS . 'JsonTypeName'); if (isset($subNameA)) { return $subNameA->getName(); } else { return $rClass->getName(); } }
php
protected function _getSubClassName(\ReflectionClass $rClass) { $subClassReader = $this->annotationReaderFactory->getReaderForClass($rClass); /** * @var Annotations\JsonTypeName $subNameA */ $subNameA = $subClassReader->getSingleClassAnnotation($this->annNS . 'JsonTypeName'); if (isset($subNameA)) { return $subNameA->getName(); } else { return $rClass->getName(); } }
[ "protected", "function", "_getSubClassName", "(", "\\", "ReflectionClass", "$", "rClass", ")", "{", "$", "subClassReader", "=", "$", "this", "->", "annotationReaderFactory", "->", "getReaderForClass", "(", "$", "rClass", ")", ";", "/**\n * @var Annotations\\JsonTypeName $subNameA\n */", "$", "subNameA", "=", "$", "subClassReader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonTypeName'", ")", ";", "if", "(", "isset", "(", "$", "subNameA", ")", ")", "{", "return", "$", "subNameA", "->", "getName", "(", ")", ";", "}", "else", "{", "return", "$", "rClass", "->", "getName", "(", ")", ";", "}", "}" ]
Find out what name we should use to referr to one of our subtypes. @param \ReflectionClass $rClass @return string
[ "Find", "out", "what", "name", "we", "should", "use", "to", "referr", "to", "one", "of", "our", "subtypes", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/Config/ClassAnnotationDriver.php#L343-L356
27,778
moodev/php-weasel
lib/Weasel/JsonMarshaller/Config/ClassAnnotationDriver.php
ClassAnnotationDriver.getConfig
public function getConfig() { $this->config = new ClassMarshaller(); $this->config->serialization = new Serialization\ClassSerialization(); $this->config->deserialization = new Deserialization\ClassDeserialization(); $reader = $this->_getAnnotationReader(); /** * @var \Weasel\JsonMarshaller\Config\Annotations\JsonInclude $includer */ $includer = $reader->getSingleClassAnnotation($this->annNS . 'JsonInclude'); $this->config->serialization->include = $this->_getIncluderValue($includer); /** * Work out what the class' "name" is, just in case inheritance is needed. * @var \Weasel\JsonMarshaller\Config\Annotations\JsonTypeName $typeNamer */ $typeNamer = $reader->getSingleClassAnnotation($this->annNS . 'JsonTypeName'); $name = null; if (isset($typeNamer)) { $name = $typeNamer->getName(); } if (empty($name)) { // Default to the unqualified class name $name = $this->rClass->getName(); } $this->config->deserialization->name = $name; /** * @var Annotations\JsonTypeInfo $typeInfo * @var Annotations\JsonSubTypes $subTypes */ $typeInfo = $reader->getSingleClassAnnotation($this->annNS . 'JsonTypeInfo'); $subTypes = $reader->getSingleClassAnnotation($this->annNS . 'JsonSubTypes'); $this->config->deserialization->typeInfo = $this->_getDeserializationTypeInfo($typeInfo, $subTypes); $this->config->serialization->typeInfo = $this->_getSerializationTypeInfo($typeInfo, $subTypes); $methods = $this->rClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { $this->_configureMethod($method); } $properties = $this->rClass->getProperties(\ReflectionProperty::IS_PUBLIC & ~\ReflectionProperty::IS_STATIC); foreach ($properties as $property) { $this->_configureProperty($property); } /** * @var \Weasel\JsonMarshaller\Config\Annotations\JsonIgnoreProperties $ignorer */ $ignorer = $reader->getSingleClassAnnotation($this->annNS . 'JsonIgnoreProperties'); if (!empty($ignorer)) { // The ignorer config affects which properties we will consider. $this->config->deserialization->ignoreUnknown = $ignorer->getIgnoreUnknown(); $this->config->deserialization->ignoreProperties = $ignorer->getNames(); } return $this->config; }
php
public function getConfig() { $this->config = new ClassMarshaller(); $this->config->serialization = new Serialization\ClassSerialization(); $this->config->deserialization = new Deserialization\ClassDeserialization(); $reader = $this->_getAnnotationReader(); /** * @var \Weasel\JsonMarshaller\Config\Annotations\JsonInclude $includer */ $includer = $reader->getSingleClassAnnotation($this->annNS . 'JsonInclude'); $this->config->serialization->include = $this->_getIncluderValue($includer); /** * Work out what the class' "name" is, just in case inheritance is needed. * @var \Weasel\JsonMarshaller\Config\Annotations\JsonTypeName $typeNamer */ $typeNamer = $reader->getSingleClassAnnotation($this->annNS . 'JsonTypeName'); $name = null; if (isset($typeNamer)) { $name = $typeNamer->getName(); } if (empty($name)) { // Default to the unqualified class name $name = $this->rClass->getName(); } $this->config->deserialization->name = $name; /** * @var Annotations\JsonTypeInfo $typeInfo * @var Annotations\JsonSubTypes $subTypes */ $typeInfo = $reader->getSingleClassAnnotation($this->annNS . 'JsonTypeInfo'); $subTypes = $reader->getSingleClassAnnotation($this->annNS . 'JsonSubTypes'); $this->config->deserialization->typeInfo = $this->_getDeserializationTypeInfo($typeInfo, $subTypes); $this->config->serialization->typeInfo = $this->_getSerializationTypeInfo($typeInfo, $subTypes); $methods = $this->rClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { $this->_configureMethod($method); } $properties = $this->rClass->getProperties(\ReflectionProperty::IS_PUBLIC & ~\ReflectionProperty::IS_STATIC); foreach ($properties as $property) { $this->_configureProperty($property); } /** * @var \Weasel\JsonMarshaller\Config\Annotations\JsonIgnoreProperties $ignorer */ $ignorer = $reader->getSingleClassAnnotation($this->annNS . 'JsonIgnoreProperties'); if (!empty($ignorer)) { // The ignorer config affects which properties we will consider. $this->config->deserialization->ignoreUnknown = $ignorer->getIgnoreUnknown(); $this->config->deserialization->ignoreProperties = $ignorer->getNames(); } return $this->config; }
[ "public", "function", "getConfig", "(", ")", "{", "$", "this", "->", "config", "=", "new", "ClassMarshaller", "(", ")", ";", "$", "this", "->", "config", "->", "serialization", "=", "new", "Serialization", "\\", "ClassSerialization", "(", ")", ";", "$", "this", "->", "config", "->", "deserialization", "=", "new", "Deserialization", "\\", "ClassDeserialization", "(", ")", ";", "$", "reader", "=", "$", "this", "->", "_getAnnotationReader", "(", ")", ";", "/**\n * @var \\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonInclude $includer\n */", "$", "includer", "=", "$", "reader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonInclude'", ")", ";", "$", "this", "->", "config", "->", "serialization", "->", "include", "=", "$", "this", "->", "_getIncluderValue", "(", "$", "includer", ")", ";", "/**\n * Work out what the class' \"name\" is, just in case inheritance is needed.\n * @var \\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonTypeName $typeNamer\n */", "$", "typeNamer", "=", "$", "reader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonTypeName'", ")", ";", "$", "name", "=", "null", ";", "if", "(", "isset", "(", "$", "typeNamer", ")", ")", "{", "$", "name", "=", "$", "typeNamer", "->", "getName", "(", ")", ";", "}", "if", "(", "empty", "(", "$", "name", ")", ")", "{", "// Default to the unqualified class name", "$", "name", "=", "$", "this", "->", "rClass", "->", "getName", "(", ")", ";", "}", "$", "this", "->", "config", "->", "deserialization", "->", "name", "=", "$", "name", ";", "/**\n * @var Annotations\\JsonTypeInfo $typeInfo\n * @var Annotations\\JsonSubTypes $subTypes\n */", "$", "typeInfo", "=", "$", "reader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonTypeInfo'", ")", ";", "$", "subTypes", "=", "$", "reader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonSubTypes'", ")", ";", "$", "this", "->", "config", "->", "deserialization", "->", "typeInfo", "=", "$", "this", "->", "_getDeserializationTypeInfo", "(", "$", "typeInfo", ",", "$", "subTypes", ")", ";", "$", "this", "->", "config", "->", "serialization", "->", "typeInfo", "=", "$", "this", "->", "_getSerializationTypeInfo", "(", "$", "typeInfo", ",", "$", "subTypes", ")", ";", "$", "methods", "=", "$", "this", "->", "rClass", "->", "getMethods", "(", "\\", "ReflectionMethod", "::", "IS_PUBLIC", ")", ";", "foreach", "(", "$", "methods", "as", "$", "method", ")", "{", "$", "this", "->", "_configureMethod", "(", "$", "method", ")", ";", "}", "$", "properties", "=", "$", "this", "->", "rClass", "->", "getProperties", "(", "\\", "ReflectionProperty", "::", "IS_PUBLIC", "&", "~", "\\", "ReflectionProperty", "::", "IS_STATIC", ")", ";", "foreach", "(", "$", "properties", "as", "$", "property", ")", "{", "$", "this", "->", "_configureProperty", "(", "$", "property", ")", ";", "}", "/**\n * @var \\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonIgnoreProperties $ignorer\n */", "$", "ignorer", "=", "$", "reader", "->", "getSingleClassAnnotation", "(", "$", "this", "->", "annNS", ".", "'JsonIgnoreProperties'", ")", ";", "if", "(", "!", "empty", "(", "$", "ignorer", ")", ")", "{", "// The ignorer config affects which properties we will consider.", "$", "this", "->", "config", "->", "deserialization", "->", "ignoreUnknown", "=", "$", "ignorer", "->", "getIgnoreUnknown", "(", ")", ";", "$", "this", "->", "config", "->", "deserialization", "->", "ignoreProperties", "=", "$", "ignorer", "->", "getNames", "(", ")", ";", "}", "return", "$", "this", "->", "config", ";", "}" ]
Get the config for the current class. @return ClassMarshaller A populated ClassMarshaller config object.
[ "Get", "the", "config", "for", "the", "current", "class", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/Config/ClassAnnotationDriver.php#L543-L605
27,779
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy.prepareOrder
public function prepareOrder( array $aPostData, $blSettingsUpdated = false ) { // Update user profile with values user entered to Paymorrow form $this->_updateUserData( $aPostData ); // Reset payment method in session and basket on its change $this->_resetPaymentMethod( $aPostData ); // Send order preparation.verification request $aResponse = $this->_getRequestController()->pmVerify( $aPostData ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aPostData, 'Proxy-prepareOrderPOST' ); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); $iResponseErrorCore = $oResponseHandler->getErrorCodeFromResponseData( $aResponse ); // Check of response is an error with configuration update error code 900 if ( ( $iResponseErrorCore === 900 ) and empty( $blSettingsUpdated ) ) { // Call module settings update in case error code 900 received oxRegistry::get( 'OxpsPaymorrowModule' )->updateSettings(); // Call the request again return $this->prepareOrder( $aPostData, true ); } return json_encode( $aResponse ); }
php
public function prepareOrder( array $aPostData, $blSettingsUpdated = false ) { // Update user profile with values user entered to Paymorrow form $this->_updateUserData( $aPostData ); // Reset payment method in session and basket on its change $this->_resetPaymentMethod( $aPostData ); // Send order preparation.verification request $aResponse = $this->_getRequestController()->pmVerify( $aPostData ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aPostData, 'Proxy-prepareOrderPOST' ); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); $iResponseErrorCore = $oResponseHandler->getErrorCodeFromResponseData( $aResponse ); // Check of response is an error with configuration update error code 900 if ( ( $iResponseErrorCore === 900 ) and empty( $blSettingsUpdated ) ) { // Call module settings update in case error code 900 received oxRegistry::get( 'OxpsPaymorrowModule' )->updateSettings(); // Call the request again return $this->prepareOrder( $aPostData, true ); } return json_encode( $aResponse ); }
[ "public", "function", "prepareOrder", "(", "array", "$", "aPostData", ",", "$", "blSettingsUpdated", "=", "false", ")", "{", "// Update user profile with values user entered to Paymorrow form", "$", "this", "->", "_updateUserData", "(", "$", "aPostData", ")", ";", "// Reset payment method in session and basket on its change", "$", "this", "->", "_resetPaymentMethod", "(", "$", "aPostData", ")", ";", "// Send order preparation.verification request", "$", "aResponse", "=", "$", "this", "->", "_getRequestController", "(", ")", "->", "pmVerify", "(", "$", "aPostData", ")", ";", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "aPostData", ",", "'Proxy-prepareOrderPOST'", ")", ";", "/** @var OxpsPaymorrowResponseHandler $oResponseHandler */", "$", "oResponseHandler", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowResponseHandler'", ")", ";", "$", "iResponseErrorCore", "=", "$", "oResponseHandler", "->", "getErrorCodeFromResponseData", "(", "$", "aResponse", ")", ";", "// Check of response is an error with configuration update error code 900", "if", "(", "(", "$", "iResponseErrorCore", "===", "900", ")", "and", "empty", "(", "$", "blSettingsUpdated", ")", ")", "{", "// Call module settings update in case error code 900 received", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowModule'", ")", "->", "updateSettings", "(", ")", ";", "// Call the request again", "return", "$", "this", "->", "prepareOrder", "(", "$", "aPostData", ",", "true", ")", ";", "}", "return", "json_encode", "(", "$", "aResponse", ")", ";", "}" ]
Order preparation call. Also perform configuration update on error code 900 received and calls the request again one time. @param array $aPostData @param bool $blSettingsUpdated If true, then settings update is not called again. @return string
[ "Order", "preparation", "call", ".", "Also", "perform", "configuration", "update", "on", "error", "code", "900", "received", "and", "calls", "the", "request", "again", "one", "time", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L64-L91
27,780
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy.validatePendingOrder
public function validatePendingOrder() { /** @var OxpsPaymorrowEshopDataProvider $dataProvider */ $dataProvider = oxNew( 'OxpsPaymorrowEshopDataProvider' ); $data = $dataProvider->collectEshopData(); // Combine basket data and payment session data $session = $this->getConfig()->getSession(); $sessionData = (array) $session->getVariable( 'pm_verify' ); $data = array_merge( $data, $sessionData ); // Send order preparation/verification request $aResponse = $this->_getRequestController()->pmVerify( $data ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $data, 'Proxy-prepareOrderPOST_reValidate' ); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); $oResponseHandler->setResponse( $aResponse ); return (bool) $oResponseHandler->wasAccepted(); }
php
public function validatePendingOrder() { /** @var OxpsPaymorrowEshopDataProvider $dataProvider */ $dataProvider = oxNew( 'OxpsPaymorrowEshopDataProvider' ); $data = $dataProvider->collectEshopData(); // Combine basket data and payment session data $session = $this->getConfig()->getSession(); $sessionData = (array) $session->getVariable( 'pm_verify' ); $data = array_merge( $data, $sessionData ); // Send order preparation/verification request $aResponse = $this->_getRequestController()->pmVerify( $data ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $data, 'Proxy-prepareOrderPOST_reValidate' ); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxRegistry::get( 'OxpsPaymorrowResponseHandler' ); $oResponseHandler->setResponse( $aResponse ); return (bool) $oResponseHandler->wasAccepted(); }
[ "public", "function", "validatePendingOrder", "(", ")", "{", "/** @var OxpsPaymorrowEshopDataProvider $dataProvider */", "$", "dataProvider", "=", "oxNew", "(", "'OxpsPaymorrowEshopDataProvider'", ")", ";", "$", "data", "=", "$", "dataProvider", "->", "collectEshopData", "(", ")", ";", "// Combine basket data and payment session data", "$", "session", "=", "$", "this", "->", "getConfig", "(", ")", "->", "getSession", "(", ")", ";", "$", "sessionData", "=", "(", "array", ")", "$", "session", "->", "getVariable", "(", "'pm_verify'", ")", ";", "$", "data", "=", "array_merge", "(", "$", "data", ",", "$", "sessionData", ")", ";", "// Send order preparation/verification request", "$", "aResponse", "=", "$", "this", "->", "_getRequestController", "(", ")", "->", "pmVerify", "(", "$", "data", ")", ";", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "data", ",", "'Proxy-prepareOrderPOST_reValidate'", ")", ";", "/** @var OxpsPaymorrowResponseHandler $oResponseHandler */", "$", "oResponseHandler", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowResponseHandler'", ")", ";", "$", "oResponseHandler", "->", "setResponse", "(", "$", "aResponse", ")", ";", "return", "(", "bool", ")", "$", "oResponseHandler", "->", "wasAccepted", "(", ")", ";", "}" ]
Collect current basket data and make verification API call. Method is independent from JS of front-end forms, so marks terms and conditions as accepted. It should be used to re-validate already verified order, which user accepted on checkout payment step. @return bool
[ "Collect", "current", "basket", "data", "and", "make", "verification", "API", "call", ".", "Method", "is", "independent", "from", "JS", "of", "front", "-", "end", "forms", "so", "marks", "terms", "and", "conditions", "as", "accepted", ".", "It", "should", "be", "used", "to", "re", "-", "validate", "already", "verified", "order", "which", "user", "accepted", "on", "checkout", "payment", "step", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L100-L120
27,781
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy._updateUserData
public function _updateUserData( array $aPostData ) { if ( $oUser = $this->_updateUserProfileData( $aPostData ) ) { $this->_updateUserActiveShippingAddress( $oUser, $aPostData ); } }
php
public function _updateUserData( array $aPostData ) { if ( $oUser = $this->_updateUserProfileData( $aPostData ) ) { $this->_updateUserActiveShippingAddress( $oUser, $aPostData ); } }
[ "public", "function", "_updateUserData", "(", "array", "$", "aPostData", ")", "{", "if", "(", "$", "oUser", "=", "$", "this", "->", "_updateUserProfileData", "(", "$", "aPostData", ")", ")", "{", "$", "this", "->", "_updateUserActiveShippingAddress", "(", "$", "oUser", ",", "$", "aPostData", ")", ";", "}", "}" ]
Update user profile with data posted from Paymorrow form. @nice-to-have: Adjust unit tests to proxy class and make method protected. @param array $aPostData
[ "Update", "user", "profile", "with", "data", "posted", "from", "Paymorrow", "form", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L145-L150
27,782
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy._resetPaymentMethod
public function _resetPaymentMethod( array $aPostData ) { $oSession = oxRegistry::getSession(); if ( $oSession->getVariable( 'paymentid' ) and array_key_exists( 'paymentid', $aPostData ) and ( $oSession->getVariable( 'paymentid' ) != $aPostData['paymentid'] ) ) { // Remove previous method from sessions $oSession->deleteVariable( 'paymentid' ); // Adjust basket by removing payment surcharge and recalculating the basket $oBasket = $oSession->getBasket(); $oBasket->setPayment(); $oBasket->setCost( 'oxpayment' ); $oBasket->calculateBasket( true ); } }
php
public function _resetPaymentMethod( array $aPostData ) { $oSession = oxRegistry::getSession(); if ( $oSession->getVariable( 'paymentid' ) and array_key_exists( 'paymentid', $aPostData ) and ( $oSession->getVariable( 'paymentid' ) != $aPostData['paymentid'] ) ) { // Remove previous method from sessions $oSession->deleteVariable( 'paymentid' ); // Adjust basket by removing payment surcharge and recalculating the basket $oBasket = $oSession->getBasket(); $oBasket->setPayment(); $oBasket->setCost( 'oxpayment' ); $oBasket->calculateBasket( true ); } }
[ "public", "function", "_resetPaymentMethod", "(", "array", "$", "aPostData", ")", "{", "$", "oSession", "=", "oxRegistry", "::", "getSession", "(", ")", ";", "if", "(", "$", "oSession", "->", "getVariable", "(", "'paymentid'", ")", "and", "array_key_exists", "(", "'paymentid'", ",", "$", "aPostData", ")", "and", "(", "$", "oSession", "->", "getVariable", "(", "'paymentid'", ")", "!=", "$", "aPostData", "[", "'paymentid'", "]", ")", ")", "{", "// Remove previous method from sessions", "$", "oSession", "->", "deleteVariable", "(", "'paymentid'", ")", ";", "// Adjust basket by removing payment surcharge and recalculating the basket", "$", "oBasket", "=", "$", "oSession", "->", "getBasket", "(", ")", ";", "$", "oBasket", "->", "setPayment", "(", ")", ";", "$", "oBasket", "->", "setCost", "(", "'oxpayment'", ")", ";", "$", "oBasket", "->", "calculateBasket", "(", "true", ")", ";", "}", "}" ]
Reset changed payment method selection in session for payment surcharge calculation to be valid. If selected method is not the same as in session, it removes session data and adjusts basket calculation. @param array $aPostData
[ "Reset", "changed", "payment", "method", "selection", "in", "session", "for", "payment", "surcharge", "calculation", "to", "be", "valid", ".", "If", "selected", "method", "is", "not", "the", "same", "as", "in", "session", "it", "removes", "session", "data", "and", "adjusts", "basket", "calculation", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L158-L175
27,783
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy._updateUserProfileData
protected function _updateUserProfileData( array $aPostData ) { /** @var OxpsPaymorrowOxUser|oxUser $oUser */ $oUser = $this->getUser(); if ( empty( $oUser ) or !( $oUser instanceof oxUser ) or !$oUser->getId() ) { return false; } $oUser->mapToProfileDataAndUpdateUser( $aPostData ); return $oUser; }
php
protected function _updateUserProfileData( array $aPostData ) { /** @var OxpsPaymorrowOxUser|oxUser $oUser */ $oUser = $this->getUser(); if ( empty( $oUser ) or !( $oUser instanceof oxUser ) or !$oUser->getId() ) { return false; } $oUser->mapToProfileDataAndUpdateUser( $aPostData ); return $oUser; }
[ "protected", "function", "_updateUserProfileData", "(", "array", "$", "aPostData", ")", "{", "/** @var OxpsPaymorrowOxUser|oxUser $oUser */", "$", "oUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "empty", "(", "$", "oUser", ")", "or", "!", "(", "$", "oUser", "instanceof", "oxUser", ")", "or", "!", "$", "oUser", "->", "getId", "(", ")", ")", "{", "return", "false", ";", "}", "$", "oUser", "->", "mapToProfileDataAndUpdateUser", "(", "$", "aPostData", ")", ";", "return", "$", "oUser", ";", "}" ]
Get valid, logged in user and update their profile data. @param array $aPostData @return bool|OxpsPaymorrowOxUser|oxUser User object if loaded, false otherwise.
[ "Get", "valid", "logged", "in", "user", "and", "update", "their", "profile", "data", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L197-L209
27,784
OXID-eSales/paymorrow-module
core/oxpspaymorrowrequestcontrollerproxy.php
OxpsPaymorrowRequestControllerProxy._updateUserActiveShippingAddress
protected function _updateUserActiveShippingAddress( oxUser $oUser, array $aPostData ) { /** @var oxAddress $oShippingAddress */ $oShippingAddress = $oUser->getSelectedAddress(); $blShowShippingAddress = (bool) oxRegistry::getSession()->getVariable( 'blshowshipaddress' ); if ( !$blShowShippingAddress or !( $oShippingAddress instanceof oxAddress ) or !$oShippingAddress->getId() ) { return false; } return $oUser->mapShippingDataAndUpdateAddress( $aPostData, $oShippingAddress ); }
php
protected function _updateUserActiveShippingAddress( oxUser $oUser, array $aPostData ) { /** @var oxAddress $oShippingAddress */ $oShippingAddress = $oUser->getSelectedAddress(); $blShowShippingAddress = (bool) oxRegistry::getSession()->getVariable( 'blshowshipaddress' ); if ( !$blShowShippingAddress or !( $oShippingAddress instanceof oxAddress ) or !$oShippingAddress->getId() ) { return false; } return $oUser->mapShippingDataAndUpdateAddress( $aPostData, $oShippingAddress ); }
[ "protected", "function", "_updateUserActiveShippingAddress", "(", "oxUser", "$", "oUser", ",", "array", "$", "aPostData", ")", "{", "/** @var oxAddress $oShippingAddress */", "$", "oShippingAddress", "=", "$", "oUser", "->", "getSelectedAddress", "(", ")", ";", "$", "blShowShippingAddress", "=", "(", "bool", ")", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'blshowshipaddress'", ")", ";", "if", "(", "!", "$", "blShowShippingAddress", "or", "!", "(", "$", "oShippingAddress", "instanceof", "oxAddress", ")", "or", "!", "$", "oShippingAddress", "->", "getId", "(", ")", ")", "{", "return", "false", ";", "}", "return", "$", "oUser", "->", "mapShippingDataAndUpdateAddress", "(", "$", "aPostData", ",", "$", "oShippingAddress", ")", ";", "}" ]
Get user active shipping address if it is used in the session and update it. @param OxpsPaymorrowOxUser|oxUser $oUser @param array $aPostData @return bool
[ "Get", "user", "active", "shipping", "address", "if", "it", "is", "used", "in", "the", "session", "and", "update", "it", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowrequestcontrollerproxy.php#L219-L231
27,785
hostnet/accessor-generator-plugin-lib
src/Generator/CodeGenerator.php
CodeGenerator.isAliased
private static function isAliased($name, array $imports): bool { $aliases = array_keys($imports); foreach ($aliases as $alias) { if (strpos($name, $alias) === 0) { return true; } } return false; }
php
private static function isAliased($name, array $imports): bool { $aliases = array_keys($imports); foreach ($aliases as $alias) { if (strpos($name, $alias) === 0) { return true; } } return false; }
[ "private", "static", "function", "isAliased", "(", "$", "name", ",", "array", "$", "imports", ")", ":", "bool", "{", "$", "aliases", "=", "array_keys", "(", "$", "imports", ")", ";", "foreach", "(", "$", "aliases", "as", "$", "alias", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "$", "alias", ")", "===", "0", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if the given class name is in an aliased namespace, false otherwise. @param string $name @param string[] $imports @return bool
[ "Returns", "true", "if", "the", "given", "class", "name", "is", "in", "an", "aliased", "namespace", "false", "otherwise", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Generator/CodeGenerator.php#L472-L482
27,786
hostnet/accessor-generator-plugin-lib
src/Generator/CodeGenerator.php
CodeGenerator.fqcn
private static function fqcn($name, array $imports): string { // Already FQCN if ($name[0] === '\\') { return $name; } // Aliased if (array_key_exists($name, $imports)) { return '\\' . $imports[$name]; } // Check other imports if ($plain = self::getPlainImportIfExists($name, $imports)) { return '\\' . $plain; } // Not a complex type, or otherwise unknown. return ''; }
php
private static function fqcn($name, array $imports): string { // Already FQCN if ($name[0] === '\\') { return $name; } // Aliased if (array_key_exists($name, $imports)) { return '\\' . $imports[$name]; } // Check other imports if ($plain = self::getPlainImportIfExists($name, $imports)) { return '\\' . $plain; } // Not a complex type, or otherwise unknown. return ''; }
[ "private", "static", "function", "fqcn", "(", "$", "name", ",", "array", "$", "imports", ")", ":", "string", "{", "// Already FQCN", "if", "(", "$", "name", "[", "0", "]", "===", "'\\\\'", ")", "{", "return", "$", "name", ";", "}", "// Aliased", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "imports", ")", ")", "{", "return", "'\\\\'", ".", "$", "imports", "[", "$", "name", "]", ";", "}", "// Check other imports", "if", "(", "$", "plain", "=", "self", "::", "getPlainImportIfExists", "(", "$", "name", ",", "$", "imports", ")", ")", "{", "return", "'\\\\'", ".", "$", "plain", ";", "}", "// Not a complex type, or otherwise unknown.", "return", "''", ";", "}" ]
Return the fully qualified class name based on the use statements in the current file. @param string $name @param string[] $imports @return string
[ "Return", "the", "fully", "qualified", "class", "name", "based", "on", "the", "use", "statements", "in", "the", "current", "file", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Generator/CodeGenerator.php#L508-L527
27,787
hostnet/accessor-generator-plugin-lib
src/Generator/CodeGenerator.php
CodeGenerator.getUniqueImports
private function getUniqueImports(array $imports): array { uksort($imports, function ($a, $b) use ($imports) { $alias_a = is_numeric($a) ? " as $a;" : ''; $alias_b = is_numeric($b) ? " as $b;" : ''; return strcmp($imports[$a] . $alias_a, $imports[$b] . $alias_b); }); $unique_imports = []; $next = null; do { $key = key($imports); $value = current($imports); $next = next($imports); if ($value === $next && $key === key($imports)) { continue; } if ($key) { $unique_imports[$key] = $value; continue; } $unique_imports[] = $value; } while ($next !== false); return $unique_imports; }
php
private function getUniqueImports(array $imports): array { uksort($imports, function ($a, $b) use ($imports) { $alias_a = is_numeric($a) ? " as $a;" : ''; $alias_b = is_numeric($b) ? " as $b;" : ''; return strcmp($imports[$a] . $alias_a, $imports[$b] . $alias_b); }); $unique_imports = []; $next = null; do { $key = key($imports); $value = current($imports); $next = next($imports); if ($value === $next && $key === key($imports)) { continue; } if ($key) { $unique_imports[$key] = $value; continue; } $unique_imports[] = $value; } while ($next !== false); return $unique_imports; }
[ "private", "function", "getUniqueImports", "(", "array", "$", "imports", ")", ":", "array", "{", "uksort", "(", "$", "imports", ",", "function", "(", "$", "a", ",", "$", "b", ")", "use", "(", "$", "imports", ")", "{", "$", "alias_a", "=", "is_numeric", "(", "$", "a", ")", "?", "\" as $a;\"", ":", "''", ";", "$", "alias_b", "=", "is_numeric", "(", "$", "b", ")", "?", "\" as $b;\"", ":", "''", ";", "return", "strcmp", "(", "$", "imports", "[", "$", "a", "]", ".", "$", "alias_a", ",", "$", "imports", "[", "$", "b", "]", ".", "$", "alias_b", ")", ";", "}", ")", ";", "$", "unique_imports", "=", "[", "]", ";", "$", "next", "=", "null", ";", "do", "{", "$", "key", "=", "key", "(", "$", "imports", ")", ";", "$", "value", "=", "current", "(", "$", "imports", ")", ";", "$", "next", "=", "next", "(", "$", "imports", ")", ";", "if", "(", "$", "value", "===", "$", "next", "&&", "$", "key", "===", "key", "(", "$", "imports", ")", ")", "{", "continue", ";", "}", "if", "(", "$", "key", ")", "{", "$", "unique_imports", "[", "$", "key", "]", "=", "$", "value", ";", "continue", ";", "}", "$", "unique_imports", "[", "]", "=", "$", "value", ";", "}", "while", "(", "$", "next", "!==", "false", ")", ";", "return", "$", "unique_imports", ";", "}" ]
Make sure our use statements are sorted alphabetically and unique. The array_unique function can not be used because it does not take values with different array keys into account. This loop does exactly that. This is useful when a specific class name is imported and aliased as well. @param string[] $imports @return string[]
[ "Make", "sure", "our", "use", "statements", "are", "sorted", "alphabetically", "and", "unique", ".", "The", "array_unique", "function", "can", "not", "be", "used", "because", "it", "does", "not", "take", "values", "with", "different", "array", "keys", "into", "account", ".", "This", "loop", "does", "exactly", "that", ".", "This", "is", "useful", "when", "a", "specific", "class", "name", "is", "imported", "and", "aliased", "as", "well", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Generator/CodeGenerator.php#L664-L693
27,788
hostnet/accessor-generator-plugin-lib
src/Generator/CodeGenerator.php
CodeGenerator.validateEnumEntity
private function validateEnumEntity(string $entity_class): void { if (false === \in_array(EnumeratorCompatibleEntityInterface::class, class_implements($entity_class))) { throw new \LogicException(sprintf( 'The entity "%s" must implement "%s" in order to use it with enumerator accessor classes.', $entity_class, EnumeratorCompatibleEntityInterface::class )); } }
php
private function validateEnumEntity(string $entity_class): void { if (false === \in_array(EnumeratorCompatibleEntityInterface::class, class_implements($entity_class))) { throw new \LogicException(sprintf( 'The entity "%s" must implement "%s" in order to use it with enumerator accessor classes.', $entity_class, EnumeratorCompatibleEntityInterface::class )); } }
[ "private", "function", "validateEnumEntity", "(", "string", "$", "entity_class", ")", ":", "void", "{", "if", "(", "false", "===", "\\", "in_array", "(", "EnumeratorCompatibleEntityInterface", "::", "class", ",", "class_implements", "(", "$", "entity_class", ")", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'The entity \"%s\" must implement \"%s\" in order to use it with enumerator accessor classes.'", ",", "$", "entity_class", ",", "EnumeratorCompatibleEntityInterface", "::", "class", ")", ")", ";", "}", "}" ]
Ensures the entity class complies to the "standard" for holding parameters. @param string $entity_class
[ "Ensures", "the", "entity", "class", "complies", "to", "the", "standard", "for", "holding", "parameters", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Generator/CodeGenerator.php#L700-L709
27,789
techdivision/import-product
src/Subjects/BunchSubject.php
BunchSubject.getVisibilityIdByValue
public function getVisibilityIdByValue($visibility) { // query whether or not, the requested visibility is available if (isset($this->availableVisibilities[$visibility])) { // load the visibility ID, add the mapping and return the ID return $this->availableVisibilities[$visibility]; } // throw an exception, if not throw new \Exception( $this->appendExceptionSuffix( sprintf('Found invalid visibility %s', $visibility) ) ); }
php
public function getVisibilityIdByValue($visibility) { // query whether or not, the requested visibility is available if (isset($this->availableVisibilities[$visibility])) { // load the visibility ID, add the mapping and return the ID return $this->availableVisibilities[$visibility]; } // throw an exception, if not throw new \Exception( $this->appendExceptionSuffix( sprintf('Found invalid visibility %s', $visibility) ) ); }
[ "public", "function", "getVisibilityIdByValue", "(", "$", "visibility", ")", "{", "// query whether or not, the requested visibility is available", "if", "(", "isset", "(", "$", "this", "->", "availableVisibilities", "[", "$", "visibility", "]", ")", ")", "{", "// load the visibility ID, add the mapping and return the ID", "return", "$", "this", "->", "availableVisibilities", "[", "$", "visibility", "]", ";", "}", "// throw an exception, if not", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Found invalid visibility %s'", ",", "$", "visibility", ")", ")", ")", ";", "}" ]
Return's the visibility key for the passed visibility string. @param string $visibility The visibility string to return the key for @return integer The requested visibility key @throws \Exception Is thrown, if the requested visibility is not available
[ "Return", "s", "the", "visibility", "key", "for", "the", "passed", "visibility", "string", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/BunchSubject.php#L238-L253
27,790
techdivision/import-product
src/Subjects/BunchSubject.php
BunchSubject.preLoadEntityId
public function preLoadEntityId(array $product) { $this->preLoadedEntityIds[$product[MemberNames::SKU]] = $product[MemberNames::ENTITY_ID]; }
php
public function preLoadEntityId(array $product) { $this->preLoadedEntityIds[$product[MemberNames::SKU]] = $product[MemberNames::ENTITY_ID]; }
[ "public", "function", "preLoadEntityId", "(", "array", "$", "product", ")", "{", "$", "this", "->", "preLoadedEntityIds", "[", "$", "product", "[", "MemberNames", "::", "SKU", "]", "]", "=", "$", "product", "[", "MemberNames", "::", "ENTITY_ID", "]", ";", "}" ]
Pre-load the entity ID for the passed product. @param array $product The product to be pre-loaded @return void
[ "Pre", "-", "load", "the", "entity", "ID", "for", "the", "passed", "product", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/BunchSubject.php#L274-L277
27,791
techdivision/import-product
src/Subjects/BunchSubject.php
BunchSubject.getProductCategoryIds
public function getProductCategoryIds() { // initialize the array with the product's category IDs $categoryIds = array(); // query whether or not category IDs are available for the actual product entity if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) { $categoryIds = $this->productCategoryIds[$lastEntityId]; } // return the array with the product's category IDs return $categoryIds; }
php
public function getProductCategoryIds() { // initialize the array with the product's category IDs $categoryIds = array(); // query whether or not category IDs are available for the actual product entity if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) { $categoryIds = $this->productCategoryIds[$lastEntityId]; } // return the array with the product's category IDs return $categoryIds; }
[ "public", "function", "getProductCategoryIds", "(", ")", "{", "// initialize the array with the product's category IDs", "$", "categoryIds", "=", "array", "(", ")", ";", "// query whether or not category IDs are available for the actual product entity", "if", "(", "isset", "(", "$", "this", "->", "productCategoryIds", "[", "$", "lastEntityId", "=", "$", "this", "->", "getLastEntityId", "(", ")", "]", ")", ")", "{", "$", "categoryIds", "=", "$", "this", "->", "productCategoryIds", "[", "$", "lastEntityId", "]", ";", "}", "// return the array with the product's category IDs", "return", "$", "categoryIds", ";", "}" ]
Return's the list with category IDs the product is related with. @return array The product's category IDs
[ "Return", "s", "the", "list", "with", "category", "IDs", "the", "product", "is", "related", "with", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/BunchSubject.php#L284-L297
27,792
techdivision/import-product
src/Subjects/BunchSubject.php
BunchSubject.getEntityType
public function getEntityType() { // query whether or not the entity type with the passed code is available if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) { return $this->entityTypes[$entityTypeCode]; } // throw a new exception throw new \Exception( $this->appendExceptionSuffix( sprintf('Requested entity type "%s" is not available', $entityTypeCode) ) ); }
php
public function getEntityType() { // query whether or not the entity type with the passed code is available if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) { return $this->entityTypes[$entityTypeCode]; } // throw a new exception throw new \Exception( $this->appendExceptionSuffix( sprintf('Requested entity type "%s" is not available', $entityTypeCode) ) ); }
[ "public", "function", "getEntityType", "(", ")", "{", "// query whether or not the entity type with the passed code is available", "if", "(", "isset", "(", "$", "this", "->", "entityTypes", "[", "$", "entityTypeCode", "=", "$", "this", "->", "getEntityTypeCode", "(", ")", "]", ")", ")", "{", "return", "$", "this", "->", "entityTypes", "[", "$", "entityTypeCode", "]", ";", "}", "// throw a new exception", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Requested entity type \"%s\" is not available'", ",", "$", "entityTypeCode", ")", ")", ")", ";", "}" ]
Return's the entity type for the configured entity type code. @return array The requested entity type @throws \Exception Is thrown, if the requested entity type is not available
[ "Return", "s", "the", "entity", "type", "for", "the", "configured", "entity", "type", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/BunchSubject.php#L305-L319
27,793
contributte/thepay-api
src/Helper/RadioMerchant.php
RadioMerchant.renderRadio
public function renderRadio(): string { $gateUrl = $this->config->gateUrl; $queryArgs = [ 'merchantId' => $this->config->merchantId, 'accountId' => $this->config->accountId, 'name' => $this->name, 'value' => $this->value, 'showIcon' => $this->showIcon, 'selected' => !empty($_REQUEST['tp_radio_value']) ? (int) $_REQUEST['tp_radio_value'] : '', ]; // Currency is an optional argument. For compatibility reasons, it is // not present in the query at all if its value is empty. if ($this->currency) { $queryArgs['currency'] = $this->currency; } $queryArgs['signature'] = $this->createSignature($queryArgs); $queryArgs = http_build_query($queryArgs); $thepayGateUrl = "{$gateUrl}radiobuttons/index.php?{$queryArgs}"; $thepayGateUrl = Escaper::jsonEncode($thepayGateUrl); $href = "{$gateUrl}radiobuttons/style/radiobuttons.css?v=" . time(); $out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n"; $out .= "<script type=\"text/javascript\">\n"; $out .= "\tvar thepayGateUrl = {$thepayGateUrl};\n"; if ($this->appendCode) { $thepayAppendCode = Escaper::jsonEncode($this->appendCode); $out .= "\tvar thepayAppendCode = {$thepayAppendCode};\n"; } $out .= "</script>\n"; $src = "{$gateUrl}radiobuttons/js/jquery.js?v=" . time(); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n"; $src = "{$gateUrl}radiobuttons/js/radiobuttons.js?v=" . time(); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n"; $out .= "<div id=\"thepay-method-box\"></div>\n"; return $out; }
php
public function renderRadio(): string { $gateUrl = $this->config->gateUrl; $queryArgs = [ 'merchantId' => $this->config->merchantId, 'accountId' => $this->config->accountId, 'name' => $this->name, 'value' => $this->value, 'showIcon' => $this->showIcon, 'selected' => !empty($_REQUEST['tp_radio_value']) ? (int) $_REQUEST['tp_radio_value'] : '', ]; // Currency is an optional argument. For compatibility reasons, it is // not present in the query at all if its value is empty. if ($this->currency) { $queryArgs['currency'] = $this->currency; } $queryArgs['signature'] = $this->createSignature($queryArgs); $queryArgs = http_build_query($queryArgs); $thepayGateUrl = "{$gateUrl}radiobuttons/index.php?{$queryArgs}"; $thepayGateUrl = Escaper::jsonEncode($thepayGateUrl); $href = "{$gateUrl}radiobuttons/style/radiobuttons.css?v=" . time(); $out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n"; $out .= "<script type=\"text/javascript\">\n"; $out .= "\tvar thepayGateUrl = {$thepayGateUrl};\n"; if ($this->appendCode) { $thepayAppendCode = Escaper::jsonEncode($this->appendCode); $out .= "\tvar thepayAppendCode = {$thepayAppendCode};\n"; } $out .= "</script>\n"; $src = "{$gateUrl}radiobuttons/js/jquery.js?v=" . time(); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n"; $src = "{$gateUrl}radiobuttons/js/radiobuttons.js?v=" . time(); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>\n"; $out .= "<div id=\"thepay-method-box\"></div>\n"; return $out; }
[ "public", "function", "renderRadio", "(", ")", ":", "string", "{", "$", "gateUrl", "=", "$", "this", "->", "config", "->", "gateUrl", ";", "$", "queryArgs", "=", "[", "'merchantId'", "=>", "$", "this", "->", "config", "->", "merchantId", ",", "'accountId'", "=>", "$", "this", "->", "config", "->", "accountId", ",", "'name'", "=>", "$", "this", "->", "name", ",", "'value'", "=>", "$", "this", "->", "value", ",", "'showIcon'", "=>", "$", "this", "->", "showIcon", ",", "'selected'", "=>", "!", "empty", "(", "$", "_REQUEST", "[", "'tp_radio_value'", "]", ")", "?", "(", "int", ")", "$", "_REQUEST", "[", "'tp_radio_value'", "]", ":", "''", ",", "]", ";", "// Currency is an optional argument. For compatibility reasons, it is", "// not present in the query at all if its value is empty.", "if", "(", "$", "this", "->", "currency", ")", "{", "$", "queryArgs", "[", "'currency'", "]", "=", "$", "this", "->", "currency", ";", "}", "$", "queryArgs", "[", "'signature'", "]", "=", "$", "this", "->", "createSignature", "(", "$", "queryArgs", ")", ";", "$", "queryArgs", "=", "http_build_query", "(", "$", "queryArgs", ")", ";", "$", "thepayGateUrl", "=", "\"{$gateUrl}radiobuttons/index.php?{$queryArgs}\"", ";", "$", "thepayGateUrl", "=", "Escaper", "::", "jsonEncode", "(", "$", "thepayGateUrl", ")", ";", "$", "href", "=", "\"{$gateUrl}radiobuttons/style/radiobuttons.css?v=\"", ".", "time", "(", ")", ";", "$", "out", "=", "\"<link href=\\\"{$href}\\\" type=\\\"text/css\\\" rel=\\\"stylesheet\\\" />\\n\"", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\">\\n\"", ";", "$", "out", ".=", "\"\\tvar thepayGateUrl = {$thepayGateUrl};\\n\"", ";", "if", "(", "$", "this", "->", "appendCode", ")", "{", "$", "thepayAppendCode", "=", "Escaper", "::", "jsonEncode", "(", "$", "this", "->", "appendCode", ")", ";", "$", "out", ".=", "\"\\tvar thepayAppendCode = {$thepayAppendCode};\\n\"", ";", "}", "$", "out", ".=", "\"</script>\\n\"", ";", "$", "src", "=", "\"{$gateUrl}radiobuttons/js/jquery.js?v=\"", ".", "time", "(", ")", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\" src=\\\"{$src}\\\" async=\\\"async\\\"></script>\\n\"", ";", "$", "src", "=", "\"{$gateUrl}radiobuttons/js/radiobuttons.js?v=\"", ".", "time", "(", ")", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\" src=\\\"{$src}\\\" async=\\\"async\\\"></script>\\n\"", ";", "$", "out", ".=", "\"<div id=\\\"thepay-method-box\\\"></div>\\n\"", ";", "return", "$", "out", ";", "}" ]
Generate HTML code for payment component. @return string HTML code
[ "Generate", "HTML", "code", "for", "payment", "component", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Helper/RadioMerchant.php#L165-L209
27,794
contributte/thepay-api
src/Helper/RadioMerchant.php
RadioMerchant.showPaymentInstructions
public function showPaymentInstructions(Payment $payment): string { if (empty($_REQUEST['tp_radio_value']) || empty($_REQUEST['tp_radio_is_offline'])) { return ''; } $this->clearCookies(); $href = "{$this->config->gateUrl}radiobuttons/style/radiobuttons.css?v=" . time(); $href = Escaper::htmlEntityEncode($href); $out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n"; $out .= "<script type=\"text/javascript\">\n"; $payment->setMethodId(intval($_REQUEST['tp_radio_value'])); $queryArgs = $payment->getArgs(); $queryArgs['signature'] = $payment->getSignature(); $thepayGateUrl = "{$this->config->gateUrl}?" . http_build_query($queryArgs); $thepayGateUrl = Escaper::jsonEncode($thepayGateUrl); $out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n"; $thepayDisablePopupCss = Escaper::jsonEncode($this->disablePopupCss); $out .= "\tthepayDisablePopupCss = {$thepayDisablePopupCss};\n"; $out .= "</script>\n"; $src = "{$this->config->gateUrl}radiobuttons/js/jquery.js?v=" . time(); $src = Escaper::htmlEntityEncode($src); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>"; $src = "{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=" . time(); $src = Escaper::htmlEntityEncode($src); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>"; $out .= '<div id="thepay-method-result"></div>'; return $out; }
php
public function showPaymentInstructions(Payment $payment): string { if (empty($_REQUEST['tp_radio_value']) || empty($_REQUEST['tp_radio_is_offline'])) { return ''; } $this->clearCookies(); $href = "{$this->config->gateUrl}radiobuttons/style/radiobuttons.css?v=" . time(); $href = Escaper::htmlEntityEncode($href); $out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n"; $out .= "<script type=\"text/javascript\">\n"; $payment->setMethodId(intval($_REQUEST['tp_radio_value'])); $queryArgs = $payment->getArgs(); $queryArgs['signature'] = $payment->getSignature(); $thepayGateUrl = "{$this->config->gateUrl}?" . http_build_query($queryArgs); $thepayGateUrl = Escaper::jsonEncode($thepayGateUrl); $out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n"; $thepayDisablePopupCss = Escaper::jsonEncode($this->disablePopupCss); $out .= "\tthepayDisablePopupCss = {$thepayDisablePopupCss};\n"; $out .= "</script>\n"; $src = "{$this->config->gateUrl}radiobuttons/js/jquery.js?v=" . time(); $src = Escaper::htmlEntityEncode($src); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>"; $src = "{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=" . time(); $src = Escaper::htmlEntityEncode($src); $out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>"; $out .= '<div id="thepay-method-result"></div>'; return $out; }
[ "public", "function", "showPaymentInstructions", "(", "Payment", "$", "payment", ")", ":", "string", "{", "if", "(", "empty", "(", "$", "_REQUEST", "[", "'tp_radio_value'", "]", ")", "||", "empty", "(", "$", "_REQUEST", "[", "'tp_radio_is_offline'", "]", ")", ")", "{", "return", "''", ";", "}", "$", "this", "->", "clearCookies", "(", ")", ";", "$", "href", "=", "\"{$this->config->gateUrl}radiobuttons/style/radiobuttons.css?v=\"", ".", "time", "(", ")", ";", "$", "href", "=", "Escaper", "::", "htmlEntityEncode", "(", "$", "href", ")", ";", "$", "out", "=", "\"<link href=\\\"{$href}\\\" type=\\\"text/css\\\" rel=\\\"stylesheet\\\" />\\n\"", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\">\\n\"", ";", "$", "payment", "->", "setMethodId", "(", "intval", "(", "$", "_REQUEST", "[", "'tp_radio_value'", "]", ")", ")", ";", "$", "queryArgs", "=", "$", "payment", "->", "getArgs", "(", ")", ";", "$", "queryArgs", "[", "'signature'", "]", "=", "$", "payment", "->", "getSignature", "(", ")", ";", "$", "thepayGateUrl", "=", "\"{$this->config->gateUrl}?\"", ".", "http_build_query", "(", "$", "queryArgs", ")", ";", "$", "thepayGateUrl", "=", "Escaper", "::", "jsonEncode", "(", "$", "thepayGateUrl", ")", ";", "$", "out", ".=", "\"\\tvar thepayGateUrl = {$thepayGateUrl},\\n\"", ";", "$", "thepayDisablePopupCss", "=", "Escaper", "::", "jsonEncode", "(", "$", "this", "->", "disablePopupCss", ")", ";", "$", "out", ".=", "\"\\tthepayDisablePopupCss = {$thepayDisablePopupCss};\\n\"", ";", "$", "out", ".=", "\"</script>\\n\"", ";", "$", "src", "=", "\"{$this->config->gateUrl}radiobuttons/js/jquery.js?v=\"", ".", "time", "(", ")", ";", "$", "src", "=", "Escaper", "::", "htmlEntityEncode", "(", "$", "src", ")", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\" src=\\\"{$src}\\\" async=\\\"async\\\"></script>\"", ";", "$", "src", "=", "\"{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=\"", ".", "time", "(", ")", ";", "$", "src", "=", "Escaper", "::", "htmlEntityEncode", "(", "$", "src", ")", ";", "$", "out", ".=", "\"<script type=\\\"text/javascript\\\" src=\\\"{$src}\\\" async=\\\"async\\\"></script>\"", ";", "$", "out", ".=", "'<div id=\"thepay-method-result\"></div>'", ";", "return", "$", "out", ";", "}" ]
Show instruction for offline payment if ThePay payment method is selected and this method is offline. Show output of this method somewhere on page with order confirmation. @return string HTML code with component
[ "Show", "instruction", "for", "offline", "payment", "if", "ThePay", "payment", "method", "is", "selected", "and", "this", "method", "is", "offline", ".", "Show", "output", "of", "this", "method", "somewhere", "on", "page", "with", "order", "confirmation", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Helper/RadioMerchant.php#L301-L338
27,795
techdivision/import-product
src/Observers/AbstractProductRelationUpdateObserver.php
AbstractProductRelationUpdateObserver.initializeProductRelation
protected function initializeProductRelation(array $attr) { // laod child/parent ID $childId = $attr[MemberNames::CHILD_ID]; $parentId = $attr[MemberNames::PARENT_ID]; // query whether or not the product relation already exists if ($this->loadProductRelation($parentId, $childId)) { return; } // simply return the attributes return $attr; }
php
protected function initializeProductRelation(array $attr) { // laod child/parent ID $childId = $attr[MemberNames::CHILD_ID]; $parentId = $attr[MemberNames::PARENT_ID]; // query whether or not the product relation already exists if ($this->loadProductRelation($parentId, $childId)) { return; } // simply return the attributes return $attr; }
[ "protected", "function", "initializeProductRelation", "(", "array", "$", "attr", ")", "{", "// laod child/parent ID", "$", "childId", "=", "$", "attr", "[", "MemberNames", "::", "CHILD_ID", "]", ";", "$", "parentId", "=", "$", "attr", "[", "MemberNames", "::", "PARENT_ID", "]", ";", "// query whether or not the product relation already exists", "if", "(", "$", "this", "->", "loadProductRelation", "(", "$", "parentId", ",", "$", "childId", ")", ")", "{", "return", ";", "}", "// simply return the attributes", "return", "$", "attr", ";", "}" ]
Initialize the product relation with the passed attributes and returns an instance. @param array $attr The product relation attributes @return array|null The initialized product relation, or null if the relation already exsist
[ "Initialize", "the", "product", "relation", "with", "the", "passed", "attributes", "and", "returns", "an", "instance", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/AbstractProductRelationUpdateObserver.php#L44-L58
27,796
techdivision/import-product
src/Repositories/ProductRepository.php
ProductRepository.findOneBySku
public function findOneBySku($sku) { // return the cached result if available if ($this->isCached($sku)) { return $this->fromCache($sku); } // if not, try to load the product with the passed SKU $this->productStmt->execute(array(MemberNames::SKU => $sku)); // query whether or not the product is available in the database if ($product = $this->productStmt->fetch(\PDO::FETCH_ASSOC)) { // add the product to the cache, register the SKU reference as well $this->toCache( $product[$this->getPrimaryKeyName()], $product, array($sku => $product[$this->getPrimaryKeyName()]) ); // finally, return it return $product; } }
php
public function findOneBySku($sku) { // return the cached result if available if ($this->isCached($sku)) { return $this->fromCache($sku); } // if not, try to load the product with the passed SKU $this->productStmt->execute(array(MemberNames::SKU => $sku)); // query whether or not the product is available in the database if ($product = $this->productStmt->fetch(\PDO::FETCH_ASSOC)) { // add the product to the cache, register the SKU reference as well $this->toCache( $product[$this->getPrimaryKeyName()], $product, array($sku => $product[$this->getPrimaryKeyName()]) ); // finally, return it return $product; } }
[ "public", "function", "findOneBySku", "(", "$", "sku", ")", "{", "// return the cached result if available", "if", "(", "$", "this", "->", "isCached", "(", "$", "sku", ")", ")", "{", "return", "$", "this", "->", "fromCache", "(", "$", "sku", ")", ";", "}", "// if not, try to load the product with the passed SKU", "$", "this", "->", "productStmt", "->", "execute", "(", "array", "(", "MemberNames", "::", "SKU", "=>", "$", "sku", ")", ")", ";", "// query whether or not the product is available in the database", "if", "(", "$", "product", "=", "$", "this", "->", "productStmt", "->", "fetch", "(", "\\", "PDO", "::", "FETCH_ASSOC", ")", ")", "{", "// add the product to the cache, register the SKU reference as well", "$", "this", "->", "toCache", "(", "$", "product", "[", "$", "this", "->", "getPrimaryKeyName", "(", ")", "]", ",", "$", "product", ",", "array", "(", "$", "sku", "=>", "$", "product", "[", "$", "this", "->", "getPrimaryKeyName", "(", ")", "]", ")", ")", ";", "// finally, return it", "return", "$", "product", ";", "}", "}" ]
Return's the product with the passed SKU. @param string $sku The SKU of the product to return @return array|null The product
[ "Return", "s", "the", "product", "with", "the", "passed", "SKU", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Repositories/ProductRepository.php#L97-L119
27,797
RhubarbPHP/Rhubarb
src/Layout/LayoutModule.php
LayoutModule.getLayoutClassName
public static function getLayoutClassName() { if (is_callable(self::$layoutClassName)) { $func = self::$layoutClassName; return $func(); } return self::$layoutClassName; }
php
public static function getLayoutClassName() { if (is_callable(self::$layoutClassName)) { $func = self::$layoutClassName; return $func(); } return self::$layoutClassName; }
[ "public", "static", "function", "getLayoutClassName", "(", ")", "{", "if", "(", "is_callable", "(", "self", "::", "$", "layoutClassName", ")", ")", "{", "$", "func", "=", "self", "::", "$", "layoutClassName", ";", "return", "$", "func", "(", ")", ";", "}", "return", "self", "::", "$", "layoutClassName", ";", "}" ]
Returns the class name of the layout that should be used for the current request. @return string
[ "Returns", "the", "class", "name", "of", "the", "layout", "that", "should", "be", "used", "for", "the", "current", "request", "." ]
327ff1f05d6a7e651d41c8e771f3551acfac18ae
https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Layout/LayoutModule.php#L74-L82
27,798
RhubarbPHP/Rhubarb
src/Sendables/SendableProvider.php
SendableProvider.selectProviderAndSend
public static function selectProviderAndSend(Sendable $sendable) { $provider = self::createProviderForSendable($sendable); $provider->send($sendable); }
php
public static function selectProviderAndSend(Sendable $sendable) { $provider = self::createProviderForSendable($sendable); $provider->send($sendable); }
[ "public", "static", "function", "selectProviderAndSend", "(", "Sendable", "$", "sendable", ")", "{", "$", "provider", "=", "self", "::", "createProviderForSendable", "(", "$", "sendable", ")", ";", "$", "provider", "->", "send", "(", "$", "sendable", ")", ";", "}" ]
Selects the currently registered concrete provider for the sendable's base type of provider and passes it the sendable for sending. @param Sendable $sendable
[ "Selects", "the", "currently", "registered", "concrete", "provider", "for", "the", "sendable", "s", "base", "type", "of", "provider", "and", "passes", "it", "the", "sendable", "for", "sending", "." ]
327ff1f05d6a7e651d41c8e771f3551acfac18ae
https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Sendables/SendableProvider.php#L41-L45
27,799
RhubarbPHP/Rhubarb
src/Assets/AssetUrlHandler.php
AssetUrlHandler.getAsset
protected function getAsset() { $asset = AssetCatalogueProvider::getAsset($this->token); if ($this->assetCategory != $asset->getProviderData()["category"]) { throw new AssetExposureException($this->token); } return $asset; }
php
protected function getAsset() { $asset = AssetCatalogueProvider::getAsset($this->token); if ($this->assetCategory != $asset->getProviderData()["category"]) { throw new AssetExposureException($this->token); } return $asset; }
[ "protected", "function", "getAsset", "(", ")", "{", "$", "asset", "=", "AssetCatalogueProvider", "::", "getAsset", "(", "$", "this", "->", "token", ")", ";", "if", "(", "$", "this", "->", "assetCategory", "!=", "$", "asset", "->", "getProviderData", "(", ")", "[", "\"category\"", "]", ")", "{", "throw", "new", "AssetExposureException", "(", "$", "this", "->", "token", ")", ";", "}", "return", "$", "asset", ";", "}" ]
Gets the asset for the current URL @return Asset @throws AssetExposureException
[ "Gets", "the", "asset", "for", "the", "current", "URL" ]
327ff1f05d6a7e651d41c8e771f3551acfac18ae
https://github.com/RhubarbPHP/Rhubarb/blob/327ff1f05d6a7e651d41c8e771f3551acfac18ae/src/Assets/AssetUrlHandler.php#L174-L183