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
44,900
BoltApp/bolt-magento2
Helper/Cart.php
Cart.handlePuertoRico
private function handlePuertoRico($addressData) { $address = (array)$addressData; if ($address['country_code'] === 'PR') { $address['country_code'] = 'US'; $address['country'] = 'United States'; $address['region'] = 'Puerto Rico'; } return is_object($addressData) ? (object)$address : $address; }
php
private function handlePuertoRico($addressData) { $address = (array)$addressData; if ($address['country_code'] === 'PR') { $address['country_code'] = 'US'; $address['country'] = 'United States'; $address['region'] = 'Puerto Rico'; } return is_object($addressData) ? (object)$address : $address; }
[ "private", "function", "handlePuertoRico", "(", "$", "addressData", ")", "{", "$", "address", "=", "(", "array", ")", "$", "addressData", ";", "if", "(", "$", "address", "[", "'country_code'", "]", "===", "'PR'", ")", "{", "$", "address", "[", "'country_...
Handle Puerto Rico address special case. Bolt thinks Puerto Rico is a country magento thinks it is US. @param array|object $addressData @return array|object
[ "Handle", "Puerto", "Rico", "address", "special", "case", ".", "Bolt", "thinks", "Puerto", "Rico", "is", "a", "country", "magento", "thinks", "it", "is", "US", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Cart.php#L1154-L1163
44,901
BoltApp/bolt-magento2
Helper/Cart.php
Cart.hasProductRestrictions
public function hasProductRestrictions($quote = null) { $toggleCheckout = $this->configHelper->getToggleCheckout(); if (!$toggleCheckout || !$toggleCheckout->active) { return false; } // get configured Product model getters that can restrict Bolt checkout usage $productRestrictionMethods = $toggleCheckout->productRestrictionMethods ?: []; // get configured Quote Item getters that can restrict Bolt checkout usage $itemRestrictionMethods = $toggleCheckout->itemRestrictionMethods ?: []; if (!$productRestrictionMethods && !$itemRestrictionMethods) { return false; } /** @var Quote $quote */ $quote = $quote ?: $this->checkoutSession->getQuote(); foreach ($quote->getAllVisibleItems() as $item) { // call every method on item, if returns true, do restrict foreach ($itemRestrictionMethods as $method) { if ($item->$method()) { return true; } } // Non empty check to avoid unnecessary model load if ($productRestrictionMethods) { // get item product $product = $this->productFactory->create()->load($item->getProductId()); // call every method on product, if returns true, do restrict foreach ($productRestrictionMethods as $method) { if ($product->$method()) { return true; } } } } // no restrictions return false; }
php
public function hasProductRestrictions($quote = null) { $toggleCheckout = $this->configHelper->getToggleCheckout(); if (!$toggleCheckout || !$toggleCheckout->active) { return false; } // get configured Product model getters that can restrict Bolt checkout usage $productRestrictionMethods = $toggleCheckout->productRestrictionMethods ?: []; // get configured Quote Item getters that can restrict Bolt checkout usage $itemRestrictionMethods = $toggleCheckout->itemRestrictionMethods ?: []; if (!$productRestrictionMethods && !$itemRestrictionMethods) { return false; } /** @var Quote $quote */ $quote = $quote ?: $this->checkoutSession->getQuote(); foreach ($quote->getAllVisibleItems() as $item) { // call every method on item, if returns true, do restrict foreach ($itemRestrictionMethods as $method) { if ($item->$method()) { return true; } } // Non empty check to avoid unnecessary model load if ($productRestrictionMethods) { // get item product $product = $this->productFactory->create()->load($item->getProductId()); // call every method on product, if returns true, do restrict foreach ($productRestrictionMethods as $method) { if ($product->$method()) { return true; } } } } // no restrictions return false; }
[ "public", "function", "hasProductRestrictions", "(", "$", "quote", "=", "null", ")", "{", "$", "toggleCheckout", "=", "$", "this", "->", "configHelper", "->", "getToggleCheckout", "(", ")", ";", "if", "(", "!", "$", "toggleCheckout", "||", "!", "$", "toggl...
Check the cart items for properties that are a restriction to Bolt checkout. Properties are checked with getters specified in configuration. @param Quote|null $quote @return bool
[ "Check", "the", "cart", "items", "for", "properties", "that", "are", "a", "restriction", "to", "Bolt", "checkout", ".", "Properties", "are", "checked", "with", "getters", "specified", "in", "configuration", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Cart.php#L1172-L1215
44,902
BoltApp/bolt-magento2
Controller/Order/Save.php
Save.clearQuoteSession
private function clearQuoteSession($quote) { $this->checkoutSession->setLastQuoteId($quote->getId()) ->setLastSuccessQuoteId($quote->getId()) ->clearHelperData(); }
php
private function clearQuoteSession($quote) { $this->checkoutSession->setLastQuoteId($quote->getId()) ->setLastSuccessQuoteId($quote->getId()) ->clearHelperData(); }
[ "private", "function", "clearQuoteSession", "(", "$", "quote", ")", "{", "$", "this", "->", "checkoutSession", "->", "setLastQuoteId", "(", "$", "quote", "->", "getId", "(", ")", ")", "->", "setLastSuccessQuoteId", "(", "$", "quote", "->", "getId", "(", ")...
Clear quote session after successful order @param Quote $quote @return void
[ "Clear", "quote", "session", "after", "successful", "order" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Controller/Order/Save.php#L154-L159
44,903
BoltApp/bolt-magento2
Controller/Order/Save.php
Save.clearOrderSession
private function clearOrderSession($order) { $this->checkoutSession->setLastOrderId($order->getId()) ->setLastRealOrderId($order->getIncrementId()) ->setLastOrderStatus($order->getStatus()); }
php
private function clearOrderSession($order) { $this->checkoutSession->setLastOrderId($order->getId()) ->setLastRealOrderId($order->getIncrementId()) ->setLastOrderStatus($order->getStatus()); }
[ "private", "function", "clearOrderSession", "(", "$", "order", ")", "{", "$", "this", "->", "checkoutSession", "->", "setLastOrderId", "(", "$", "order", "->", "getId", "(", ")", ")", "->", "setLastRealOrderId", "(", "$", "order", "->", "getIncrementId", "("...
Clear order session after successful order @param Order $order @return void
[ "Clear", "order", "session", "after", "successful", "order" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Controller/Order/Save.php#L168-L173
44,904
BoltApp/bolt-magento2
Helper/Api.php
Api.getFullApiUrl
private function getFullApiUrl($dynamicUrl) { $staticUrl = $this->configHelper->getApiUrl(); return $staticUrl . self::API_CURRENT_VERSION . $dynamicUrl; }
php
private function getFullApiUrl($dynamicUrl) { $staticUrl = $this->configHelper->getApiUrl(); return $staticUrl . self::API_CURRENT_VERSION . $dynamicUrl; }
[ "private", "function", "getFullApiUrl", "(", "$", "dynamicUrl", ")", "{", "$", "staticUrl", "=", "$", "this", "->", "configHelper", "->", "getApiUrl", "(", ")", ";", "return", "$", "staticUrl", ".", "self", "::", "API_CURRENT_VERSION", ".", "$", "dynamicUrl"...
Get Full API Endpoint @param string $dynamicUrl @return string
[ "Get", "Full", "API", "Endpoint" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Api.php#L157-L161
44,905
BoltApp/bolt-magento2
Helper/Order.php
Order.setShippingMethod
private function setShippingMethod($quote, $transaction) { if ($quote->isVirtual()) { return; } $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setCollectShippingRates(true); $shippingMethod = $transaction->order->cart->shipments[0]->reference; $shippingAddress->setShippingMethod($shippingMethod)->save(); }
php
private function setShippingMethod($quote, $transaction) { if ($quote->isVirtual()) { return; } $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setCollectShippingRates(true); $shippingMethod = $transaction->order->cart->shipments[0]->reference; $shippingAddress->setShippingMethod($shippingMethod)->save(); }
[ "private", "function", "setShippingMethod", "(", "$", "quote", ",", "$", "transaction", ")", "{", "if", "(", "$", "quote", "->", "isVirtual", "(", ")", ")", "{", "return", ";", "}", "$", "shippingAddress", "=", "$", "quote", "->", "getShippingAddress", "...
Set quote shipping method from transaction data @param Quote $quote @param $transaction @throws \Exception
[ "Set", "quote", "shipping", "method", "from", "transaction", "data" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L310-L322
44,906
BoltApp/bolt-magento2
Helper/Order.php
Order.setAddress
private function setAddress($quoteAddress, $address) { $address = $this->cartHelper->handleSpecialAddressCases($address); $region = $this->regionModel->loadByName(@$address->region, @$address->country_code); $addressData = [ 'firstname' => @$address->first_name, 'lastname' => @$address->last_name, 'street' => trim(@$address->street_address1 . "\n" . @$address->street_address2), 'city' => @$address->locality, 'country_id' => @$address->country_code, 'region' => @$address->region, 'postcode' => @$address->postal_code, 'telephone' => @$address->phone_number, 'region_id' => $region ? $region->getId() : null, 'company' => @$address->company, ]; if ($this->cartHelper->validateEmail(@$address->email_address)) { $addressData['email'] = $address->email_address; } // discard empty address fields foreach ($addressData as $key => $value) { if (empty($value)) { unset($addressData[$key]); } } $quoteAddress->setShouldIgnoreValidation(true); $quoteAddress->addData($addressData)->save(); }
php
private function setAddress($quoteAddress, $address) { $address = $this->cartHelper->handleSpecialAddressCases($address); $region = $this->regionModel->loadByName(@$address->region, @$address->country_code); $addressData = [ 'firstname' => @$address->first_name, 'lastname' => @$address->last_name, 'street' => trim(@$address->street_address1 . "\n" . @$address->street_address2), 'city' => @$address->locality, 'country_id' => @$address->country_code, 'region' => @$address->region, 'postcode' => @$address->postal_code, 'telephone' => @$address->phone_number, 'region_id' => $region ? $region->getId() : null, 'company' => @$address->company, ]; if ($this->cartHelper->validateEmail(@$address->email_address)) { $addressData['email'] = $address->email_address; } // discard empty address fields foreach ($addressData as $key => $value) { if (empty($value)) { unset($addressData[$key]); } } $quoteAddress->setShouldIgnoreValidation(true); $quoteAddress->addData($addressData)->save(); }
[ "private", "function", "setAddress", "(", "$", "quoteAddress", ",", "$", "address", ")", "{", "$", "address", "=", "$", "this", "->", "cartHelper", "->", "handleSpecialAddressCases", "(", "$", "address", ")", ";", "$", "region", "=", "$", "this", "->", "...
Set Quote address data helper method. @param Address $quoteAddress @param $address @throws \Exception
[ "Set", "Quote", "address", "data", "helper", "method", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L332-L364
44,907
BoltApp/bolt-magento2
Helper/Order.php
Order.setShippingAddress
private function setShippingAddress($quote, $transaction) { $address = @$transaction->order->cart->shipments[0]->shipping_address; if ($address) { $this->setAddress($quote->getShippingAddress(), $address); } }
php
private function setShippingAddress($quote, $transaction) { $address = @$transaction->order->cart->shipments[0]->shipping_address; if ($address) { $this->setAddress($quote->getShippingAddress(), $address); } }
[ "private", "function", "setShippingAddress", "(", "$", "quote", ",", "$", "transaction", ")", "{", "$", "address", "=", "@", "$", "transaction", "->", "order", "->", "cart", "->", "shipments", "[", "0", "]", "->", "shipping_address", ";", "if", "(", "$",...
Set Quote shipping address data. @param Quote $quote @param $transaction @return void @throws \Exception
[ "Set", "Quote", "shipping", "address", "data", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L375-L381
44,908
BoltApp/bolt-magento2
Helper/Order.php
Order.setBillingAddress
private function setBillingAddress($quote, $transaction) { $address = @$transaction->order->cart->billing_address; if ($address) { $this->setAddress($quote->getBillingAddress(), $address); } }
php
private function setBillingAddress($quote, $transaction) { $address = @$transaction->order->cart->billing_address; if ($address) { $this->setAddress($quote->getBillingAddress(), $address); } }
[ "private", "function", "setBillingAddress", "(", "$", "quote", ",", "$", "transaction", ")", "{", "$", "address", "=", "@", "$", "transaction", "->", "order", "->", "cart", "->", "billing_address", ";", "if", "(", "$", "address", ")", "{", "$", "this", ...
Set Quote billing address data. @param Quote $quote @param $transaction @throws \Exception
[ "Set", "Quote", "billing", "address", "data", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L391-L397
44,909
BoltApp/bolt-magento2
Helper/Order.php
Order.addCustomerDetails
private function addCustomerDetails($quote, $email) { $quote->setCustomerEmail($email); if (!$quote->getCustomerId()) { $quote->setCustomerId(null); $quote->setCheckoutMethod('guest'); $quote->setCustomerIsGuest(true); $quote->setCustomerGroupId(GroupInterface::NOT_LOGGED_IN_ID); } }
php
private function addCustomerDetails($quote, $email) { $quote->setCustomerEmail($email); if (!$quote->getCustomerId()) { $quote->setCustomerId(null); $quote->setCheckoutMethod('guest'); $quote->setCustomerIsGuest(true); $quote->setCustomerGroupId(GroupInterface::NOT_LOGGED_IN_ID); } }
[ "private", "function", "addCustomerDetails", "(", "$", "quote", ",", "$", "email", ")", "{", "$", "quote", "->", "setCustomerEmail", "(", "$", "email", ")", ";", "if", "(", "!", "$", "quote", "->", "getCustomerId", "(", ")", ")", "{", "$", "quote", "...
Set quote customer email and guest checkout parameters @param Quote $quote @param string $email @return void
[ "Set", "quote", "customer", "email", "and", "guest", "checkout", "parameters" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L407-L416
44,910
BoltApp/bolt-magento2
Helper/Order.php
Order.setPaymentMethod
private function setPaymentMethod($quote) { $quote->setPaymentMethod(Payment::METHOD_CODE); // Set Sales Order Payment $quote->getPayment()->importData(['method' => Payment::METHOD_CODE])->save(); }
php
private function setPaymentMethod($quote) { $quote->setPaymentMethod(Payment::METHOD_CODE); // Set Sales Order Payment $quote->getPayment()->importData(['method' => Payment::METHOD_CODE])->save(); }
[ "private", "function", "setPaymentMethod", "(", "$", "quote", ")", "{", "$", "quote", "->", "setPaymentMethod", "(", "Payment", "::", "METHOD_CODE", ")", ";", "// Set Sales Order Payment", "$", "quote", "->", "getPayment", "(", ")", "->", "importData", "(", "[...
Set Quote payment method, 'boltpay' @param Quote $quote @throws LocalizedException @throws \Exception
[ "Set", "Quote", "payment", "method", "boltpay" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L426-L431
44,911
BoltApp/bolt-magento2
Helper/Order.php
Order.adjustTaxMismatch
private function adjustTaxMismatch($transaction, $order, $quote) { $boltTaxAmount = round($transaction->order->cart->tax_amount->amount / 100, 2); $boltTotalAmount = round($transaction->order->cart->total_amount->amount / 100, 2); $orderTaxAmount = round($order->getTaxAmount(), 2); if ($boltTaxAmount != $orderTaxAmount) { $order->setTaxAmount($boltTaxAmount); $order->setBaseGrandTotal($boltTotalAmount); $order->setGrandTotal($boltTotalAmount); $this->bugsnag->registerCallback(function ($report) use ($quote, $boltTaxAmount, $orderTaxAmount) { $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); $report->setMetaData([ 'TAX MISMATCH' => [ 'Store Applied Taxes' => $address->getAppliedTaxes(), 'Bolt Tax Amount' => $boltTaxAmount, 'Store Tax Amount' => $orderTaxAmount, 'Order #' => $quote->getReservedOrderId(), 'Quote ID' => $quote->getId(), ] ]); }); $diff = round($boltTaxAmount - $orderTaxAmount, 2); $this->bugsnag->notifyError('Tax Mismatch', "Totals adjusted by $diff"); } }
php
private function adjustTaxMismatch($transaction, $order, $quote) { $boltTaxAmount = round($transaction->order->cart->tax_amount->amount / 100, 2); $boltTotalAmount = round($transaction->order->cart->total_amount->amount / 100, 2); $orderTaxAmount = round($order->getTaxAmount(), 2); if ($boltTaxAmount != $orderTaxAmount) { $order->setTaxAmount($boltTaxAmount); $order->setBaseGrandTotal($boltTotalAmount); $order->setGrandTotal($boltTotalAmount); $this->bugsnag->registerCallback(function ($report) use ($quote, $boltTaxAmount, $orderTaxAmount) { $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); $report->setMetaData([ 'TAX MISMATCH' => [ 'Store Applied Taxes' => $address->getAppliedTaxes(), 'Bolt Tax Amount' => $boltTaxAmount, 'Store Tax Amount' => $orderTaxAmount, 'Order #' => $quote->getReservedOrderId(), 'Quote ID' => $quote->getId(), ] ]); }); $diff = round($boltTaxAmount - $orderTaxAmount, 2); $this->bugsnag->notifyError('Tax Mismatch', "Totals adjusted by $diff"); } }
[ "private", "function", "adjustTaxMismatch", "(", "$", "transaction", ",", "$", "order", ",", "$", "quote", ")", "{", "$", "boltTaxAmount", "=", "round", "(", "$", "transaction", "->", "order", "->", "cart", "->", "tax_amount", "->", "amount", "/", "100", ...
Check for Tax mismatch between Bolt and Magento. Override store value with the Bolt one if a mismatch was found. @param \stdClass $transaction @param OrderModel $order @param Quote $quote
[ "Check", "for", "Tax", "mismatch", "between", "Bolt", "and", "Magento", ".", "Override", "store", "value", "with", "the", "Bolt", "one", "if", "a", "mismatch", "was", "found", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L441-L473
44,912
BoltApp/bolt-magento2
Helper/Order.php
Order.setQuotePaymentInfoData
private function setQuotePaymentInfoData($quote, $data) { foreach ($data as $key => $value) { $this->getQuotePaymentInfoInstance($quote)->setData($key, $value)->save(); } }
php
private function setQuotePaymentInfoData($quote, $data) { foreach ($data as $key => $value) { $this->getQuotePaymentInfoInstance($quote)->setData($key, $value)->save(); } }
[ "private", "function", "setQuotePaymentInfoData", "(", "$", "quote", ",", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "getQuotePaymentInfoInstance", "(", "$", "quote", ")", "->", ...
Assign data to the quote payment info instance @param Quote $quote @param array $data @return void
[ "Assign", "data", "to", "the", "quote", "payment", "info", "instance" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L600-L605
44,913
BoltApp/bolt-magento2
Helper/Order.php
Order.getQuotePaymentInfoInstance
private function getQuotePaymentInfoInstance($quote) { return $this->quotePaymentInfoInstance ?: $this->quotePaymentInfoInstance = $quote->getPayment()->getMethodInstance()->getInfoInstance(); }
php
private function getQuotePaymentInfoInstance($quote) { return $this->quotePaymentInfoInstance ?: $this->quotePaymentInfoInstance = $quote->getPayment()->getMethodInstance()->getInfoInstance(); }
[ "private", "function", "getQuotePaymentInfoInstance", "(", "$", "quote", ")", "{", "return", "$", "this", "->", "quotePaymentInfoInstance", "?", ":", "$", "this", "->", "quotePaymentInfoInstance", "=", "$", "quote", "->", "getPayment", "(", ")", "->", "getMethod...
Returns quote payment info object @param Quote $quote @return \Magento\Payment\Model\Info
[ "Returns", "quote", "payment", "info", "object" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L613-L617
44,914
BoltApp/bolt-magento2
Helper/Order.php
Order.deleteRedundantQuotes
private function deleteRedundantQuotes($quote) { $connection = $this->resourceConnection->getConnection(); // get table name with prefix $tableName = $this->resourceConnection->getTableName('quote'); $sql = "DELETE FROM {$tableName} WHERE bolt_parent_quote_id = :bolt_parent_quote_id AND entity_id != :entity_id"; $bind = [ 'bolt_parent_quote_id' => $quote->getBoltParentQuoteId(), 'entity_id' => $quote->getBoltParentQuoteId() ]; $connection->query($sql, $bind); }
php
private function deleteRedundantQuotes($quote) { $connection = $this->resourceConnection->getConnection(); // get table name with prefix $tableName = $this->resourceConnection->getTableName('quote'); $sql = "DELETE FROM {$tableName} WHERE bolt_parent_quote_id = :bolt_parent_quote_id AND entity_id != :entity_id"; $bind = [ 'bolt_parent_quote_id' => $quote->getBoltParentQuoteId(), 'entity_id' => $quote->getBoltParentQuoteId() ]; $connection->query($sql, $bind); }
[ "private", "function", "deleteRedundantQuotes", "(", "$", "quote", ")", "{", "$", "connection", "=", "$", "this", "->", "resourceConnection", "->", "getConnection", "(", ")", ";", "// get table name with prefix", "$", "tableName", "=", "$", "this", "->", "resour...
Delete redundant immutable quotes. @param Quote $quote
[ "Delete", "redundant", "immutable", "quotes", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L624-L638
44,915
BoltApp/bolt-magento2
Helper/Order.php
Order.setOrderUserNote
public function setOrderUserNote($order, $userNote) { $order ->addStatusHistoryComment($userNote) ->setIsVisibleOnFront(true) ->setIsCustomerNotified(false); return $order; }
php
public function setOrderUserNote($order, $userNote) { $order ->addStatusHistoryComment($userNote) ->setIsVisibleOnFront(true) ->setIsCustomerNotified(false); return $order; }
[ "public", "function", "setOrderUserNote", "(", "$", "order", ",", "$", "userNote", ")", "{", "$", "order", "->", "addStatusHistoryComment", "(", "$", "userNote", ")", "->", "setIsVisibleOnFront", "(", "true", ")", "->", "setIsCustomerNotified", "(", "false", "...
Add user note as status history comment @param OrderModel $order @param string $userNote @return OrderModel
[ "Add", "user", "note", "as", "status", "history", "comment" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L740-L748
44,916
BoltApp/bolt-magento2
Helper/Order.php
Order.holdOnTotalsMismatch
private function holdOnTotalsMismatch($order, $transaction) { $boltTotal = $transaction->order->cart->total_amount->amount; $storeTotal = round($order->getGrandTotal() * 100); // Stop if no mismatch if ($boltTotal == $storeTotal) { return; } // Put the order ON HOLD and add the status message. // Do it once only, skip on subsequent hooks if ($order->getState() != OrderModel::STATE_HOLDED) { // Put the order on hold $this->setOrderState($order, OrderModel::STATE_HOLDED); // Add order status history comment $comment = __( 'BOLTPAY INFO :: THERE IS A MISMATCH IN THE ORDER PAID AND ORDER RECORDED.<br> Paid amount: %1 Recorded amount: %2<br>Bolt transaction: %3', $boltTotal / 100, $order->getGrandTotal(), $this->formatReferenceUrl($transaction->reference) ); $order->addStatusHistoryComment($comment); $order->save(); } // Get the order and quote id list($incrementId, $quoteId) = array_pad( explode(' / ', $transaction->order->cart->display_id), 2, null ); if (!$quoteId) { $quoteId = $transaction->order->cart->order_reference; } // If the quote exists collect cart data for bugsnag try { $quote = $this->cartHelper->getQuoteById($quoteId); $cart = $this->cartHelper->getCartData(true, false, $quote); } catch (NoSuchEntityException $e) { // Quote was cleaned by cron job $cart = ['The quote does not exist.']; } // Log the debug info $this->bugsnag->registerCallback(function ($report) use ( $transaction, $cart, $incrementId, $boltTotal, $storeTotal ) { $report->setMetaData([ 'TOTALS_MISMATCH' => [ 'Reference' => $transaction->reference, 'Order ID' => $incrementId, 'Bolt Total' => $boltTotal, 'Store Total' => $storeTotal, 'Bolt Cart' => $transaction->order->cart, 'Store Cart' => $cart ] ]); }); throw new LocalizedException(__( 'Order Totals Mismatch Reference: %1 Order: %2 Bolt Total: %3 Store Total: %4', $transaction->reference, $incrementId, $boltTotal, $storeTotal )); }
php
private function holdOnTotalsMismatch($order, $transaction) { $boltTotal = $transaction->order->cart->total_amount->amount; $storeTotal = round($order->getGrandTotal() * 100); // Stop if no mismatch if ($boltTotal == $storeTotal) { return; } // Put the order ON HOLD and add the status message. // Do it once only, skip on subsequent hooks if ($order->getState() != OrderModel::STATE_HOLDED) { // Put the order on hold $this->setOrderState($order, OrderModel::STATE_HOLDED); // Add order status history comment $comment = __( 'BOLTPAY INFO :: THERE IS A MISMATCH IN THE ORDER PAID AND ORDER RECORDED.<br> Paid amount: %1 Recorded amount: %2<br>Bolt transaction: %3', $boltTotal / 100, $order->getGrandTotal(), $this->formatReferenceUrl($transaction->reference) ); $order->addStatusHistoryComment($comment); $order->save(); } // Get the order and quote id list($incrementId, $quoteId) = array_pad( explode(' / ', $transaction->order->cart->display_id), 2, null ); if (!$quoteId) { $quoteId = $transaction->order->cart->order_reference; } // If the quote exists collect cart data for bugsnag try { $quote = $this->cartHelper->getQuoteById($quoteId); $cart = $this->cartHelper->getCartData(true, false, $quote); } catch (NoSuchEntityException $e) { // Quote was cleaned by cron job $cart = ['The quote does not exist.']; } // Log the debug info $this->bugsnag->registerCallback(function ($report) use ( $transaction, $cart, $incrementId, $boltTotal, $storeTotal ) { $report->setMetaData([ 'TOTALS_MISMATCH' => [ 'Reference' => $transaction->reference, 'Order ID' => $incrementId, 'Bolt Total' => $boltTotal, 'Store Total' => $storeTotal, 'Bolt Cart' => $transaction->order->cart, 'Store Cart' => $cart ] ]); }); throw new LocalizedException(__( 'Order Totals Mismatch Reference: %1 Order: %2 Bolt Total: %3 Store Total: %4', $transaction->reference, $incrementId, $boltTotal, $storeTotal )); }
[ "private", "function", "holdOnTotalsMismatch", "(", "$", "order", ",", "$", "transaction", ")", "{", "$", "boltTotal", "=", "$", "transaction", "->", "order", "->", "cart", "->", "total_amount", "->", "amount", ";", "$", "storeTotal", "=", "round", "(", "$...
Record total amount mismatch between magento and bolt order. Log the error in order comments and report via bugsnag. Put the order ON HOLD if it's a mismatch. @param OrderModel $order @param \stdClass $transaction @return bool true if the order was placed on hold, otherwise false
[ "Record", "total", "amount", "mismatch", "between", "magento", "and", "bolt", "order", ".", "Log", "the", "error", "in", "order", "comments", "and", "report", "via", "bugsnag", ".", "Put", "the", "order", "ON", "HOLD", "if", "it", "s", "a", "mismatch", "...
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L905-L978
44,917
BoltApp/bolt-magento2
Helper/Order.php
Order.formatTransactionData
private function formatTransactionData($order, $transaction, $amount) { return [ 'Time' => $this->timezone->formatDateTime( date('Y-m-d H:i:s', $transaction->date / 1000), 2, 2 ), 'Reference' => $transaction->reference, 'Amount' => $order->getBaseCurrency()->formatTxt($amount / 100), 'Transaction ID' => $transaction->id ]; }
php
private function formatTransactionData($order, $transaction, $amount) { return [ 'Time' => $this->timezone->formatDateTime( date('Y-m-d H:i:s', $transaction->date / 1000), 2, 2 ), 'Reference' => $transaction->reference, 'Amount' => $order->getBaseCurrency()->formatTxt($amount / 100), 'Transaction ID' => $transaction->id ]; }
[ "private", "function", "formatTransactionData", "(", "$", "order", ",", "$", "transaction", ",", "$", "amount", ")", "{", "return", "[", "'Time'", "=>", "$", "this", "->", "timezone", "->", "formatDateTime", "(", "date", "(", "'Y-m-d H:i:s'", ",", "$", "tr...
Generate data to be stored with the transaction @param OrderModel $order @param \stdClass $transaction @param null|int $amount
[ "Generate", "data", "to", "be", "stored", "with", "the", "transaction" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L1008-L1020
44,918
BoltApp/bolt-magento2
Helper/Order.php
Order.setOrderState
private function setOrderState($order, $state) { $prevState = $order->getState(); if ($state == OrderModel::STATE_HOLDED) { // Ensure order is in one of the "can hold" states [STATE_NEW | STATE_PROCESSING] // to avoid no state on admin order unhold if ($prevState != OrderModel::STATE_NEW) { $order->setState(OrderModel::STATE_PROCESSING); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_PROCESSING)); } try { $order->hold(); } catch (\Exception $e) { // Put the order in "on hold" state even if the previous call fails $order->setState(OrderModel::STATE_HOLDED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_HOLDED)); } } elseif ($state == OrderModel::STATE_CANCELED) { try { $order->cancel(); $order->setState(OrderModel::STATE_CANCELED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED)); } catch (\Exception $e) { // Put the order in "canceled" state even if the previous call fails $order->setState(OrderModel::STATE_CANCELED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED)); } } else { $order->setState($state); $order->setStatus($order->getConfig()->getStateDefaultStatus($state)); } }
php
private function setOrderState($order, $state) { $prevState = $order->getState(); if ($state == OrderModel::STATE_HOLDED) { // Ensure order is in one of the "can hold" states [STATE_NEW | STATE_PROCESSING] // to avoid no state on admin order unhold if ($prevState != OrderModel::STATE_NEW) { $order->setState(OrderModel::STATE_PROCESSING); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_PROCESSING)); } try { $order->hold(); } catch (\Exception $e) { // Put the order in "on hold" state even if the previous call fails $order->setState(OrderModel::STATE_HOLDED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_HOLDED)); } } elseif ($state == OrderModel::STATE_CANCELED) { try { $order->cancel(); $order->setState(OrderModel::STATE_CANCELED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED)); } catch (\Exception $e) { // Put the order in "canceled" state even if the previous call fails $order->setState(OrderModel::STATE_CANCELED); $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED)); } } else { $order->setState($state); $order->setStatus($order->getConfig()->getStateDefaultStatus($state)); } }
[ "private", "function", "setOrderState", "(", "$", "order", ",", "$", "state", ")", "{", "$", "prevState", "=", "$", "order", "->", "getState", "(", ")", ";", "if", "(", "$", "state", "==", "OrderModel", "::", "STATE_HOLDED", ")", "{", "// Ensure order is...
Change order state taking transition constraints into account. @param OrderModel $order @param string $state
[ "Change", "order", "state", "taking", "transition", "constraints", "into", "account", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L1046-L1077
44,919
BoltApp/bolt-magento2
Helper/Order.php
Order.checkPaymentMethod
private function checkPaymentMethod($payment) { $paymentMethod = $payment->getMethod(); if ($paymentMethod != Payment::METHOD_CODE) { throw new LocalizedException(__( 'Payment method assigned to order is: %1', $paymentMethod )); } }
php
private function checkPaymentMethod($payment) { $paymentMethod = $payment->getMethod(); if ($paymentMethod != Payment::METHOD_CODE) { throw new LocalizedException(__( 'Payment method assigned to order is: %1', $paymentMethod )); } }
[ "private", "function", "checkPaymentMethod", "(", "$", "payment", ")", "{", "$", "paymentMethod", "=", "$", "payment", "->", "getMethod", "(", ")", ";", "if", "(", "$", "paymentMethod", "!=", "Payment", "::", "METHOD_CODE", ")", "{", "throw", "new", "Local...
Check if order payment method was set to 'boltpay' @param OrderPaymentInterface $payment @throws LocalizedException
[ "Check", "if", "order", "payment", "method", "was", "set", "to", "boltpay" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L1085-L1095
44,920
BoltApp/bolt-magento2
Helper/Order.php
Order.createOrderInvoice
private function createOrderInvoice($order, $transactionId, $amount) { if ($order->getTotalInvoiced() + $amount == $order->getGrandTotal()) { $invoice = $this->invoiceService->prepareInvoice($order); } else { $invoice = $this->invoiceService->prepareInvoiceWithoutItems($order, $amount); } $invoice->setRequestedCaptureCase(Invoice::CAPTURE_OFFLINE); $invoice->setTransactionId($transactionId); $invoice->setBaseGrandTotal($amount); $invoice->setGrandTotal($amount); $invoice->register(); $invoice->save(); $order->addRelatedObject($invoice); if (!$invoice->getEmailSent()) { $this->invoiceSender->send($invoice); } //Add notification comment to order $order->addStatusHistoryComment( __('Invoice #%1 is created. Notification email is sent to customer.', $invoice->getId()) )->setIsCustomerNotified(true)->save(); return $invoice; }
php
private function createOrderInvoice($order, $transactionId, $amount) { if ($order->getTotalInvoiced() + $amount == $order->getGrandTotal()) { $invoice = $this->invoiceService->prepareInvoice($order); } else { $invoice = $this->invoiceService->prepareInvoiceWithoutItems($order, $amount); } $invoice->setRequestedCaptureCase(Invoice::CAPTURE_OFFLINE); $invoice->setTransactionId($transactionId); $invoice->setBaseGrandTotal($amount); $invoice->setGrandTotal($amount); $invoice->register(); $invoice->save(); $order->addRelatedObject($invoice); if (!$invoice->getEmailSent()) { $this->invoiceSender->send($invoice); } //Add notification comment to order $order->addStatusHistoryComment( __('Invoice #%1 is created. Notification email is sent to customer.', $invoice->getId()) )->setIsCustomerNotified(true)->save(); return $invoice; }
[ "private", "function", "createOrderInvoice", "(", "$", "order", ",", "$", "transactionId", ",", "$", "amount", ")", "{", "if", "(", "$", "order", "->", "getTotalInvoiced", "(", ")", "+", "$", "amount", "==", "$", "order", "->", "getGrandTotal", "(", ")",...
Create an invoice for the order. @param OrderModel $order @param string $transactionId @param float $amount @return bool @throws \Exception @throws LocalizedException
[ "Create", "an", "invoice", "for", "the", "order", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Order.php#L1352-L1379
44,921
BoltApp/bolt-magento2
Model/Service/InvoiceService.php
InvoiceService.prepareInvoiceWithoutItems
public function prepareInvoiceWithoutItems(OrderInterface $order, $amount) { try { $invoice = $this->orderConverter->toInvoice($order); $invoice->setBaseGrandTotal($amount); $invoice->setSubtotal($amount); $invoice->setBaseSubtotal($amount); $invoice->setGrandTotal($amount); $order->getInvoiceCollection()->addItem($invoice); return $invoice; } catch(\Exception $e) { $this->bugsnag->notifyException($e); throw $e; } }
php
public function prepareInvoiceWithoutItems(OrderInterface $order, $amount) { try { $invoice = $this->orderConverter->toInvoice($order); $invoice->setBaseGrandTotal($amount); $invoice->setSubtotal($amount); $invoice->setBaseSubtotal($amount); $invoice->setGrandTotal($amount); $order->getInvoiceCollection()->addItem($invoice); return $invoice; } catch(\Exception $e) { $this->bugsnag->notifyException($e); throw $e; } }
[ "public", "function", "prepareInvoiceWithoutItems", "(", "OrderInterface", "$", "order", ",", "$", "amount", ")", "{", "try", "{", "$", "invoice", "=", "$", "this", "->", "orderConverter", "->", "toInvoice", "(", "$", "order", ")", ";", "$", "invoice", "->...
Prepare order invoice without any items @param \Magento\Sales\Api\Data\OrderInterface $order @param $amount @return \Magento\Sales\Model\Order\Invoice @throws \Exception
[ "Prepare", "order", "invoice", "without", "any", "items" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Model/Service/InvoiceService.php#L49-L65
44,922
BoltApp/bolt-magento2
Model/Api/OrderManagement.php
OrderManagement.manage
public function manage( $id = null, $reference, $order = null, $type = null, $amount = null, $currency = null, $status = null, $display_id = null, $source_transaction_id = null, $source_transaction_reference = null ) { try { HookHelper::$fromBolt = true; $this->logHelper->addInfoLog($this->request->getContent()); $this->hookHelper->setCommonMetaData(); $this->hookHelper->setHeaders(); $this->hookHelper->verifyWebhook(); if (empty($reference)) { throw new LocalizedException( __('Missing required parameters.') ); } $this->orderHelper->saveUpdateOrder( $reference, $this->request->getHeader(ConfigHelper::BOLT_TRACE_ID_HEADER), $type ); $this->response->setHttpResponseCode(200); $this->response->setBody(json_encode([ 'status' => 'success', 'message' => 'Order creation / upadte was successful', ])); } catch (\Magento\Framework\Webapi\Exception $e) { $this->bugsnag->notifyException($e); $this->response->setHttpResponseCode($e->getHttpCode()); $this->response->setBody(json_encode([ 'status' => 'error', 'code' => $e->getCode(), 'message' => $e->getMessage(), ])); } catch (\Exception $e) { $this->bugsnag->notifyException($e); $this->response->setHttpResponseCode(422); $this->response->setBody(json_encode([ 'status' => 'error', 'code' => '6009', 'message' => 'Unprocessable Entity: ' . $e->getMessage(), ])); } finally { $this->response->sendResponse(); } }
php
public function manage( $id = null, $reference, $order = null, $type = null, $amount = null, $currency = null, $status = null, $display_id = null, $source_transaction_id = null, $source_transaction_reference = null ) { try { HookHelper::$fromBolt = true; $this->logHelper->addInfoLog($this->request->getContent()); $this->hookHelper->setCommonMetaData(); $this->hookHelper->setHeaders(); $this->hookHelper->verifyWebhook(); if (empty($reference)) { throw new LocalizedException( __('Missing required parameters.') ); } $this->orderHelper->saveUpdateOrder( $reference, $this->request->getHeader(ConfigHelper::BOLT_TRACE_ID_HEADER), $type ); $this->response->setHttpResponseCode(200); $this->response->setBody(json_encode([ 'status' => 'success', 'message' => 'Order creation / upadte was successful', ])); } catch (\Magento\Framework\Webapi\Exception $e) { $this->bugsnag->notifyException($e); $this->response->setHttpResponseCode($e->getHttpCode()); $this->response->setBody(json_encode([ 'status' => 'error', 'code' => $e->getCode(), 'message' => $e->getMessage(), ])); } catch (\Exception $e) { $this->bugsnag->notifyException($e); $this->response->setHttpResponseCode(422); $this->response->setBody(json_encode([ 'status' => 'error', 'code' => '6009', 'message' => 'Unprocessable Entity: ' . $e->getMessage(), ])); } finally { $this->response->sendResponse(); } }
[ "public", "function", "manage", "(", "$", "id", "=", "null", ",", "$", "reference", ",", "$", "order", "=", "null", ",", "$", "type", "=", "null", ",", "$", "amount", "=", "null", ",", "$", "currency", "=", "null", ",", "$", "status", "=", "null"...
Manage order. @api @param mixed $id @param mixed $reference @param mixed $order @param mixed $type @param mixed $amount @param mixed $currency @param mixed $status @param mixed $display_id @param mixed $source_transaction_id @param mixed $source_transaction_reference @return void @throws \Exception
[ "Manage", "order", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Model/Api/OrderManagement.php#L119-L175
44,923
BoltApp/bolt-magento2
Helper/Hook.php
Hook.verifyWebhookApi
private function verifyWebhookApi($payload, $hmac_header) { //Request Data $requestData = $this->dataObjectFactory->create(); $requestData->setApiData(json_decode($payload)); $requestData->setDynamicApiUrl(ApiHelper::API_VERIFY_SIGNATURE); $requestData->setApiKey($this->configHelper->getApiKey()); $headers = [ self::HMAC_HEADER => $hmac_header ]; $requestData->setHeaders($headers); $requestData->setStatusOnly(true); //Build Request $request = $this->apiHelper->buildRequest($requestData); try { $result = $this->apiHelper->sendRequest($request); } catch (\Exception $e) { return false; } return $result == 200; }
php
private function verifyWebhookApi($payload, $hmac_header) { //Request Data $requestData = $this->dataObjectFactory->create(); $requestData->setApiData(json_decode($payload)); $requestData->setDynamicApiUrl(ApiHelper::API_VERIFY_SIGNATURE); $requestData->setApiKey($this->configHelper->getApiKey()); $headers = [ self::HMAC_HEADER => $hmac_header ]; $requestData->setHeaders($headers); $requestData->setStatusOnly(true); //Build Request $request = $this->apiHelper->buildRequest($requestData); try { $result = $this->apiHelper->sendRequest($request); } catch (\Exception $e) { return false; } return $result == 200; }
[ "private", "function", "verifyWebhookApi", "(", "$", "payload", ",", "$", "hmac_header", ")", "{", "//Request Data", "$", "requestData", "=", "$", "this", "->", "dataObjectFactory", "->", "create", "(", ")", ";", "$", "requestData", "->", "setApiData", "(", ...
Verifying Hook Requests via API call. @param string $payload @param string $hmac_header @return bool @throws \Magento\Framework\Exception\LocalizedException
[ "Verifying", "Hook", "Requests", "via", "API", "call", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Hook.php#L115-L140
44,924
BoltApp/bolt-magento2
Helper/Hook.php
Hook.verifyWebhookSecret
public function verifyWebhookSecret($payload, $hmac_header) { $signing_secret = $this->configHelper->getSigningSecret(); $computed_hmac = base64_encode(hash_hmac('sha256', $payload, $signing_secret, true)); return $computed_hmac == $hmac_header; }
php
public function verifyWebhookSecret($payload, $hmac_header) { $signing_secret = $this->configHelper->getSigningSecret(); $computed_hmac = base64_encode(hash_hmac('sha256', $payload, $signing_secret, true)); return $computed_hmac == $hmac_header; }
[ "public", "function", "verifyWebhookSecret", "(", "$", "payload", ",", "$", "hmac_header", ")", "{", "$", "signing_secret", "=", "$", "this", "->", "configHelper", "->", "getSigningSecret", "(", ")", ";", "$", "computed_hmac", "=", "base64_encode", "(", "hash_...
Verifying Hook Request using pre-exchanged signing secret key. @param string $payload @param string $hmac_header @return bool
[ "Verifying", "Hook", "Request", "using", "pre", "-", "exchanged", "signing", "secret", "key", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Hook.php#L150-L156
44,925
BoltApp/bolt-magento2
Helper/Hook.php
Hook.verifyWebhook
public function verifyWebhook() { $payload = $this->request->getContent(); $hmac_header = $this->request->getHeader(self::HMAC_HEADER); if (!$this->verifyWebhookSecret($payload, $hmac_header) && !$this->verifyWebhookApi($payload, $hmac_header)) { throw new WebapiException(__('Precondition Failed'), 6001, 412); } }
php
public function verifyWebhook() { $payload = $this->request->getContent(); $hmac_header = $this->request->getHeader(self::HMAC_HEADER); if (!$this->verifyWebhookSecret($payload, $hmac_header) && !$this->verifyWebhookApi($payload, $hmac_header)) { throw new WebapiException(__('Precondition Failed'), 6001, 412); } }
[ "public", "function", "verifyWebhook", "(", ")", "{", "$", "payload", "=", "$", "this", "->", "request", "->", "getContent", "(", ")", ";", "$", "hmac_header", "=", "$", "this", "->", "request", "->", "getHeader", "(", "self", "::", "HMAC_HEADER", ")", ...
Verifying Hook Request. If signing secret is not defined or fails fallback to api call. @throws WebapiException @throws \Magento\Framework\Exception\LocalizedException
[ "Verifying", "Hook", "Request", ".", "If", "signing", "secret", "is", "not", "defined", "or", "fails", "fallback", "to", "api", "call", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Hook.php#L164-L172
44,926
BoltApp/bolt-magento2
Helper/Hook.php
Hook.setCommonMetaData
public function setCommonMetaData() { if ($boltTraceId = $this->request->getHeader(ConfigHelper::BOLT_TRACE_ID_HEADER)) { $this->bugsnag->registerCallback(function ($report) use ($boltTraceId) { $report->setMetaData([ 'META DATA' => [ 'bolt_trace_id' => $boltTraceId, ] ]); }); } }
php
public function setCommonMetaData() { if ($boltTraceId = $this->request->getHeader(ConfigHelper::BOLT_TRACE_ID_HEADER)) { $this->bugsnag->registerCallback(function ($report) use ($boltTraceId) { $report->setMetaData([ 'META DATA' => [ 'bolt_trace_id' => $boltTraceId, ] ]); }); } }
[ "public", "function", "setCommonMetaData", "(", ")", "{", "if", "(", "$", "boltTraceId", "=", "$", "this", "->", "request", "->", "getHeader", "(", "ConfigHelper", "::", "BOLT_TRACE_ID_HEADER", ")", ")", "{", "$", "this", "->", "bugsnag", "->", "registerCall...
Set bugsnag metadata bolt_trace_id
[ "Set", "bugsnag", "metadata", "bolt_trace_id" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Hook.php#L177-L188
44,927
BoltApp/bolt-magento2
Helper/Hook.php
Hook.setHeaders
public function setHeaders() { $this->response->getHeaders()->addHeaders([ 'User-Agent' => 'BoltPay/Magento-'.$this->configHelper->getStoreVersion() . '/' . $this->configHelper->getModuleVersion(), 'X-Bolt-Plugin-Version' => $this->configHelper->getModuleVersion(), ]); }
php
public function setHeaders() { $this->response->getHeaders()->addHeaders([ 'User-Agent' => 'BoltPay/Magento-'.$this->configHelper->getStoreVersion() . '/' . $this->configHelper->getModuleVersion(), 'X-Bolt-Plugin-Version' => $this->configHelper->getModuleVersion(), ]); }
[ "public", "function", "setHeaders", "(", ")", "{", "$", "this", "->", "response", "->", "getHeaders", "(", ")", "->", "addHeaders", "(", "[", "'User-Agent'", "=>", "'BoltPay/Magento-'", ".", "$", "this", "->", "configHelper", "->", "getStoreVersion", "(", ")...
Set additional response headers
[ "Set", "additional", "response", "headers" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Hook.php#L193-L199
44,928
BoltApp/bolt-magento2
Helper/Discount.php
Discount.updateTotals
private function updateTotals(Quote $quote) { $quote->getShippingAddress()->setCollectShippingRates(true); $quote->setTotalsCollectedFlag(false); $quote->collectTotals(); $quote->setDataChanges(true); $this->quoteRepository->save($quote); }
php
private function updateTotals(Quote $quote) { $quote->getShippingAddress()->setCollectShippingRates(true); $quote->setTotalsCollectedFlag(false); $quote->collectTotals(); $quote->setDataChanges(true); $this->quoteRepository->save($quote); }
[ "private", "function", "updateTotals", "(", "Quote", "$", "quote", ")", "{", "$", "quote", "->", "getShippingAddress", "(", ")", "->", "setCollectShippingRates", "(", "true", ")", ";", "$", "quote", "->", "setTotalsCollectedFlag", "(", "false", ")", ";", "$"...
Collect and update quote totals. @param Quote $quote
[ "Collect", "and", "update", "quote", "totals", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L158-L165
44,929
BoltApp/bolt-magento2
Helper/Discount.php
Discount.loadAmastyGiftCard
public function loadAmastyGiftCard($code) { try { if (!$this->isAmastyGiftCardAvailable()) { return null; } $accountModel = $this->amastyAccountFactory->getInstance() ->create() ->loadByCode($code); return $accountModel && $accountModel->getId() ? $accountModel : null; } catch (\Exception $e) { return null; } }
php
public function loadAmastyGiftCard($code) { try { if (!$this->isAmastyGiftCardAvailable()) { return null; } $accountModel = $this->amastyAccountFactory->getInstance() ->create() ->loadByCode($code); return $accountModel && $accountModel->getId() ? $accountModel : null; } catch (\Exception $e) { return null; } }
[ "public", "function", "loadAmastyGiftCard", "(", "$", "code", ")", "{", "try", "{", "if", "(", "!", "$", "this", "->", "isAmastyGiftCardAvailable", "(", ")", ")", "{", "return", "null", ";", "}", "$", "accountModel", "=", "$", "this", "->", "amastyAccoun...
Load Amasty Gift Card account object. @param string $code Gift Card coupon code @return \Amasty\GiftCard\Model\Account|null
[ "Load", "Amasty", "Gift", "Card", "account", "object", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L172-L186
44,930
BoltApp/bolt-magento2
Helper/Discount.php
Discount.applyAmastyGiftCard
public function applyAmastyGiftCard($code, $accountModel, $quote) { // Get current gift card balance before applying it to the quote // in case "fixed_amount" / "pay for everything" discount type is used $giftAmount = $accountModel->getCurrentValue(); $quoteId = $quote->getId(); $isValid = $this->amastyGiftCardManagement->getInstance()->validateCode($quote, $code); if (!$isValid) { throw new LocalizedException(__('Coupon with specified code "%1" is not valid.', $code)); } if ($accountModel->canApplyCardForQuote($quote)) { $quoteGiftCard = $this->amastyQuoteFactory->getInstance()->create(); $this->amastyQuoteResource->getInstance()->load($quoteGiftCard, $quoteId, 'quote_id'); $subtotal = $quoteGiftCard->getSubtotal($quote); if ($quoteGiftCard->getCodeId() && $accountModel->getCodeId() == $quoteGiftCard->getCodeId()) { throw new LocalizedException(__('This gift card account is already in the quote.')); } elseif ($quoteGiftCard->getGiftAmount() && $subtotal == $quoteGiftCard->getGiftAmount()) { throw new LocalizedException(__('Gift card can\'t be applied. Maximum discount reached.')); } else { $quoteGiftCard->unsetData($quoteGiftCard->getIdFieldName()); $quoteGiftCard->setQuoteId($quoteId); $quoteGiftCard->setCodeId($accountModel->getCodeId()); $quoteGiftCard->setAccountId($accountModel->getId()); $this->amastyQuoteRepository->getInstance()->save($quoteGiftCard); $this->updateTotals($quote); if ($this->getAmastyPayForEverything()) { // pay for everything, items, shipping, tax return $giftAmount; } else { // pay for items only $totals = $quote->getTotals(); return $totals[self::AMASTY_GIFTCARD]->getValue(); } } } else { throw new LocalizedException(__('Gift card can\'t be applied.')); } }
php
public function applyAmastyGiftCard($code, $accountModel, $quote) { // Get current gift card balance before applying it to the quote // in case "fixed_amount" / "pay for everything" discount type is used $giftAmount = $accountModel->getCurrentValue(); $quoteId = $quote->getId(); $isValid = $this->amastyGiftCardManagement->getInstance()->validateCode($quote, $code); if (!$isValid) { throw new LocalizedException(__('Coupon with specified code "%1" is not valid.', $code)); } if ($accountModel->canApplyCardForQuote($quote)) { $quoteGiftCard = $this->amastyQuoteFactory->getInstance()->create(); $this->amastyQuoteResource->getInstance()->load($quoteGiftCard, $quoteId, 'quote_id'); $subtotal = $quoteGiftCard->getSubtotal($quote); if ($quoteGiftCard->getCodeId() && $accountModel->getCodeId() == $quoteGiftCard->getCodeId()) { throw new LocalizedException(__('This gift card account is already in the quote.')); } elseif ($quoteGiftCard->getGiftAmount() && $subtotal == $quoteGiftCard->getGiftAmount()) { throw new LocalizedException(__('Gift card can\'t be applied. Maximum discount reached.')); } else { $quoteGiftCard->unsetData($quoteGiftCard->getIdFieldName()); $quoteGiftCard->setQuoteId($quoteId); $quoteGiftCard->setCodeId($accountModel->getCodeId()); $quoteGiftCard->setAccountId($accountModel->getId()); $this->amastyQuoteRepository->getInstance()->save($quoteGiftCard); $this->updateTotals($quote); if ($this->getAmastyPayForEverything()) { // pay for everything, items, shipping, tax return $giftAmount; } else { // pay for items only $totals = $quote->getTotals(); return $totals[self::AMASTY_GIFTCARD]->getValue(); } } } else { throw new LocalizedException(__('Gift card can\'t be applied.')); } }
[ "public", "function", "applyAmastyGiftCard", "(", "$", "code", ",", "$", "accountModel", ",", "$", "quote", ")", "{", "// Get current gift card balance before applying it to the quote", "// in case \"fixed_amount\" / \"pay for everything\" discount type is used", "$", "giftAmount",...
Apply Amasty Gift Card coupon to cart @param string $code Gift Card coupon code @param \Amasty\GiftCard\Model\Account $accountModel @param Quote $quote @return float @throws LocalizedException
[ "Apply", "Amasty", "Gift", "Card", "coupon", "to", "cart" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L197-L245
44,931
BoltApp/bolt-magento2
Helper/Discount.php
Discount.cloneAmastyGiftCards
public function cloneAmastyGiftCards($sourceQuoteId, $destinationQuoteId) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); $connection->beginTransaction(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); // Clear previously applied gift cart codes from the immutable quote $sql = "DELETE FROM {$giftCardTable} WHERE quote_id = :destination_quote_id"; $connection->query($sql, ['destination_quote_id' => $destinationQuoteId]); // Copy all gift cart codes applied to the parent quote to the immutable quote $sql = "INSERT INTO {$giftCardTable} (quote_id, code_id, account_id, base_gift_amount, code) SELECT :destination_quote_id, code_id, account_id, base_gift_amount, code FROM {$giftCardTable} WHERE quote_id = :source_quote_id"; $connection->query($sql, ['destination_quote_id' => $destinationQuoteId, 'source_quote_id' => $sourceQuoteId]); $connection->commit(); } catch (\Zend_Db_Statement_Exception $e) { $connection->rollBack(); $this->bugsnag->notifyException($e); } }
php
public function cloneAmastyGiftCards($sourceQuoteId, $destinationQuoteId) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); $connection->beginTransaction(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); // Clear previously applied gift cart codes from the immutable quote $sql = "DELETE FROM {$giftCardTable} WHERE quote_id = :destination_quote_id"; $connection->query($sql, ['destination_quote_id' => $destinationQuoteId]); // Copy all gift cart codes applied to the parent quote to the immutable quote $sql = "INSERT INTO {$giftCardTable} (quote_id, code_id, account_id, base_gift_amount, code) SELECT :destination_quote_id, code_id, account_id, base_gift_amount, code FROM {$giftCardTable} WHERE quote_id = :source_quote_id"; $connection->query($sql, ['destination_quote_id' => $destinationQuoteId, 'source_quote_id' => $sourceQuoteId]); $connection->commit(); } catch (\Zend_Db_Statement_Exception $e) { $connection->rollBack(); $this->bugsnag->notifyException($e); } }
[ "public", "function", "cloneAmastyGiftCards", "(", "$", "sourceQuoteId", ",", "$", "destinationQuoteId", ")", "{", "if", "(", "!", "$", "this", "->", "isAmastyGiftCardAvailable", "(", ")", ")", "{", "return", ";", "}", "$", "connection", "=", "$", "this", ...
Copy Amasty Gift Cart data from source to destination quote @param int|string $sourceQuoteId @param int|string $destinationQuoteId
[ "Copy", "Amasty", "Gift", "Cart", "data", "from", "source", "to", "destination", "quote" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L253-L278
44,932
BoltApp/bolt-magento2
Helper/Discount.php
Discount.deleteRedundantAmastyGiftCards
public function deleteRedundantAmastyGiftCards($quote) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); $quoteTable = $this->resource->getTableName('quote'); $sql = "DELETE FROM {$giftCardTable} WHERE quote_id IN (SELECT entity_id FROM {$quoteTable} WHERE bolt_parent_quote_id = :bolt_parent_quote_id AND entity_id != :entity_id)"; $bind = [ 'bolt_parent_quote_id' => $quote->getBoltParentQuoteId(), 'entity_id' => $quote->getBoltParentQuoteId() ]; $connection->query($sql, $bind); } catch (\Zend_Db_Statement_Exception $e) { $this->bugsnag->notifyException($e); } }
php
public function deleteRedundantAmastyGiftCards($quote) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); $quoteTable = $this->resource->getTableName('quote'); $sql = "DELETE FROM {$giftCardTable} WHERE quote_id IN (SELECT entity_id FROM {$quoteTable} WHERE bolt_parent_quote_id = :bolt_parent_quote_id AND entity_id != :entity_id)"; $bind = [ 'bolt_parent_quote_id' => $quote->getBoltParentQuoteId(), 'entity_id' => $quote->getBoltParentQuoteId() ]; $connection->query($sql, $bind); } catch (\Zend_Db_Statement_Exception $e) { $this->bugsnag->notifyException($e); } }
[ "public", "function", "deleteRedundantAmastyGiftCards", "(", "$", "quote", ")", "{", "if", "(", "!", "$", "this", "->", "isAmastyGiftCardAvailable", "(", ")", ")", "{", "return", ";", "}", "$", "connection", "=", "$", "this", "->", "resource", "->", "getCo...
Try to clear Amasty Gift Cart data for the unused immutable quotes @param Quote $quote parent quote
[ "Try", "to", "clear", "Amasty", "Gift", "Cart", "data", "for", "the", "unused", "immutable", "quotes" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L285-L307
44,933
BoltApp/bolt-magento2
Helper/Discount.php
Discount.removeAmastyGiftCard
public function removeAmastyGiftCard($codeId, $quote) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); $sql = "DELETE FROM {$giftCardTable} WHERE code_id = :code_id AND quote_id = :quote_id"; $connection->query($sql, ['code_id' => $codeId, 'quote_id' => $quote->getId()]); $this->updateTotals($quote); } catch (\Zend_Db_Statement_Exception $e) { $this->bugsnag->notifyException($e); } }
php
public function removeAmastyGiftCard($codeId, $quote) { if (! $this->isAmastyGiftCardAvailable()) { return; } $connection = $this->resource->getConnection(); try { $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote'); $sql = "DELETE FROM {$giftCardTable} WHERE code_id = :code_id AND quote_id = :quote_id"; $connection->query($sql, ['code_id' => $codeId, 'quote_id' => $quote->getId()]); $this->updateTotals($quote); } catch (\Zend_Db_Statement_Exception $e) { $this->bugsnag->notifyException($e); } }
[ "public", "function", "removeAmastyGiftCard", "(", "$", "codeId", ",", "$", "quote", ")", "{", "if", "(", "!", "$", "this", "->", "isAmastyGiftCardAvailable", "(", ")", ")", "{", "return", ";", "}", "$", "connection", "=", "$", "this", "->", "resource", ...
Remove Amasty Gift Card and update quote totals @param int $codeId @param Quote $quote
[ "Remove", "Amasty", "Gift", "Card", "and", "update", "quote", "totals" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L315-L331
44,934
BoltApp/bolt-magento2
Helper/Discount.php
Discount.getAmastyGiftCardCodesFromTotals
public function getAmastyGiftCardCodesFromTotals($totals) { $giftCardCodes = explode(',', $totals[self::AMASTY_GIFTCARD]->getTitle()); return array_map('trim', $giftCardCodes); }
php
public function getAmastyGiftCardCodesFromTotals($totals) { $giftCardCodes = explode(',', $totals[self::AMASTY_GIFTCARD]->getTitle()); return array_map('trim', $giftCardCodes); }
[ "public", "function", "getAmastyGiftCardCodesFromTotals", "(", "$", "totals", ")", "{", "$", "giftCardCodes", "=", "explode", "(", "','", ",", "$", "totals", "[", "self", "::", "AMASTY_GIFTCARD", "]", "->", "getTitle", "(", ")", ")", ";", "return", "array_ma...
Get Amasty Gift Card codes, stored comma separated in total title field, return as array. @param array $totals totals array collected from quote @return array
[ "Get", "Amasty", "Gift", "Card", "codes", "stored", "comma", "separated", "in", "total", "title", "field", "return", "as", "array", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L357-L361
44,935
BoltApp/bolt-magento2
Helper/Discount.php
Discount.getAmastyGiftCardCodesCurrentValue
public function getAmastyGiftCardCodesCurrentValue($giftCardCodes) { $data = $this->amastyAccountCollection ->getInstance() ->joinCode() ->addFieldToFilter('gift_code', ['in'=>$giftCardCodes]) ->getData(); return array_sum(array_column($data, 'current_value')); }
php
public function getAmastyGiftCardCodesCurrentValue($giftCardCodes) { $data = $this->amastyAccountCollection ->getInstance() ->joinCode() ->addFieldToFilter('gift_code', ['in'=>$giftCardCodes]) ->getData(); return array_sum(array_column($data, 'current_value')); }
[ "public", "function", "getAmastyGiftCardCodesCurrentValue", "(", "$", "giftCardCodes", ")", "{", "$", "data", "=", "$", "this", "->", "amastyAccountCollection", "->", "getInstance", "(", ")", "->", "joinCode", "(", ")", "->", "addFieldToFilter", "(", "'gift_code'"...
Get accumulated unused balance of all Amasty Gift Cards corresponding to passed gift card coupons array @param array $giftCardCodes @return float|int|mixed
[ "Get", "accumulated", "unused", "balance", "of", "all", "Amasty", "Gift", "Cards", "corresponding", "to", "passed", "gift", "card", "coupons", "array" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L369-L378
44,936
BoltApp/bolt-magento2
Helper/Discount.php
Discount.getUnirgyGiftCertBalanceByCode
public function getUnirgyGiftCertBalanceByCode($giftcertCode) { /** @var \Unirgy\Giftcert\Model\Cert $giftCert */ $unirgyInstance = $this->unirgyCertRepository->getInstance(); $result = 0; if ($unirgyInstance) { $giftCert = $unirgyInstance->get($giftcertCode); if ($giftCert && $giftCert->getStatus() === 'A' && $giftCert->getBalance() > 0) { $result = $giftCert->getBalance(); } } return (float) $result; }
php
public function getUnirgyGiftCertBalanceByCode($giftcertCode) { /** @var \Unirgy\Giftcert\Model\Cert $giftCert */ $unirgyInstance = $this->unirgyCertRepository->getInstance(); $result = 0; if ($unirgyInstance) { $giftCert = $unirgyInstance->get($giftcertCode); if ($giftCert && $giftCert->getStatus() === 'A' && $giftCert->getBalance() > 0) { $result = $giftCert->getBalance(); } } return (float) $result; }
[ "public", "function", "getUnirgyGiftCertBalanceByCode", "(", "$", "giftcertCode", ")", "{", "/** @var \\Unirgy\\Giftcert\\Model\\Cert $giftCert */", "$", "unirgyInstance", "=", "$", "this", "->", "unirgyCertRepository", "->", "getInstance", "(", ")", ";", "$", "result", ...
Get Unirgy_Giftcert balance. @param $giftcertCode @return float @throws \Magento\Framework\Exception\NoSuchEntityException
[ "Get", "Unirgy_Giftcert", "balance", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Discount.php#L388-L402
44,937
BoltApp/bolt-magento2
Block/Js.php
Js.getTrackJsUrl
public function getTrackJsUrl() { $storeId = $this->getMagentoStoreId(); //Get cdn url $cdnUrl = $this->configHelper->getCdnUrl($storeId); return $cdnUrl.'/track.js'; }
php
public function getTrackJsUrl() { $storeId = $this->getMagentoStoreId(); //Get cdn url $cdnUrl = $this->configHelper->getCdnUrl($storeId); return $cdnUrl.'/track.js'; }
[ "public", "function", "getTrackJsUrl", "(", ")", "{", "$", "storeId", "=", "$", "this", "->", "getMagentoStoreId", "(", ")", ";", "//Get cdn url", "$", "cdnUrl", "=", "$", "this", "->", "configHelper", "->", "getCdnUrl", "(", "$", "storeId", ")", ";", "r...
Get track js url @return string
[ "Get", "track", "js", "url" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L82-L89
44,938
BoltApp/bolt-magento2
Block/Js.php
Js.getReplaceSelectors
public function getReplaceSelectors() { $storeId = $this->getMagentoStoreId(); $subject = trim($this->configHelper->getReplaceSelectors($storeId)); return array_filter(explode(',', preg_replace('/\s+/', ' ', $subject))); }
php
public function getReplaceSelectors() { $storeId = $this->getMagentoStoreId(); $subject = trim($this->configHelper->getReplaceSelectors($storeId)); return array_filter(explode(',', preg_replace('/\s+/', ' ', $subject))); }
[ "public", "function", "getReplaceSelectors", "(", ")", "{", "$", "storeId", "=", "$", "this", "->", "getMagentoStoreId", "(", ")", ";", "$", "subject", "=", "trim", "(", "$", "this", "->", "configHelper", "->", "getReplaceSelectors", "(", "$", "storeId", "...
Get Replace Button Selectors. @return string
[ "Get", "Replace", "Button", "Selectors", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L122-L128
44,939
BoltApp/bolt-magento2
Block/Js.php
Js.getInitiateCheckout
public function getInitiateCheckout() { $flag = $this->checkoutSession->getBoltInitiateCheckout(); $this->checkoutSession->unsBoltInitiateCheckout(); return (bool)$flag; }
php
public function getInitiateCheckout() { $flag = $this->checkoutSession->getBoltInitiateCheckout(); $this->checkoutSession->unsBoltInitiateCheckout(); return (bool)$flag; }
[ "public", "function", "getInitiateCheckout", "(", ")", "{", "$", "flag", "=", "$", "this", "->", "checkoutSession", "->", "getBoltInitiateCheckout", "(", ")", ";", "$", "this", "->", "checkoutSession", "->", "unsBoltInitiateCheckout", "(", ")", ";", "return", ...
Gets the auto-open Bolt checkout session flag, and then unsets it so that it is only used once. @return bool
[ "Gets", "the", "auto", "-", "open", "Bolt", "checkout", "session", "flag", "and", "then", "unsets", "it", "so", "that", "it", "is", "only", "used", "once", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L194-L199
44,940
BoltApp/bolt-magento2
Block/Js.php
Js.getToggleCheckout
private function getToggleCheckout() { $storeId = $this->getMagentoStoreId(); $toggleCheckout = $this->configHelper->getToggleCheckout($storeId); return $toggleCheckout && $toggleCheckout->active ? $toggleCheckout : null; }
php
private function getToggleCheckout() { $storeId = $this->getMagentoStoreId(); $toggleCheckout = $this->configHelper->getToggleCheckout($storeId); return $toggleCheckout && $toggleCheckout->active ? $toggleCheckout : null; }
[ "private", "function", "getToggleCheckout", "(", ")", "{", "$", "storeId", "=", "$", "this", "->", "getMagentoStoreId", "(", ")", ";", "$", "toggleCheckout", "=", "$", "this", "->", "configHelper", "->", "getToggleCheckout", "(", "$", "storeId", ")", ";", ...
Get Toggle Checkout configuration @return mixed
[ "Get", "Toggle", "Checkout", "configuration" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L348-L354
44,941
BoltApp/bolt-magento2
Block/Js.php
Js.getMagentoStoreId
public function getMagentoStoreId() { if ($this->checkoutSession instanceof BackendSessionQuote) { $quote = $this->checkoutSession; } else { $quote = $this->checkoutSession->getQuote(); } return (int) (($quote && $quote->getStoreId()) ? $quote->getStoreId() : 0); }
php
public function getMagentoStoreId() { if ($this->checkoutSession instanceof BackendSessionQuote) { $quote = $this->checkoutSession; } else { $quote = $this->checkoutSession->getQuote(); } return (int) (($quote && $quote->getStoreId()) ? $quote->getStoreId() : 0); }
[ "public", "function", "getMagentoStoreId", "(", ")", "{", "if", "(", "$", "this", "->", "checkoutSession", "instanceof", "BackendSessionQuote", ")", "{", "$", "quote", "=", "$", "this", "->", "checkoutSession", ";", "}", "else", "{", "$", "quote", "=", "$"...
If we have multi-website, we need current quote store_id @return int
[ "If", "we", "have", "multi", "-", "website", "we", "need", "current", "quote", "store_id" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L443-L453
44,942
BoltApp/bolt-magento2
Helper/Geolocation.php
Geolocation.getLocationJson
private function getLocationJson($ip, $apiKey) { $endpoint = sprintf($this->endpointFormat, $ip, $apiKey); $client = $this->httpClientFactory->create(); $client->setUri($endpoint); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); // Dependant on third party API, wrapping in try/catch block. // On error notify bugsnag and proceed (return null) try { return $client->request()->getBody(); } catch (\Exception $e) { $this->bugsnag->notifyException($e); return null; } }
php
private function getLocationJson($ip, $apiKey) { $endpoint = sprintf($this->endpointFormat, $ip, $apiKey); $client = $this->httpClientFactory->create(); $client->setUri($endpoint); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); // Dependant on third party API, wrapping in try/catch block. // On error notify bugsnag and proceed (return null) try { return $client->request()->getBody(); } catch (\Exception $e) { $this->bugsnag->notifyException($e); return null; } }
[ "private", "function", "getLocationJson", "(", "$", "ip", ",", "$", "apiKey", ")", "{", "$", "endpoint", "=", "sprintf", "(", "$", "this", "->", "endpointFormat", ",", "$", "ip", ",", "$", "apiKey", ")", ";", "$", "client", "=", "$", "this", "->", ...
Make a Geolocation API call @param string $ip The IP address @param $apiKey ipstack.com API key @return null|string JSON formated response @throws \Zend_Http_Client_Exception
[ "Make", "a", "Geolocation", "API", "call" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Geolocation.php#L101-L118
44,943
BoltApp/bolt-magento2
Helper/Log.php
Log.addInfoLog
public function addInfoLog($info) { if ($this->configHelper->isDebugModeOn()) { $this->boltLogger->info($info); } return $this; }
php
public function addInfoLog($info) { if ($this->configHelper->isDebugModeOn()) { $this->boltLogger->info($info); } return $this; }
[ "public", "function", "addInfoLog", "(", "$", "info", ")", "{", "if", "(", "$", "this", "->", "configHelper", "->", "isDebugModeOn", "(", ")", ")", "{", "$", "this", "->", "boltLogger", "->", "info", "(", "$", "info", ")", ";", "}", "return", "$", ...
Add info log @param mixed $info log message @return Log
[ "Add", "info", "log" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Log.php#L67-L73
44,944
BoltApp/bolt-magento2
Plugin/QuotePlugin.php
QuotePlugin.aroundAfterSave
public function aroundAfterSave(\Magento\Quote\Model\Quote $subject, callable $proceed) { if ($subject->getIsActive()) { return $proceed(); } return $subject; }
php
public function aroundAfterSave(\Magento\Quote\Model\Quote $subject, callable $proceed) { if ($subject->getIsActive()) { return $proceed(); } return $subject; }
[ "public", "function", "aroundAfterSave", "(", "\\", "Magento", "\\", "Quote", "\\", "Model", "\\", "Quote", "$", "subject", ",", "callable", "$", "proceed", ")", "{", "if", "(", "$", "subject", "->", "getIsActive", "(", ")", ")", "{", "return", "$", "p...
Override Quote afterSave method. Skip execution for inactive quotes, thus preventing dispatching the after save events. @param \Magento\Quote\Model\Quote $subject @param callable $proceed @return \Magento\Quote\Model\Quote
[ "Override", "Quote", "afterSave", "method", ".", "Skip", "execution", "for", "inactive", "quotes", "thus", "preventing", "dispatching", "the", "after", "save", "events", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Plugin/QuotePlugin.php#L34-L40
44,945
kitpages/KitpagesDataGridBundle
Grid/GridConfig.php
GridConfig.getFieldByName
public function getFieldByName($name) { foreach ($this->fieldList as $field) { if ($field->getFieldName() === $name) { return $field; } } return null; }
php
public function getFieldByName($name) { foreach ($this->fieldList as $field) { if ($field->getFieldName() === $name) { return $field; } } return null; }
[ "public", "function", "getFieldByName", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "fieldList", "as", "$", "field", ")", "{", "if", "(", "$", "field", "->", "getFieldName", "(", ")", "===", "$", "name", ")", "{", "return", "$", ...
returns the field corresponding to the name @param string $name @return Field|null $field
[ "returns", "the", "field", "corresponding", "to", "the", "name" ]
426b6dbdbd16e923e01bce9a0dc67a7da46a8987
https://github.com/kitpages/KitpagesDataGridBundle/blob/426b6dbdbd16e923e01bce9a0dc67a7da46a8987/Grid/GridConfig.php#L137-L146
44,946
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/oxConfigConstructor.php
oxConfigConstructor._formSaveConfigParameters
private function _formSaveConfigParameters($configKey, $configParameters) { $type = null; if (isset($configParameters['type'])) { $type = $configParameters['type']; } $value = null; if (isset($configParameters['value'])) { $value = $configParameters['value']; } $module = null; if (isset($configParameters['module'])) { $module = $configParameters['module']; } if (($type == "arr" || $type == 'aarr') && !is_array($value)) { $value = unserialize(htmlspecialchars_decode($value)); } return !empty($type) ? array($type, $configKey, $value, null, $module) : false; }
php
private function _formSaveConfigParameters($configKey, $configParameters) { $type = null; if (isset($configParameters['type'])) { $type = $configParameters['type']; } $value = null; if (isset($configParameters['value'])) { $value = $configParameters['value']; } $module = null; if (isset($configParameters['module'])) { $module = $configParameters['module']; } if (($type == "arr" || $type == 'aarr') && !is_array($value)) { $value = unserialize(htmlspecialchars_decode($value)); } return !empty($type) ? array($type, $configKey, $value, null, $module) : false; }
[ "private", "function", "_formSaveConfigParameters", "(", "$", "configKey", ",", "$", "configParameters", ")", "{", "$", "type", "=", "null", ";", "if", "(", "isset", "(", "$", "configParameters", "[", "'type'", "]", ")", ")", "{", "$", "type", "=", "$", ...
Forms parameters for saveShopConfVar function from given parameters @param string $configKey @param array $configParameters @return array|bool
[ "Forms", "parameters", "for", "saveShopConfVar", "function", "from", "given", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/oxConfigConstructor.php#L68-L89
44,947
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.import
public function import($sqlFile, $charsetMode = null) { if (!file_exists($sqlFile)) { throw new Exception("File '$sqlFile' was not found."); } $credentialsFile = $this->databaseDefaultsFileGenerator->generate(); $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode(); $command = 'mysql --defaults-file=' . $credentialsFile; $command .= ' --default-character-set=' . $charsetMode; $command .= ' ' .escapeshellarg($this->getDbName()); $command .= ' < ' . escapeshellarg($sqlFile); $this->executeCommand($command); unlink($credentialsFile); }
php
public function import($sqlFile, $charsetMode = null) { if (!file_exists($sqlFile)) { throw new Exception("File '$sqlFile' was not found."); } $credentialsFile = $this->databaseDefaultsFileGenerator->generate(); $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode(); $command = 'mysql --defaults-file=' . $credentialsFile; $command .= ' --default-character-set=' . $charsetMode; $command .= ' ' .escapeshellarg($this->getDbName()); $command .= ' < ' . escapeshellarg($sqlFile); $this->executeCommand($command); unlink($credentialsFile); }
[ "public", "function", "import", "(", "$", "sqlFile", ",", "$", "charsetMode", "=", "null", ")", "{", "if", "(", "!", "file_exists", "(", "$", "sqlFile", ")", ")", "{", "throw", "new", "Exception", "(", "\"File '$sqlFile' was not found.\"", ")", ";", "}", ...
Execute sql statements from sql file @param string $sqlFile SQL File name to import. @param string $charsetMode Charset of imported file. Will use shop charset mode if not set. @throws Exception
[ "Execute", "sql", "statements", "from", "sql", "file" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L68-L82
44,948
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.query
public function query($sql) { $this->useConfiguredDatabase(); $return = $this->getDbConnection()->query($sql); $this->checkForDatabaseError($sql, 'query'); return $return; }
php
public function query($sql) { $this->useConfiguredDatabase(); $return = $this->getDbConnection()->query($sql); $this->checkForDatabaseError($sql, 'query'); return $return; }
[ "public", "function", "query", "(", "$", "sql", ")", "{", "$", "this", "->", "useConfiguredDatabase", "(", ")", ";", "$", "return", "=", "$", "this", "->", "getDbConnection", "(", ")", "->", "query", "(", "$", "sql", ")", ";", "$", "this", "->", "c...
Executes query on database. @param string $sql Sql query to execute. @return PDOStatement|false
[ "Executes", "query", "on", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L109-L115
44,949
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.exec
public function exec($sql) { $this->useConfiguredDatabase(); $success = $this->getDbConnection()->exec($sql); $this->checkForDatabaseError($sql, 'exec'); return $success; }
php
public function exec($sql) { $this->useConfiguredDatabase(); $success = $this->getDbConnection()->exec($sql); $this->checkForDatabaseError($sql, 'exec'); return $success; }
[ "public", "function", "exec", "(", "$", "sql", ")", "{", "$", "this", "->", "useConfiguredDatabase", "(", ")", ";", "$", "success", "=", "$", "this", "->", "getDbConnection", "(", ")", "->", "exec", "(", "$", "sql", ")", ";", "$", "this", "->", "ch...
This function is intended for write access to the database like INSERT, UPDATE @param string $sql Sql query to execute. @return int
[ "This", "function", "is", "intended", "for", "write", "access", "to", "the", "database", "like", "INSERT", "UPDATE" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L124-L130
44,950
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.checkForDatabaseError
protected function checkForDatabaseError($query, $callingFunctionName) { $dbCon = $this->getDbConnection(); if (is_a($dbCon, 'PDO') && ('00000' !== $dbCon->errorCode())) { $errorInfo = $dbCon->errorInfo(); throw new Exception('PDO error code: ' . $dbCon->errorCode() . ' in function ' . $callingFunctionName . ' -- ' . $errorInfo[2] . ' -- ' . $query); } }
php
protected function checkForDatabaseError($query, $callingFunctionName) { $dbCon = $this->getDbConnection(); if (is_a($dbCon, 'PDO') && ('00000' !== $dbCon->errorCode())) { $errorInfo = $dbCon->errorInfo(); throw new Exception('PDO error code: ' . $dbCon->errorCode() . ' in function ' . $callingFunctionName . ' -- ' . $errorInfo[2] . ' -- ' . $query); } }
[ "protected", "function", "checkForDatabaseError", "(", "$", "query", ",", "$", "callingFunctionName", ")", "{", "$", "dbCon", "=", "$", "this", "->", "getDbConnection", "(", ")", ";", "if", "(", "is_a", "(", "$", "dbCon", ",", "'PDO'", ")", "&&", "(", ...
Check for error code in database connection. @param string $query @param string $callingFunctionName @throws Exception
[ "Check", "for", "error", "code", "in", "database", "connection", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L266-L273
44,951
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setupDatabase
public function setupDatabase() { $dbHandler = $this->getDbHandler(); $dbHandler->getDbConnection()->exec('drop database `' . $dbHandler->getDbName() . '`'); $dbHandler->getDbConnection()->exec('create database `' . $dbHandler->getDbName() . '` collate ' . $dbHandler->getCharsetMode() . '_general_ci'); $baseEditionPathProvider = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector(EditionSelector::COMMUNITY))); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/database_schema.sql"); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/initial_data.sql"); $output = new ConsoleOutput(); $output->setVerbosity(ConsoleOutputInterface::VERBOSITY_QUIET); $utilities = new Utilities(); $utilities->executeExternalDatabaseMigrationCommand($output); $this->callShellDbViewsRegenerate(); }
php
public function setupDatabase() { $dbHandler = $this->getDbHandler(); $dbHandler->getDbConnection()->exec('drop database `' . $dbHandler->getDbName() . '`'); $dbHandler->getDbConnection()->exec('create database `' . $dbHandler->getDbName() . '` collate ' . $dbHandler->getCharsetMode() . '_general_ci'); $baseEditionPathProvider = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector(EditionSelector::COMMUNITY))); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/database_schema.sql"); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/initial_data.sql"); $output = new ConsoleOutput(); $output->setVerbosity(ConsoleOutputInterface::VERBOSITY_QUIET); $utilities = new Utilities(); $utilities->executeExternalDatabaseMigrationCommand($output); $this->callShellDbViewsRegenerate(); }
[ "public", "function", "setupDatabase", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "dbHandler", "->", "getDbConnection", "(", ")", "->", "exec", "(", "'drop database `'", ".", "$", "dbHandler", "->", "getDbN...
Sets up database.
[ "Sets", "up", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L101-L120
44,952
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.insertDemoData
public function insertDemoData() { $testConfig = new TestConfig(); $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition()); $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql"); }
php
public function insertDemoData() { $testConfig = new TestConfig(); $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition()); $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql"); }
[ "public", "function", "insertDemoData", "(", ")", "{", "$", "testConfig", "=", "new", "TestConfig", "(", ")", ";", "$", "testDirectory", "=", "$", "testConfig", "->", "getEditionTestsPath", "(", "$", "testConfig", "->", "getShopEdition", "(", ")", ")", ";", ...
Inserts test demo data to shop.
[ "Inserts", "test", "demo", "data", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L151-L156
44,953
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setConfigurationParameters
public function setConfigurationParameters() { $dbHandler = $this->getDbHandler(); $sShopId = $this->getShopId(); $dbHandler->query("delete from oxconfig where oxvarname in ('iSetUtfMode','blSendTechnicalInformationToOxid');"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('config1', '{$sShopId}', 'iSetUtfMode', 'str', ENCODE('0', '{$this->getConfigKey()}') )," . "('config2', '{$sShopId}', 'blSendTechnicalInformationToOxid', 'bool', ENCODE('1', '{$this->getConfigKey()}') )" ); }
php
public function setConfigurationParameters() { $dbHandler = $this->getDbHandler(); $sShopId = $this->getShopId(); $dbHandler->query("delete from oxconfig where oxvarname in ('iSetUtfMode','blSendTechnicalInformationToOxid');"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('config1', '{$sShopId}', 'iSetUtfMode', 'str', ENCODE('0', '{$this->getConfigKey()}') )," . "('config2', '{$sShopId}', 'blSendTechnicalInformationToOxid', 'bool', ENCODE('1', '{$this->getConfigKey()}') )" ); }
[ "public", "function", "setConfigurationParameters", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "sShopId", "=", "$", "this", "->", "getShopId", "(", ")", ";", "$", "dbHandler", "->", "query", "(", "\"delet...
Inserts missing configuration parameters
[ "Inserts", "missing", "configuration", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L161-L172
44,954
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setSerialNumber
public function setSerialNumber($serialNumber = null) { if (strtolower($this->getShopConfig()->getVar('edition')) !== strtolower(EditionSelector::COMMUNITY) && class_exists(Serial::class)) { $dbHandler = $this->getDbHandler(); $shopId = $this->getShopId(); $serial = new Serial(); $serial->setEd($this->getServiceConfig()->getShopEdition() == 'EE' ? 2 : 1); $serial->isValidSerial($serialNumber); $maxDays = $serial->getMaxDays($serialNumber); $maxArticles = $serial->getMaxArticles($serialNumber); $maxShops = $serial->getMaxShops($serialNumber); $dbHandler->query("update oxshops set oxserial = '{$serialNumber}'"); $dbHandler->query("delete from oxconfig where oxvarname in ('aSerials','sTagList','IMD','IMA','IMS')"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('serial1', '{$shopId}', 'aSerials', 'arr', ENCODE('" . serialize(array($serialNumber)) . "','{$this->getConfigKey()}') )," . "('serial2', '{$shopId}', 'sTagList', 'str', ENCODE('" . time() . "','{$this->getConfigKey()}') )," . "('serial3', '{$shopId}', 'IMD', 'str', ENCODE('" . $maxDays . "','{$this->getConfigKey()}') )," . "('serial4', '{$shopId}', 'IMA', 'str', ENCODE('" . $maxArticles . "','{$this->getConfigKey()}') )," . "('serial5', '{$shopId}', 'IMS', 'str', ENCODE('" . $maxShops . "','{$this->getConfigKey()}') )" ); } }
php
public function setSerialNumber($serialNumber = null) { if (strtolower($this->getShopConfig()->getVar('edition')) !== strtolower(EditionSelector::COMMUNITY) && class_exists(Serial::class)) { $dbHandler = $this->getDbHandler(); $shopId = $this->getShopId(); $serial = new Serial(); $serial->setEd($this->getServiceConfig()->getShopEdition() == 'EE' ? 2 : 1); $serial->isValidSerial($serialNumber); $maxDays = $serial->getMaxDays($serialNumber); $maxArticles = $serial->getMaxArticles($serialNumber); $maxShops = $serial->getMaxShops($serialNumber); $dbHandler->query("update oxshops set oxserial = '{$serialNumber}'"); $dbHandler->query("delete from oxconfig where oxvarname in ('aSerials','sTagList','IMD','IMA','IMS')"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('serial1', '{$shopId}', 'aSerials', 'arr', ENCODE('" . serialize(array($serialNumber)) . "','{$this->getConfigKey()}') )," . "('serial2', '{$shopId}', 'sTagList', 'str', ENCODE('" . time() . "','{$this->getConfigKey()}') )," . "('serial3', '{$shopId}', 'IMD', 'str', ENCODE('" . $maxDays . "','{$this->getConfigKey()}') )," . "('serial4', '{$shopId}', 'IMA', 'str', ENCODE('" . $maxArticles . "','{$this->getConfigKey()}') )," . "('serial5', '{$shopId}', 'IMS', 'str', ENCODE('" . $maxShops . "','{$this->getConfigKey()}') )" ); } }
[ "public", "function", "setSerialNumber", "(", "$", "serialNumber", "=", "null", ")", "{", "if", "(", "strtolower", "(", "$", "this", "->", "getShopConfig", "(", ")", "->", "getVar", "(", "'edition'", ")", ")", "!==", "strtolower", "(", "EditionSelector", "...
Adds serial number to shop. @param string $serialNumber
[ "Adds", "serial", "number", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L179-L208
44,955
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.convertToUtf
public function convertToUtf() { $dbHandler = $this->getDbHandler(); $rs = $dbHandler->query( "SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarvalue FROM oxconfig WHERE oxvartype IN ('str', 'arr', 'aarr')" ); while ( (false !== $rs) && ($aRow = $rs->fetch())) { if ($aRow['oxvartype'] == 'arr' || $aRow['oxvartype'] == 'aarr') { $aRow['oxvarvalue'] = unserialize($aRow['oxvarvalue']); } if (!empty($aRow['oxvarvalue']) && !is_int($aRow['oxvarvalue'])) { $this->updateConfigValue($aRow['oxid'], $this->stringToUtf($aRow['oxvarvalue'])); } } // Change currencies value to same as after 4.6 setup because previous encoding break it. $shopId = 1; $query = "REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('3c4f033dfb8fd4fe692715dda19ecd28', $shopId, '', 'aCurrencies', 'arr', 0x4dbace2972e14bf2cbd3a9a45157004422e928891572b281961cdebd1e0bbafe8b2444b15f2c7b1cfcbe6e5982d87434c3b19629dacd7728776b54d7caeace68b4b05c6ddeff2df9ff89b467b14df4dcc966c504477a9eaeadd5bdfa5195a97f46768ba236d658379ae6d371bfd53acd9902de08a1fd1eeab18779b191f3e31c258a87b58b9778f5636de2fab154fc0a51a2ecc3a4867db070f85852217e9d5e9aa60507);"; $dbHandler->query($query); }
php
public function convertToUtf() { $dbHandler = $this->getDbHandler(); $rs = $dbHandler->query( "SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarvalue FROM oxconfig WHERE oxvartype IN ('str', 'arr', 'aarr')" ); while ( (false !== $rs) && ($aRow = $rs->fetch())) { if ($aRow['oxvartype'] == 'arr' || $aRow['oxvartype'] == 'aarr') { $aRow['oxvarvalue'] = unserialize($aRow['oxvarvalue']); } if (!empty($aRow['oxvarvalue']) && !is_int($aRow['oxvarvalue'])) { $this->updateConfigValue($aRow['oxid'], $this->stringToUtf($aRow['oxvarvalue'])); } } // Change currencies value to same as after 4.6 setup because previous encoding break it. $shopId = 1; $query = "REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('3c4f033dfb8fd4fe692715dda19ecd28', $shopId, '', 'aCurrencies', 'arr', 0x4dbace2972e14bf2cbd3a9a45157004422e928891572b281961cdebd1e0bbafe8b2444b15f2c7b1cfcbe6e5982d87434c3b19629dacd7728776b54d7caeace68b4b05c6ddeff2df9ff89b467b14df4dcc966c504477a9eaeadd5bdfa5195a97f46768ba236d658379ae6d371bfd53acd9902de08a1fd1eeab18779b191f3e31c258a87b58b9778f5636de2fab154fc0a51a2ecc3a4867db070f85852217e9d5e9aa60507);"; $dbHandler->query($query); }
[ "public", "function", "convertToUtf", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "rs", "=", "$", "dbHandler", "->", "query", "(", "\"SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarv...
Converts shop to utf8.
[ "Converts", "shop", "to", "utf8", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L213-L239
44,956
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.getDefaultSerial
protected function getDefaultSerial() { if ($this->getServiceConfig()->getShopEdition() != 'CE') { $core = new Core(); /** @var \OxidEsales\EshopProfessional\Setup\Setup|\OxidEsales\EshopEnterprise\Setup\Setup $setup */ $setup = $core->getInstance('Setup'); return $setup->getDefaultSerial(); } return null; }
php
protected function getDefaultSerial() { if ($this->getServiceConfig()->getShopEdition() != 'CE') { $core = new Core(); /** @var \OxidEsales\EshopProfessional\Setup\Setup|\OxidEsales\EshopEnterprise\Setup\Setup $setup */ $setup = $core->getInstance('Setup'); return $setup->getDefaultSerial(); } return null; }
[ "protected", "function", "getDefaultSerial", "(", ")", "{", "if", "(", "$", "this", "->", "getServiceConfig", "(", ")", "->", "getShopEdition", "(", ")", "!=", "'CE'", ")", "{", "$", "core", "=", "new", "Core", "(", ")", ";", "/** @var \\OxidEsales\\EshopP...
Returns default demo serial number for testing. @return string
[ "Returns", "default", "demo", "serial", "number", "for", "testing", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L285-L295
44,957
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.insertConfigValue
private function insertConfigValue($type, $name, $value) { $dbHandler = $this->getDbHandler(); $shopId = 1; $oxid = md5("${name}_1"); $dbHandler->query("DELETE from oxconfig WHERE oxvarname = '$name';"); $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); if ($this->getServiceConfig()->getShopEdition() == EditionSelector::ENTERPRISE) { $oxid = md5("${name}_subshop"); $shopId = 2; $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); } }
php
private function insertConfigValue($type, $name, $value) { $dbHandler = $this->getDbHandler(); $shopId = 1; $oxid = md5("${name}_1"); $dbHandler->query("DELETE from oxconfig WHERE oxvarname = '$name';"); $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); if ($this->getServiceConfig()->getShopEdition() == EditionSelector::ENTERPRISE) { $oxid = md5("${name}_subshop"); $shopId = 2; $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); } }
[ "private", "function", "insertConfigValue", "(", "$", "type", ",", "$", "name", ",", "$", "value", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "shopId", "=", "1", ";", "$", "oxid", "=", "md5", "(", "\"${n...
Insert new configuration value to database. @param string $type @param string $name @param string $value
[ "Insert", "new", "configuration", "value", "to", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L336-L351
44,958
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.updateConfigValue
private function updateConfigValue($id, $value) { $dbHandler = $this->getDbHandler(); $value = is_array($value) ? serialize($value) : $value; $value = $dbHandler->escape($value); $dbHandler->query("update oxconfig set oxvarvalue = ENCODE( '{$value}','{$this->getConfigKey()}') where oxvarname = '{$id}';"); }
php
private function updateConfigValue($id, $value) { $dbHandler = $this->getDbHandler(); $value = is_array($value) ? serialize($value) : $value; $value = $dbHandler->escape($value); $dbHandler->query("update oxconfig set oxvarvalue = ENCODE( '{$value}','{$this->getConfigKey()}') where oxvarname = '{$id}';"); }
[ "private", "function", "updateConfigValue", "(", "$", "id", ",", "$", "value", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "value", "=", "is_array", "(", "$", "value", ")", "?", "serialize", "(", "$", "valu...
Updates configuration value. @param string $id @param string $value
[ "Updates", "configuration", "value", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L359-L366
44,959
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.stringToUtf
private function stringToUtf($input) { if (is_array($input)) { $temp = array(); foreach ($input as $key => $value) { $temp[$this->stringToUtf($key)] = $this->stringToUtf($value); } $input = $temp; } elseif (is_string($input)) { $input = iconv('iso-8859-15', 'utf-8', $input); } return $input; }
php
private function stringToUtf($input) { if (is_array($input)) { $temp = array(); foreach ($input as $key => $value) { $temp[$this->stringToUtf($key)] = $this->stringToUtf($value); } $input = $temp; } elseif (is_string($input)) { $input = iconv('iso-8859-15', 'utf-8', $input); } return $input; }
[ "private", "function", "stringToUtf", "(", "$", "input", ")", "{", "if", "(", "is_array", "(", "$", "input", ")", ")", "{", "$", "temp", "=", "array", "(", ")", ";", "foreach", "(", "$", "input", "as", "$", "key", "=>", "$", "value", ")", "{", ...
Converts input string to utf8. @param string $input String for conversion. @return array|string
[ "Converts", "input", "string", "to", "utf8", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L375-L388
44,960
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor.load
public function load($objectId) { if (!empty($objectId)) { $blResult = is_array($objectId)? $this->_loadByArray($objectId) : $this->_loadById($objectId); if ($blResult === false) { $sClass = get_class($this->getObject()); throw new Exception("Failed to load $sClass with id $objectId"); } } }
php
public function load($objectId) { if (!empty($objectId)) { $blResult = is_array($objectId)? $this->_loadByArray($objectId) : $this->_loadById($objectId); if ($blResult === false) { $sClass = get_class($this->getObject()); throw new Exception("Failed to load $sClass with id $objectId"); } } }
[ "public", "function", "load", "(", "$", "objectId", ")", "{", "if", "(", "!", "empty", "(", "$", "objectId", ")", ")", "{", "$", "blResult", "=", "is_array", "(", "$", "objectId", ")", "?", "$", "this", "->", "_loadByArray", "(", "$", "objectId", "...
Loads object by given id @param mixed $objectId @throws Exception
[ "Loads", "object", "by", "given", "id" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php#L45-L54
44,961
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor.callFunction
public function callFunction($functionName, $parameters) { $parameters = is_array($parameters) ? $parameters : array(); $response = call_user_func_array(array($this->getObject(), $functionName), $parameters); return $response; }
php
public function callFunction($functionName, $parameters) { $parameters = is_array($parameters) ? $parameters : array(); $response = call_user_func_array(array($this->getObject(), $functionName), $parameters); return $response; }
[ "public", "function", "callFunction", "(", "$", "functionName", ",", "$", "parameters", ")", "{", "$", "parameters", "=", "is_array", "(", "$", "parameters", ")", "?", "$", "parameters", ":", "array", "(", ")", ";", "$", "response", "=", "call_user_func_ar...
Calls object function with given parameters. @param string $functionName @param array $parameters @return mixed
[ "Calls", "object", "function", "with", "given", "parameters", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php#L124-L130
44,962
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor._getLastInsertedId
protected function _getLastInsertedId() { $objectId = null; $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $tableName = $this->getObject()->getCoreTableName(); $query = 'SELECT OXID FROM '. $tableName .' ORDER BY OXTIMESTAMP DESC LIMIT 1'; $result = $oDb->select($query); if ($result != false && $result->count() > 0) { $fields = $result->fields; $objectId = $fields['OXID']; } return $objectId; }
php
protected function _getLastInsertedId() { $objectId = null; $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $tableName = $this->getObject()->getCoreTableName(); $query = 'SELECT OXID FROM '. $tableName .' ORDER BY OXTIMESTAMP DESC LIMIT 1'; $result = $oDb->select($query); if ($result != false && $result->count() > 0) { $fields = $result->fields; $objectId = $fields['OXID']; } return $objectId; }
[ "protected", "function", "_getLastInsertedId", "(", ")", "{", "$", "objectId", "=", "null", ";", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core"...
Get id of latest created row. @return string|null
[ "Get", "id", "of", "latest", "created", "row", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php#L164-L179
44,963
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callService
public function callService($serviceName, $shopId = null) { $testConfig = $this->getTestConfig(); if (!is_null($shopId) && $testConfig->getShopEdition() == 'EE') { $this->setParameter('shp', $shopId); } elseif ($testConfig->isSubShop()) { $this->setParameter('shp', $testConfig->getShopId()); } if ($testConfig->getRemoteDirectory()) { $response = $this->callRemoteService($serviceName); } else { $this->callLocalService(ChangeExceptionLogRights::class); $response = $this->callLocalService($serviceName); } $this->parameters = array(); return $response; }
php
public function callService($serviceName, $shopId = null) { $testConfig = $this->getTestConfig(); if (!is_null($shopId) && $testConfig->getShopEdition() == 'EE') { $this->setParameter('shp', $shopId); } elseif ($testConfig->isSubShop()) { $this->setParameter('shp', $testConfig->getShopId()); } if ($testConfig->getRemoteDirectory()) { $response = $this->callRemoteService($serviceName); } else { $this->callLocalService(ChangeExceptionLogRights::class); $response = $this->callLocalService($serviceName); } $this->parameters = array(); return $response; }
[ "public", "function", "callService", "(", "$", "serviceName", ",", "$", "shopId", "=", "null", ")", "{", "$", "testConfig", "=", "$", "this", "->", "getTestConfig", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "shopId", ")", "&&", "$", "testCo...
Call shop service to execute code in shop. @param string $serviceName @param string $shopId @example call to update information to database. @throws \Exception @return string $sResult
[ "Call", "shop", "service", "to", "execute", "code", "in", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L74-L94
44,964
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callRemoteService
protected function callRemoteService($serviceName) { if (!self::$servicesCopied) { self::$servicesCopied = true; $this->copyServicesToShop(); } $oCurl = new Curl(); $this->setParameter('service', $serviceName); $oCurl->setUrl($this->getTestConfig()->getShopUrl() . '/Services/service.php'); $oCurl->setParameters($this->getParameters()); $sResponse = $oCurl->execute(); if ($oCurl->getStatusCode() >= 300) { $sResponse = $oCurl->execute(); } return $this->unserializeResponse($sResponse); }
php
protected function callRemoteService($serviceName) { if (!self::$servicesCopied) { self::$servicesCopied = true; $this->copyServicesToShop(); } $oCurl = new Curl(); $this->setParameter('service', $serviceName); $oCurl->setUrl($this->getTestConfig()->getShopUrl() . '/Services/service.php'); $oCurl->setParameters($this->getParameters()); $sResponse = $oCurl->execute(); if ($oCurl->getStatusCode() >= 300) { $sResponse = $oCurl->execute(); } return $this->unserializeResponse($sResponse); }
[ "protected", "function", "callRemoteService", "(", "$", "serviceName", ")", "{", "if", "(", "!", "self", "::", "$", "servicesCopied", ")", "{", "self", "::", "$", "servicesCopied", "=", "true", ";", "$", "this", "->", "copyServicesToShop", "(", ")", ";", ...
Calls service on remote server. @param string $serviceName @throws \Exception @return string
[ "Calls", "service", "on", "remote", "server", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L105-L126
44,965
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callLocalService
protected function callLocalService($serviceName) { if (!defined('TMP_PATH')) { define('TMP_PATH', $this->getTestConfig()->getTempDirectory()); } $config = new ServiceConfig($this->getTestConfig()->getShopPath(), $this->getTestConfig()->getTempDirectory()); $config->setShopEdition($this->getTestConfig()->getShopEdition()); $serviceCaller = new ServiceFactory($config); $request = new Request($this->getParameters()); $service = $serviceCaller->createService($serviceName); return $service->init($request); }
php
protected function callLocalService($serviceName) { if (!defined('TMP_PATH')) { define('TMP_PATH', $this->getTestConfig()->getTempDirectory()); } $config = new ServiceConfig($this->getTestConfig()->getShopPath(), $this->getTestConfig()->getTempDirectory()); $config->setShopEdition($this->getTestConfig()->getShopEdition()); $serviceCaller = new ServiceFactory($config); $request = new Request($this->getParameters()); $service = $serviceCaller->createService($serviceName); return $service->init($request); }
[ "protected", "function", "callLocalService", "(", "$", "serviceName", ")", "{", "if", "(", "!", "defined", "(", "'TMP_PATH'", ")", ")", "{", "define", "(", "'TMP_PATH'", ",", "$", "this", "->", "getTestConfig", "(", ")", "->", "getTempDirectory", "(", ")",...
Calls service on local server. @param string $serviceName @return mixed|null
[ "Calls", "service", "on", "local", "server", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L135-L149
44,966
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.copyServicesToShop
protected function copyServicesToShop() { $fileCopier = new FileCopier(); $target = $this->getTestConfig()->getRemoteDirectory() . '/Services'; $fileCopier->copyFiles(TEST_LIBRARY_PATH.'/Services', $target, true); }
php
protected function copyServicesToShop() { $fileCopier = new FileCopier(); $target = $this->getTestConfig()->getRemoteDirectory() . '/Services'; $fileCopier->copyFiles(TEST_LIBRARY_PATH.'/Services', $target, true); }
[ "protected", "function", "copyServicesToShop", "(", ")", "{", "$", "fileCopier", "=", "new", "FileCopier", "(", ")", ";", "$", "target", "=", "$", "this", "->", "getTestConfig", "(", ")", "->", "getRemoteDirectory", "(", ")", ".", "'/Services'", ";", "$", ...
Copies services directory to shop.
[ "Copies", "services", "directory", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L164-L169
44,967
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.unserializeResponse
private function unserializeResponse($response) { $result = unserialize($response); if ($response !== 'b:0;' && $result === false) { throw new \Exception(substr($response, 0, 5000)); } return $result; }
php
private function unserializeResponse($response) { $result = unserialize($response); if ($response !== 'b:0;' && $result === false) { throw new \Exception(substr($response, 0, 5000)); } return $result; }
[ "private", "function", "unserializeResponse", "(", "$", "response", ")", "{", "$", "result", "=", "unserialize", "(", "$", "response", ")", ";", "if", "(", "$", "response", "!==", "'b:0;'", "&&", "$", "result", "===", "false", ")", "{", "throw", "new", ...
Unserializes given string. Throws exception if incorrect string is passed @param string $response @throws \Exception @return mixed
[ "Unserializes", "given", "string", ".", "Throws", "exception", "if", "incorrect", "string", "is", "passed" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L180-L188
44,968
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetStaticVariables
public function resetStaticVariables() { \oxArticleHelper::cleanup(); \oxSeoEncoderHelper::cleanup(); \oxDeliveryHelper::cleanup(); \oxManufacturerHelper::cleanup(); \oxAdminViewHelper::cleanup(); \oxVendorHelper::cleanup(); }
php
public function resetStaticVariables() { \oxArticleHelper::cleanup(); \oxSeoEncoderHelper::cleanup(); \oxDeliveryHelper::cleanup(); \oxManufacturerHelper::cleanup(); \oxAdminViewHelper::cleanup(); \oxVendorHelper::cleanup(); }
[ "public", "function", "resetStaticVariables", "(", ")", "{", "\\", "oxArticleHelper", "::", "cleanup", "(", ")", ";", "\\", "oxSeoEncoderHelper", "::", "cleanup", "(", ")", ";", "\\", "oxDeliveryHelper", "::", "cleanup", "(", ")", ";", "\\", "oxManufacturerHel...
Resets static variables of most classes.
[ "Resets", "static", "variables", "of", "most", "classes", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L31-L39
44,969
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.backupRegistry
public function backupRegistry() { $this->registryCache = array(); foreach (\OxidEsales\Eshop\Core\Registry::getKeys() as $class) { $instance = \OxidEsales\Eshop\Core\Registry::get($class); $this->registryCache[$class] = clone $instance; } }
php
public function backupRegistry() { $this->registryCache = array(); foreach (\OxidEsales\Eshop\Core\Registry::getKeys() as $class) { $instance = \OxidEsales\Eshop\Core\Registry::get($class); $this->registryCache[$class] = clone $instance; } }
[ "public", "function", "backupRegistry", "(", ")", "{", "$", "this", "->", "registryCache", "=", "array", "(", ")", ";", "foreach", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getKeys", "(", ")", "as", "$", "class", ")...
Creates registry clone
[ "Creates", "registry", "clone" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L44-L51
44,970
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetRegistry
public function resetRegistry() { $aRegKeys = \OxidEsales\Eshop\Core\Registry::getKeys(); $aSkippedClasses = array(); foreach ($aRegKeys as $sKey) { if (!in_array($sKey, $aSkippedClasses)) { $oInstance = null; if (!isset($this->registryCache[$sKey])) { try { $oNewInstance = oxNew($sKey); $this->registryCache[$sKey] = $oNewInstance; } catch (\OxidEsales\Eshop\Core\Exception\SystemComponentException $oException) { \OxidEsales\Eshop\Core\Registry::set($sKey, null); continue; } } $oInstance = clone $this->registryCache[$sKey]; \OxidEsales\Eshop\Core\Registry::set($sKey, $oInstance); } } }
php
public function resetRegistry() { $aRegKeys = \OxidEsales\Eshop\Core\Registry::getKeys(); $aSkippedClasses = array(); foreach ($aRegKeys as $sKey) { if (!in_array($sKey, $aSkippedClasses)) { $oInstance = null; if (!isset($this->registryCache[$sKey])) { try { $oNewInstance = oxNew($sKey); $this->registryCache[$sKey] = $oNewInstance; } catch (\OxidEsales\Eshop\Core\Exception\SystemComponentException $oException) { \OxidEsales\Eshop\Core\Registry::set($sKey, null); continue; } } $oInstance = clone $this->registryCache[$sKey]; \OxidEsales\Eshop\Core\Registry::set($sKey, $oInstance); } } }
[ "public", "function", "resetRegistry", "(", ")", "{", "$", "aRegKeys", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getKeys", "(", ")", ";", "$", "aSkippedClasses", "=", "array", "(", ")", ";", "foreach", "(", "$", "aR...
Cleans up the registry
[ "Cleans", "up", "the", "registry" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L56-L78
44,971
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.backupRequestVariables
public function backupRequestVariables() { $this->requestCache['_SERVER'] = $_SERVER; $this->requestCache['_POST'] = $_POST; $this->requestCache['_GET'] = $_GET; $this->requestCache['_SESSION'] = $_SESSION; $this->requestCache['_COOKIE'] = $_COOKIE; }
php
public function backupRequestVariables() { $this->requestCache['_SERVER'] = $_SERVER; $this->requestCache['_POST'] = $_POST; $this->requestCache['_GET'] = $_GET; $this->requestCache['_SESSION'] = $_SESSION; $this->requestCache['_COOKIE'] = $_COOKIE; }
[ "public", "function", "backupRequestVariables", "(", ")", "{", "$", "this", "->", "requestCache", "[", "'_SERVER'", "]", "=", "$", "_SERVER", ";", "$", "this", "->", "requestCache", "[", "'_POST'", "]", "=", "$", "_POST", ";", "$", "this", "->", "request...
Backs up global request variables for reverting them back after test run.
[ "Backs", "up", "global", "request", "variables", "for", "reverting", "them", "back", "after", "test", "run", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L83-L90
44,972
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetRequestVariables
public function resetRequestVariables() { $_SERVER = $this->requestCache['_SERVER']; $_POST = $this->requestCache['_POST']; $_GET = $this->requestCache['_GET']; $_SESSION = $this->requestCache['_SESSION']; $_COOKIE = $this->requestCache['_COOKIE']; }
php
public function resetRequestVariables() { $_SERVER = $this->requestCache['_SERVER']; $_POST = $this->requestCache['_POST']; $_GET = $this->requestCache['_GET']; $_SESSION = $this->requestCache['_SESSION']; $_COOKIE = $this->requestCache['_COOKIE']; }
[ "public", "function", "resetRequestVariables", "(", ")", "{", "$", "_SERVER", "=", "$", "this", "->", "requestCache", "[", "'_SERVER'", "]", ";", "$", "_POST", "=", "$", "this", "->", "requestCache", "[", "'_POST'", "]", ";", "$", "_GET", "=", "$", "th...
Sets global request variables to backed up ones after every test run.
[ "Sets", "global", "request", "variables", "to", "backed", "up", "ones", "after", "every", "test", "run", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L95-L102
44,973
OXID-eSales/testing_library
library/ObjectValidator.php
ObjectValidator.getErrorMessage
public function getErrorMessage() { $sMessage = ''; $aErrors = $this->_getErrors(); if (!empty($aErrors)) { $sMessage = "Expected and actual parameters do not match: \n"; $sMessage .= implode("\n", $aErrors); } return $sMessage; }
php
public function getErrorMessage() { $sMessage = ''; $aErrors = $this->_getErrors(); if (!empty($aErrors)) { $sMessage = "Expected and actual parameters do not match: \n"; $sMessage .= implode("\n", $aErrors); } return $sMessage; }
[ "public", "function", "getErrorMessage", "(", ")", "{", "$", "sMessage", "=", "''", ";", "$", "aErrors", "=", "$", "this", "->", "_getErrors", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "aErrors", ")", ")", "{", "$", "sMessage", "=", "\"Expe...
Returns formed error message if parameters was not valid @return string
[ "Returns", "formed", "error", "message", "if", "parameters", "was", "not", "valid" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ObjectValidator.php#L43-L53
44,974
OXID-eSales/testing_library
library/ObjectValidator.php
ObjectValidator._getObjectParameters
protected function _getObjectParameters($sClass, $aObjectParams, $sOxId = null, $sShopId = null) { $oServiceCaller = new ServiceCaller(); $oServiceCaller->setParameter('cl', $sClass); $sOxId = $sOxId ? $sOxId : 'lastInsertedId'; $oServiceCaller->setParameter('oxid', $sOxId); $oServiceCaller->setParameter('classparams', $aObjectParams); return $oServiceCaller->callService('ShopObjectConstructor', $sShopId); }
php
protected function _getObjectParameters($sClass, $aObjectParams, $sOxId = null, $sShopId = null) { $oServiceCaller = new ServiceCaller(); $oServiceCaller->setParameter('cl', $sClass); $sOxId = $sOxId ? $sOxId : 'lastInsertedId'; $oServiceCaller->setParameter('oxid', $sOxId); $oServiceCaller->setParameter('classparams', $aObjectParams); return $oServiceCaller->callService('ShopObjectConstructor', $sShopId); }
[ "protected", "function", "_getObjectParameters", "(", "$", "sClass", ",", "$", "aObjectParams", ",", "$", "sOxId", "=", "null", ",", "$", "sShopId", "=", "null", ")", "{", "$", "oServiceCaller", "=", "new", "ServiceCaller", "(", ")", ";", "$", "oServiceCal...
Returns object parameters @param string $sClass @param array $aObjectParams @param string $sOxId @param string $sShopId @return mixed
[ "Returns", "object", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ObjectValidator.php#L85-L95
44,975
OXID-eSales/testing_library
library/Services/ServiceFactory.php
ServiceFactory.createService
public function createService($serviceClass) { $className = $serviceClass; if (!$this->isNamespacedClass($serviceClass)) { // Used for backwards compatibility. $className = $this->formClassName($serviceClass); } if (!class_exists($className)) { throw new Exception("Service '$serviceClass' was not found!"); } $service = new $className($this->getServiceConfig()); if (!($service instanceof ShopServiceInterface)) { throw new Exception("Service '$className' does not implement ShopServiceInterface interface!"); } return $service; }
php
public function createService($serviceClass) { $className = $serviceClass; if (!$this->isNamespacedClass($serviceClass)) { // Used for backwards compatibility. $className = $this->formClassName($serviceClass); } if (!class_exists($className)) { throw new Exception("Service '$serviceClass' was not found!"); } $service = new $className($this->getServiceConfig()); if (!($service instanceof ShopServiceInterface)) { throw new Exception("Service '$className' does not implement ShopServiceInterface interface!"); } return $service; }
[ "public", "function", "createService", "(", "$", "serviceClass", ")", "{", "$", "className", "=", "$", "serviceClass", ";", "if", "(", "!", "$", "this", "->", "isNamespacedClass", "(", "$", "serviceClass", ")", ")", "{", "// Used for backwards compatibility.", ...
Creates Service object. All services must implement ShopService interface @param string $serviceClass @throws Exception @return ShopServiceInterface
[ "Creates", "Service", "object", ".", "All", "services", "must", "implement", "ShopService", "interface" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ServiceFactory.php#L38-L55
44,976
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearCacheBackend
public function clearCacheBackend() { if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\Generic\Cache')) { $oCache = oxNew(\OxidEsales\Eshop\Core\Cache\Generic\Cache::class); $oCache->flush(); } }
php
public function clearCacheBackend() { if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\Generic\Cache')) { $oCache = oxNew(\OxidEsales\Eshop\Core\Cache\Generic\Cache::class); $oCache->flush(); } }
[ "public", "function", "clearCacheBackend", "(", ")", "{", "if", "(", "class_exists", "(", "'\\OxidEsales\\EshopEnterprise\\Core\\Cache\\Generic\\Cache'", ")", ")", "{", "$", "oCache", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Cache...
Clears cache backend.
[ "Clears", "cache", "backend", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L18-L24
44,977
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearReverseProxyCache
public function clearReverseProxyCache() { if (class_exists('\OxidEsales\VarnishModule\Core\OeVarnishModule', false)) { \OxidEsales\VarnishModule\Core\OeVarnishModule::flushReverseProxyCache(); } if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend', false)) { $oReverseProxy = oxNew(\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend::class); $oReverseProxy->setFlush(); $oReverseProxy->execute(); } if (class_exists('\OxidEsales\NginxModule\Core\Module', false)) { \OxidEsales\NginxModule\Core\Module::clearNginxCache(); } }
php
public function clearReverseProxyCache() { if (class_exists('\OxidEsales\VarnishModule\Core\OeVarnishModule', false)) { \OxidEsales\VarnishModule\Core\OeVarnishModule::flushReverseProxyCache(); } if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend', false)) { $oReverseProxy = oxNew(\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend::class); $oReverseProxy->setFlush(); $oReverseProxy->execute(); } if (class_exists('\OxidEsales\NginxModule\Core\Module', false)) { \OxidEsales\NginxModule\Core\Module::clearNginxCache(); } }
[ "public", "function", "clearReverseProxyCache", "(", ")", "{", "if", "(", "class_exists", "(", "'\\OxidEsales\\VarnishModule\\Core\\OeVarnishModule'", ",", "false", ")", ")", "{", "\\", "OxidEsales", "\\", "VarnishModule", "\\", "Core", "\\", "OeVarnishModule", "::", ...
Clears reverse proxy cache.
[ "Clears", "reverse", "proxy", "cache", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L29-L42
44,978
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearTemporaryDirectory
public function clearTemporaryDirectory() { if ($sCompileDir = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('sCompileDir')) { CliExecutor::executeCommand("sudo chmod 777 -R $sCompileDir"); $this->removeTemporaryDirectory($sCompileDir, false); } }
php
public function clearTemporaryDirectory() { if ($sCompileDir = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('sCompileDir')) { CliExecutor::executeCommand("sudo chmod 777 -R $sCompileDir"); $this->removeTemporaryDirectory($sCompileDir, false); } }
[ "public", "function", "clearTemporaryDirectory", "(", ")", "{", "if", "(", "$", "sCompileDir", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "get", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "ConfigFile", ":...
Clears temporary directory.
[ "Clears", "temporary", "directory", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L47-L53
44,979
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.removeTemporaryDirectory
private function removeTemporaryDirectory($dir, $rmBaseDir = false) { $itemsToIgnore = array('.', '..', '.htaccess'); $files = array_diff(scandir($dir), $itemsToIgnore); foreach ($files as $file) { if (is_dir("$dir/$file")) { $this->removeTemporaryDirectory( "$dir/$file", $file == 'smarty' ? $rmBaseDir : true ); } else { @unlink("$dir/$file"); } } if ($rmBaseDir) { @rmdir($dir); } }
php
private function removeTemporaryDirectory($dir, $rmBaseDir = false) { $itemsToIgnore = array('.', '..', '.htaccess'); $files = array_diff(scandir($dir), $itemsToIgnore); foreach ($files as $file) { if (is_dir("$dir/$file")) { $this->removeTemporaryDirectory( "$dir/$file", $file == 'smarty' ? $rmBaseDir : true ); } else { @unlink("$dir/$file"); } } if ($rmBaseDir) { @rmdir($dir); } }
[ "private", "function", "removeTemporaryDirectory", "(", "$", "dir", ",", "$", "rmBaseDir", "=", "false", ")", "{", "$", "itemsToIgnore", "=", "array", "(", "'.'", ",", "'..'", ",", "'.htaccess'", ")", ";", "$", "files", "=", "array_diff", "(", "scandir", ...
Delete all files and dirs recursively @param string $dir Directory to delete @param bool $rmBaseDir Keep target directory
[ "Delete", "all", "files", "and", "dirs", "recursively" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L61-L79
44,980
OXID-eSales/testing_library
library/Services/Library/CliExecutor.php
CliExecutor.executeCommand
static function executeCommand($command) { exec($command, $output, $resultCode); if ($resultCode > 0) { $output = implode("\n", $output); throw new Exception("Failed to execute command: '$command' with output: '$output' "); } }
php
static function executeCommand($command) { exec($command, $output, $resultCode); if ($resultCode > 0) { $output = implode("\n", $output); throw new Exception("Failed to execute command: '$command' with output: '$output' "); } }
[ "static", "function", "executeCommand", "(", "$", "command", ")", "{", "exec", "(", "$", "command", ",", "$", "output", ",", "$", "resultCode", ")", ";", "if", "(", "$", "resultCode", ">", "0", ")", "{", "$", "output", "=", "implode", "(", "\"\\n\"",...
Execute shell command. Throw an exception in if shell command fails. @param string $command @throws Exception
[ "Execute", "shell", "command", ".", "Throw", "an", "exception", "in", "if", "shell", "command", "fails", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/CliExecutor.php#L21-L29
44,981
OXID-eSales/testing_library
library/Services/Library/Request.php
Request.getUploadedFile
public function getUploadedFile($name) { $filePath = ''; if (array_key_exists($name, $_FILES)) { $filePath = $_FILES[$name]['tmp_name']; } elseif (array_key_exists($name, $this->parameters)) { $filePath = substr($this->parameters[$name], 1); } return $filePath; }
php
public function getUploadedFile($name) { $filePath = ''; if (array_key_exists($name, $_FILES)) { $filePath = $_FILES[$name]['tmp_name']; } elseif (array_key_exists($name, $this->parameters)) { $filePath = substr($this->parameters[$name], 1); } return $filePath; }
[ "public", "function", "getUploadedFile", "(", "$", "name", ")", "{", "$", "filePath", "=", "''", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "_FILES", ")", ")", "{", "$", "filePath", "=", "$", "_FILES", "[", "$", "name", "]", "[...
Returns uploaded file parameter @param string $name param name @return mixed
[ "Returns", "uploaded", "file", "parameter" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Request.php#L49-L59
44,982
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.read
public function read() { if ($this->isExistingMetricsFile()) { $this->_resetTotalValues(); foreach ($this->_oMetrics->package as $oPackage) { $this->_readClassMetricsPerPackage($oPackage); } } }
php
public function read() { if ($this->isExistingMetricsFile()) { $this->_resetTotalValues(); foreach ($this->_oMetrics->package as $oPackage) { $this->_readClassMetricsPerPackage($oPackage); } } }
[ "public", "function", "read", "(", ")", "{", "if", "(", "$", "this", "->", "isExistingMetricsFile", "(", ")", ")", "{", "$", "this", "->", "_resetTotalValues", "(", ")", ";", "foreach", "(", "$", "this", "->", "_oMetrics", "->", "package", "as", "$", ...
To start generated metrics xml file analysis for CCN, Crap index and NPath
[ "To", "start", "generated", "metrics", "xml", "file", "analysis", "for", "CCN", "Crap", "index", "and", "NPath" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L96-L105
44,983
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._readMetricsForClass
protected function _readMetricsForClass($oClass) { $sClass = (string)$oClass['name']; foreach ($oClass as $oFunction) { $this->_readFunctionMetrics($sClass, $oFunction); } $iLocSum = $this->_aStats[$sClass]['sum']['locExecutable']; // Statistics if ($iLocSum) { $this->_aStats[$sClass]['stat']['cnn'] = $this->_aStats[$sClass]['sum']['cnn'] / $iLocSum; $this->_aStats[$sClass]['stat']['crap'] = $this->_aStats[$sClass]['sum']['crap'] / $iLocSum; $this->_aStats[$sClass]['stat']['npath'] = $this->_aStats[$sClass]['sum']['npath'] / $iLocSum; } }
php
protected function _readMetricsForClass($oClass) { $sClass = (string)$oClass['name']; foreach ($oClass as $oFunction) { $this->_readFunctionMetrics($sClass, $oFunction); } $iLocSum = $this->_aStats[$sClass]['sum']['locExecutable']; // Statistics if ($iLocSum) { $this->_aStats[$sClass]['stat']['cnn'] = $this->_aStats[$sClass]['sum']['cnn'] / $iLocSum; $this->_aStats[$sClass]['stat']['crap'] = $this->_aStats[$sClass]['sum']['crap'] / $iLocSum; $this->_aStats[$sClass]['stat']['npath'] = $this->_aStats[$sClass]['sum']['npath'] / $iLocSum; } }
[ "protected", "function", "_readMetricsForClass", "(", "$", "oClass", ")", "{", "$", "sClass", "=", "(", "string", ")", "$", "oClass", "[", "'name'", "]", ";", "foreach", "(", "$", "oClass", "as", "$", "oFunction", ")", "{", "$", "this", "->", "_readFun...
To make analysis for class @param object $oClass class xml object
[ "To", "make", "analysis", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L124-L140
44,984
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._readFunctionMetrics
protected function _readFunctionMetrics($sClass, $oFunction) { $iCcn = (int)$oFunction['ccn']; $iCrap = (int)$oFunction['ccn2']; $iNPath = (int)$oFunction['npath']; $iLoc = (int)$oFunction['lloc']; // Sums $this->appendClassTotalCNN($sClass, (int)$iCcn * $iLoc); $this->appendClassTotalCrapIndex($sClass, (int)$iCrap * $iLoc); $this->appendClassTotalNPath($sClass, (int)$iNPath * $iLoc); $this->appendClassTotalLLOC($sClass, $iLoc); // Max $this->updateClassMaxCCN($sClass, $iCcn); $this->updateClassMaxCrapIndex($sClass, $iCrap); $this->updateClassMaxNPath($sClass, $iNPath); $this->updateClassMaxLLOC($sClass, $iLoc); $this->setGlobalValues($iCcn, $iCrap, $iNPath, $iLoc); }
php
protected function _readFunctionMetrics($sClass, $oFunction) { $iCcn = (int)$oFunction['ccn']; $iCrap = (int)$oFunction['ccn2']; $iNPath = (int)$oFunction['npath']; $iLoc = (int)$oFunction['lloc']; // Sums $this->appendClassTotalCNN($sClass, (int)$iCcn * $iLoc); $this->appendClassTotalCrapIndex($sClass, (int)$iCrap * $iLoc); $this->appendClassTotalNPath($sClass, (int)$iNPath * $iLoc); $this->appendClassTotalLLOC($sClass, $iLoc); // Max $this->updateClassMaxCCN($sClass, $iCcn); $this->updateClassMaxCrapIndex($sClass, $iCrap); $this->updateClassMaxNPath($sClass, $iNPath); $this->updateClassMaxLLOC($sClass, $iLoc); $this->setGlobalValues($iCcn, $iCrap, $iNPath, $iLoc); }
[ "protected", "function", "_readFunctionMetrics", "(", "$", "sClass", ",", "$", "oFunction", ")", "{", "$", "iCcn", "=", "(", "int", ")", "$", "oFunction", "[", "'ccn'", "]", ";", "$", "iCrap", "=", "(", "int", ")", "$", "oFunction", "[", "'ccn2'", "]...
To make metrics analysis for class @param string $sClass class name @param object $oFunction class method metrics
[ "To", "make", "metrics", "analysis", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L148-L168
44,985
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._resetTotalValues
protected function _resetTotalValues() { $this->_iTotalCnn = 0; $this->_iTotalCrapIndex = 0; $this->_iTotalNPath = 0; $this->_iTotalLLOC = 0; $this->_aStats = array(); }
php
protected function _resetTotalValues() { $this->_iTotalCnn = 0; $this->_iTotalCrapIndex = 0; $this->_iTotalNPath = 0; $this->_iTotalLLOC = 0; $this->_aStats = array(); }
[ "protected", "function", "_resetTotalValues", "(", ")", "{", "$", "this", "->", "_iTotalCnn", "=", "0", ";", "$", "this", "->", "_iTotalCrapIndex", "=", "0", ";", "$", "this", "->", "_iTotalNPath", "=", "0", ";", "$", "this", "->", "_iTotalLLOC", "=", ...
To reset total values
[ "To", "reset", "total", "values" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L174-L181
44,986
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalCNN
public function appendClassTotalCNN($sClassName, $iCNN) { if (!isset($this->_aStats[$sClassName]['sum']['cnn'])) { $this->_aStats[$sClassName]['sum']['cnn'] = 0; } $this->_aStats[$sClassName]['sum']['cnn'] += $iCNN; }
php
public function appendClassTotalCNN($sClassName, $iCNN) { if (!isset($this->_aStats[$sClassName]['sum']['cnn'])) { $this->_aStats[$sClassName]['sum']['cnn'] = 0; } $this->_aStats[$sClassName]['sum']['cnn'] += $iCNN; }
[ "public", "function", "appendClassTotalCNN", "(", "$", "sClassName", ",", "$", "iCNN", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'cnn'", "]", ")", ")", "{", "$", "thi...
To append total CCN for needed class @param string $sClassName class name @param int $iCNN new ccn value which needs to add
[ "To", "append", "total", "CCN", "for", "needed", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L199-L206
44,987
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalCrapIndex
public function appendClassTotalCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['sum']['crap'])) { $this->_aStats[$sClassName]['sum']['crap'] = 0; } $this->_aStats[$sClassName]['sum']['crap'] += $iCrapIndex; }
php
public function appendClassTotalCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['sum']['crap'])) { $this->_aStats[$sClassName]['sum']['crap'] = 0; } $this->_aStats[$sClassName]['sum']['crap'] += $iCrapIndex; }
[ "public", "function", "appendClassTotalCrapIndex", "(", "$", "sClassName", ",", "$", "iCrapIndex", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'crap'", "]", ")", ")", "{", ...
To append total crap index for class @param string $sClassName class name @param string $iCrapIndex Crap index
[ "To", "append", "total", "crap", "index", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L234-L240
44,988
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalNPath
public function appendClassTotalNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['sum']['npath'])) { $this->_aStats[$sClassName]['sum']['npath'] = 0; } $this->_aStats[$sClassName]['sum']['npath'] += $iNPath; }
php
public function appendClassTotalNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['sum']['npath'])) { $this->_aStats[$sClassName]['sum']['npath'] = 0; } $this->_aStats[$sClassName]['sum']['npath'] += $iNPath; }
[ "public", "function", "appendClassTotalNPath", "(", "$", "sClassName", ",", "$", "iNPath", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'npath'", "]", ")", ")", "{", "$", ...
To append new value to class total NPath @param string $sClassName class name @param int $iNPath new value of NPath
[ "To", "append", "new", "value", "to", "class", "total", "NPath" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L268-L275
44,989
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalLLOC
public function appendClassTotalLLOC($sClassName, $iTotalLLOC) { if (!isset($this->_aStats[$sClassName]['sum']['locExecutable'])) { $this->_aStats[$sClassName]['sum']['locExecutable'] = 0; } $this->_aStats[$sClassName]['sum']['locExecutable'] += $iTotalLLOC; }
php
public function appendClassTotalLLOC($sClassName, $iTotalLLOC) { if (!isset($this->_aStats[$sClassName]['sum']['locExecutable'])) { $this->_aStats[$sClassName]['sum']['locExecutable'] = 0; } $this->_aStats[$sClassName]['sum']['locExecutable'] += $iTotalLLOC; }
[ "public", "function", "appendClassTotalLLOC", "(", "$", "sClassName", ",", "$", "iTotalLLOC", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'locExecutable'", "]", ")", ")", "...
To append class total logical lines of code @param string $sClassName name of class @param int $iTotalLLOC number of logical code lines
[ "To", "append", "class", "total", "logical", "lines", "of", "code" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L303-L310
44,990
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxCCN
public function updateClassMaxCCN($sClassName, $iCCN) { if (!isset($this->_aStats[$sClassName]['max']['cnn']) || $this->_aStats[$sClassName]['max']['cnn'] < $iCCN) { $this->_aStats[$sClassName]['max']['cnn'] = $iCCN; } }
php
public function updateClassMaxCCN($sClassName, $iCCN) { if (!isset($this->_aStats[$sClassName]['max']['cnn']) || $this->_aStats[$sClassName]['max']['cnn'] < $iCCN) { $this->_aStats[$sClassName]['max']['cnn'] = $iCCN; } }
[ "public", "function", "updateClassMaxCCN", "(", "$", "sClassName", ",", "$", "iCCN", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'cnn'", "]", ")", "||", "$", "this", "-...
To update class value of CCN if new one is bigger then older one @param string $sClassName class name @param int $iCCN new value of CCN
[ "To", "update", "class", "value", "of", "CCN", "if", "new", "one", "is", "bigger", "then", "older", "one" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L338-L343
44,991
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxCrapIndex
public function updateClassMaxCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['max']['crap']) || $this->_aStats[$sClassName]['max']['crap'] < $iCrapIndex ) { $this->_aStats[$sClassName]['max']['crap'] = $iCrapIndex; } }
php
public function updateClassMaxCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['max']['crap']) || $this->_aStats[$sClassName]['max']['crap'] < $iCrapIndex ) { $this->_aStats[$sClassName]['max']['crap'] = $iCrapIndex; } }
[ "public", "function", "updateClassMaxCrapIndex", "(", "$", "sClassName", ",", "$", "iCrapIndex", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'crap'", "]", ")", "||", "$", ...
To update class value of Crap index with new one if is bigger then older @param string $sClassName class name @param int $iCrapIndex value of Crap index
[ "To", "update", "class", "value", "of", "Crap", "index", "with", "new", "one", "if", "is", "bigger", "then", "older" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L373-L380
44,992
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxNPath
public function updateClassMaxNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['max']['npath']) || $this->_aStats[$sClassName]['max']['npath'] < $iNPath ) { $this->_aStats[$sClassName]['max']['npath'] = $iNPath; } }
php
public function updateClassMaxNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['max']['npath']) || $this->_aStats[$sClassName]['max']['npath'] < $iNPath ) { $this->_aStats[$sClassName]['max']['npath'] = $iNPath; } }
[ "public", "function", "updateClassMaxNPath", "(", "$", "sClassName", ",", "$", "iNPath", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'npath'", "]", ")", "||", "$", "this"...
To update class NPath value if new one is bigger then existing @param string $sClassName class name @param int $iNPath NPath value
[ "To", "update", "class", "NPath", "value", "if", "new", "one", "is", "bigger", "then", "existing" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L422-L429
44,993
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxLLOC
public function updateClassMaxLLOC($sClassName, $iLLOC) { if (!isset($this->_aStats[$sClassName]['max']['locExecutable']) || $this->_aStats[$sClassName]['max']['locExecutable'] < $iLLOC ) { $this->_aStats[$sClassName]['max']['locExecutable'] = $iLLOC; } }
php
public function updateClassMaxLLOC($sClassName, $iLLOC) { if (!isset($this->_aStats[$sClassName]['max']['locExecutable']) || $this->_aStats[$sClassName]['max']['locExecutable'] < $iLLOC ) { $this->_aStats[$sClassName]['max']['locExecutable'] = $iLLOC; } }
[ "public", "function", "updateClassMaxLLOC", "(", "$", "sClassName", ",", "$", "iLLOC", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'locExecutable'", "]", ")", "||", "$", ...
To update class max LLOC value if new one is bigger then older one @param string $sClassName class name @param int $iLLOC value of LLOC
[ "To", "update", "class", "max", "LLOC", "value", "if", "new", "one", "is", "bigger", "then", "older", "one" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L459-L466
44,994
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.setGlobalValues
public function setGlobalValues($iCCN, $iCrapIndex, $iNPath, $iLLOC) { //Global total $this->appendTotalCCN((int)$iCCN * $iLLOC); $this->appendToTotalCrapIndex((int)$iCrapIndex * $iLLOC); $this->appendToTotalNPath((int)$iNPath * $iLLOC); $this->appendToTotalLLOC($iLLOC); // Global Max $this->updateMaxCCN($iCCN); $this->updateMaxCrapIndex($iCrapIndex); $this->updateMaxNPath($iNPath); $this->updateMaxLLOC($iLLOC); }
php
public function setGlobalValues($iCCN, $iCrapIndex, $iNPath, $iLLOC) { //Global total $this->appendTotalCCN((int)$iCCN * $iLLOC); $this->appendToTotalCrapIndex((int)$iCrapIndex * $iLLOC); $this->appendToTotalNPath((int)$iNPath * $iLLOC); $this->appendToTotalLLOC($iLLOC); // Global Max $this->updateMaxCCN($iCCN); $this->updateMaxCrapIndex($iCrapIndex); $this->updateMaxNPath($iNPath); $this->updateMaxLLOC($iLLOC); }
[ "public", "function", "setGlobalValues", "(", "$", "iCCN", ",", "$", "iCrapIndex", ",", "$", "iNPath", ",", "$", "iLLOC", ")", "{", "//Global total", "$", "this", "->", "appendTotalCCN", "(", "(", "int", ")", "$", "iCCN", "*", "$", "iLLOC", ")", ";", ...
To set global values @param int $iCCN value of CCN @param int $iCrapIndex Crap index @param int $iNPath NPath value @param int $iLLOC logical lines of code
[ "To", "set", "global", "values" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L486-L499
44,995
OXID-eSales/testing_library
library/VfsStreamWrapper.php
VfsStreamWrapper.createFile
public function createFile($filePath, $content = '') { $this->createStructure([ltrim($filePath, '/') => $content]); return $this->getRootPath() . $filePath; }
php
public function createFile($filePath, $content = '') { $this->createStructure([ltrim($filePath, '/') => $content]); return $this->getRootPath() . $filePath; }
[ "public", "function", "createFile", "(", "$", "filePath", ",", "$", "content", "=", "''", ")", "{", "$", "this", "->", "createStructure", "(", "[", "ltrim", "(", "$", "filePath", ",", "'/'", ")", "=>", "$", "content", "]", ")", ";", "return", "$", ...
Creates file with given content. If file contains path, directories will also be created. Creating multiple files in the same directory does not work as parent directories gets cleared on creation. NOTE: this can be used only once! If you call it twice, the first file is gone and not found by is_file, file_exists and others! @param string $filePath @param string $content Will try to convent any value to string if non string is given. @return string Path to created file.
[ "Creates", "file", "with", "given", "content", ".", "If", "file", "contains", "path", "directories", "will", "also", "be", "created", ".", "Creating", "multiple", "files", "in", "the", "same", "directory", "does", "not", "work", "as", "parent", "directories", ...
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/VfsStreamWrapper.php#L46-L50
44,996
OXID-eSales/testing_library
library/Services/ViewsGenerator/ViewsGenerator.php
ViewsGenerator.init
public function init($request) { $oGenerator = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oGenerator->updateViews(); }
php
public function init($request) { $oGenerator = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oGenerator->updateViews(); }
[ "public", "function", "init", "(", "$", "request", ")", "{", "$", "oGenerator", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DbMetaDataHandler", "::", "class", ")", ";", "$", "oGenerator", "->", "updateViews", "(", ")", ";",...
Clears shop cache @param Request $request
[ "Clears", "shop", "cache" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ViewsGenerator/ViewsGenerator.php#L27-L31
44,997
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerFactory.php
DatabaseRestorerFactory.createRestorer
public function createRestorer($className) { if (!class_exists($className)) { $className = __NAMESPACE__ . '\\' . $className; } $restorer = class_exists($className) ? new $className : new DatabaseRestorer(); if (!($restorer instanceof DatabaseRestorerInterface)) { throw new Exception("Database restorer class should implement DatabaseRestorerInterface interface!"); } return $restorer; }
php
public function createRestorer($className) { if (!class_exists($className)) { $className = __NAMESPACE__ . '\\' . $className; } $restorer = class_exists($className) ? new $className : new DatabaseRestorer(); if (!($restorer instanceof DatabaseRestorerInterface)) { throw new Exception("Database restorer class should implement DatabaseRestorerInterface interface!"); } return $restorer; }
[ "public", "function", "createRestorer", "(", "$", "className", ")", "{", "if", "(", "!", "class_exists", "(", "$", "className", ")", ")", "{", "$", "className", "=", "__NAMESPACE__", ".", "'\\\\'", ".", "$", "className", ";", "}", "$", "restorer", "=", ...
Creates and returns database restoration object. @param $className @return mixed @throws Exception
[ "Creates", "and", "returns", "database", "restoration", "object", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerFactory.php#L22-L35
44,998
OXID-eSales/testing_library
library/helpers/oxArticleHelper.php
oxArticleHelper.resetCache
public static function resetCache() { parent::$_aArticleVendors = array(); parent::$_aArticleManufacturers = array(); parent::$_aLoadedParents = null; parent::$_aSelList = null; }
php
public static function resetCache() { parent::$_aArticleVendors = array(); parent::$_aArticleManufacturers = array(); parent::$_aLoadedParents = null; parent::$_aSelList = null; }
[ "public", "static", "function", "resetCache", "(", ")", "{", "parent", "::", "$", "_aArticleVendors", "=", "array", "(", ")", ";", "parent", "::", "$", "_aArticleManufacturers", "=", "array", "(", ")", ";", "parent", "::", "$", "_aLoadedParents", "=", "nul...
Reset cached private variable values.
[ "Reset", "cached", "private", "variable", "values", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/helpers/oxArticleHelper.php#L60-L66
44,999
OXID-eSales/testing_library
library/Translator.php
Translator._isTranslateAble
protected function _isTranslateAble($sString) { $sPattern = $this->getTranslationPattern(); $aMatches = array(); if (is_array($sString)) { $sString = implode('_DELIMITER_', $sString); } preg_match_all("|{$sPattern}|", $sString, $aMatches); if ($aMatches['key'] > 0) { $this->_setKeys($aMatches['key']); return true; } return false; }
php
protected function _isTranslateAble($sString) { $sPattern = $this->getTranslationPattern(); $aMatches = array(); if (is_array($sString)) { $sString = implode('_DELIMITER_', $sString); } preg_match_all("|{$sPattern}|", $sString, $aMatches); if ($aMatches['key'] > 0) { $this->_setKeys($aMatches['key']); return true; } return false; }
[ "protected", "function", "_isTranslateAble", "(", "$", "sString", ")", "{", "$", "sPattern", "=", "$", "this", "->", "getTranslationPattern", "(", ")", ";", "$", "aMatches", "=", "array", "(", ")", ";", "if", "(", "is_array", "(", "$", "sString", ")", ...
Checks if string can be translated @param $sString @return bool
[ "Checks", "if", "string", "can", "be", "translated" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Translator.php#L200-L214