sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function translate($source, $languageFrom, $languageTo)
{
$context = $this->parse($source, $languageFrom, $languageTo);
$hasBodyTag = (strpos($context->getSource(), '<body') !== false);
// translating through Weglot API
$translate = new Translate($context->getTranslateEntry()... | {@inheritdoc}
@param $source
@param $languageFrom
@param $languageTo
@return string
@throws Exception\ParserContextException
@throws \Weglot\Client\Api\Exception\ApiError
@throws \Weglot\Client\Api\Exception\InputAndOutputCountMatchException
@throws \Weglot\Client\Api\Exception\InvalidWordTypeException
@throws \Weglot\... | entailment |
protected function xpath()
{
$selectors = [];
foreach ($this->attributes as $attribute) {
$selectors[] = 'name() = \'' .$attribute. '\'';
}
return '//a[not(ancestor-or-self::*[@' .Parser::ATTRIBUTE_NO_TRANSLATE. '])]/@*[' .implode(' or ', $selectors). ']';
} | {@inheritdoc} | entailment |
protected function type(\DOMNode $node)
{
$type = WordType::TEXT;
if ($node->localName === 'href') {
$type = WordType::PDF_HREF;
}
return $type;
} | {@inheritdoc} | entailment |
protected function validation(\DOMNode $node, $value)
{
$extended = true;
$boolean = parent::validation($node, $value);
if ($node->localName === 'href') {
$extended = false;
foreach ($this->hrefExtensions as $extension) {
$start = (\strlen($extension)... | {@inheritdoc} | entailment |
public function getOrderInfo($cmd, $original_delivery = false){
// Sanity check - for older versions of PHP
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati un ID valid al comenzii');
// Set method and action
$method = 'orders';
$action = 'getOrder';
... | [RO] Preia datele asociate cu o anumita comanda (https://github.com/celdotro/marketplace/wiki/Datele-comenzii)
[EN] Retrieve data associated with an order (https://github.com/celdotro/marketplace/wiki/Order-data)
@param $cmd
@param bool $original_delivery
@return mixed
@throws \Exception | entailment |
public function updatesn($id_disp_fact, $products, $sn, $nr){
// Sanity check
if(empty($id_disp_fact)) throw new \Exception('Specificati un ID valid al dispozitiei de facturare');
if(empty($products)) throw new \Exception('Specificati o lista valida de produse');
// Set method and actio... | [RO] Actualizeaza SN-ul unui produs comandat (https://github.com/celdotro/marketplace/wiki/Actualizare-SN)
[EN] Updates an ordered product's SN (https://github.com/celdotro/marketplace/wiki/Update-SN)
@param $id_disp_fact
@param $products
@param $sn
@param $nr
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function addOrderObservations($orders_id, $observations){
// Sanity check
if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda');
// Set method and action
$method = 'orders';
$action = 'addOrderObservations';
// Set data
$data = ... | [RO] Adauga observatii comenzii (https://github.com/celdotro/marketplace/wiki/Adauga-observatii-comanda)
[EN] Add order observations (https://github.com/celdotro/marketplace/wiki/Add-Order-Observations)
@param $orders_id
@param $observations
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function printOrder($orders_id){
// Sanity check
if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda');
// Set method and action
$method = 'orders';
$action = 'printOrder';;
// Set data
$data = array(
'orders_id' => ... | [RO] Returneaza un document PDF cu datele comenzii (https://github.com/celdotro/marketplace/wiki/Tipareste-comanda)
[EN] Returns a PDF with the order's details (https://github.com/celdotro/marketplace/wiki/Print-order)
@param $orders_id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function finishOrderCombined($orders_id, $serie, $nr_fact, $awb, $idAdresaRidicare, $observations, $products, $autogenerateAwb){
// Sanity check
if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda');
// Set method and action
$method = 'orders';
... | [RO] Finalizeaza o comanda parcurgand automat toti pasii (https://github.com/celdotro/marketplace/wiki/Finalizere-combinata-a-comenzii)
[EN] Finishes an order by automatically taking all the necessary steps (https://github.com/celdotro/marketplace/wiki/Finish-order-combined)
@param $orders_id
@param $serie
@param $nr_f... | entailment |
public function setAwbInfo($cmd, $courier, $idAdresaRidicare, $plic = null, $packages = null, $kg = null, $sambata = 0){
// Sanity check
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
if(!isset($courier) || trim($courier) == '') throw new \Exception('Specificati c... | [RO] Seteaza informatiile necesare AWB-ului unei anumite comenzi (https://github.com/celdotro/marketplace/wiki/Setare-date-AWB)
[EN] Set the AWB information for a specific order (https://github.com/celdotro/marketplace/wiki/Set-AWB-Info)
@param $cmd
@param $courier
@param $idAdresaRidicare
@param null $plic
@param null... | entailment |
public function makeRequest($method, $endpoint, $body = [], $asArray = true)
{
try {
list($rawBody, $httpStatusCode, $httpHeader) = $this->getHttpClient()->request(
$method,
$this->makeAbsUrl($endpoint),
['api_key' => $this->apiKey],
... | Make the API call and return the response.
@param string $method Method to use for given endpoint
@param string $endpoint Endpoint to hit on API
@param array $body Body content of the request as array
@param bool $asArray To know if we return an array or ResponseInterface
@return array|ResponseInterface
... | entailment |
public function createProvider()
{
$graphApiVersion = 'v2.12';
if(!empty($this->providerInfos->config['graphApiVersion']))
{
$graphApiVersion = $this->providerInfos->config['graphApiVersion'];
}
$config = [
'clientId' => $this->providerInfos->clientI... | Create Facebook Provider
@return League\OAuth2\Client\Provider\Facebook | entailment |
public function getRedirectUri()
{
$url = parent::getRedirectUri();
$parsedUrl = parse_url($url);
if (isset($parsedUrl['query'])) {
parse_str($parsedUrl['query'], $query);
$query = http_build_query($query);
return $parsedUrl['scheme'].'://'.$parsedUrl['... | {@inheritDoc} | entailment |
public function safeUp()
{
Craft::log('Altering craft_oauth_tokens accessToken, secret and refreshToken columns to text...', LogLevel::Info, true);
$this->alterColumn('oauth_tokens', 'accessToken', array(ColumnType::Text));
$this->alterColumn('oauth_tokens', 'secret', array(ColumnType::Text... | Any migration code in here is wrapped inside of a transaction.
@return bool | entailment |
public function getTransportTax($id = null){
// Set method and action
$method = 'admininfo';
$action = 'getTransportTax';
// Set data
if(!is_null($id)) $data = array('id' => $id);
else $data = array();
// Send request and retrieve response
$result = Disp... | [RO] Preia taxa de transport (https://github.com/celdotro/marketplace/wiki/Preia-taxa-de-transport)
[EN] Retrieves the transport tax (https://github.com/celdotro/marketplace/wiki/Get-transport-tax)
@param null $id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function updateTransportTax($id, $newValue = null, $impusa = null){
// Sanity check
if(is_null($newValue) && is_null($impusa)) throw new \Exception('Limita sau valoarea trebuie sa fie nenule');
// Set method and action
$method = 'admininfo';
$action = 'updateTransportTax';... | [RO] Actualizeaza o taxa de transport (https://github.com/celdotro/marketplace/wiki/Actualizeaza-taxa-de-transport)
[EN] Updates a transport tax (https://github.com/celdotro/marketplace/wiki/Update-transport-tax)
@param $id
@param null $newValue
@param null $impusa
@return mixed
@throws \GuzzleHttp\Exception\GuzzleExce... | entailment |
public function insertTaxForAllCategories($newValue = null, $newLimit = null){
// Sanity check
if(is_null($newValue) && is_null($newLimit)) throw new \Exception('Limita sau valoarea trebuie sa fie nenule');
// Set method and action
$method = 'admininfo';
$action = 'insertTaxForAl... | [RO] Actualizeaza in grup toate taxele de transport pentru categoriile disponibile (https://github.com/celdotro/marketplace/wiki/Actualizare-in-grup-a-taxelor-de-transport)
[EN] Updates all transport taxes for available categories (https://github.com/celdotro/marketplace/wiki/Bulk-update-transport-taxes)
@param null $n... | entailment |
public function updateDeliveryInformation($minimTara = null, $minimBucuresti = null, $kgIncluse = null, $pretKgInPlus = null, $deschidereColet = null){
// Set method and action
$method = 'admininfo';
$action = 'updateDeliveryInformation';
// Set data
$data = array();
if(... | [RO] Actualizeaza informatiil referitoare la taxele percepute pentru livrare (https://github.com/celdotro/marketplace/wiki/Actualizeaza-informatiile-livrarii)
[EN] Updates information about delivery taxes (https://github.com/celdotro/marketplace/wiki/Update-delivery-information)
@param null $minimTara
@param null $mini... | entailment |
public function getDeliveryInformation($newValue = null, $newLimit = null){
// Set method and action
$method = 'admininfo';
$action = 'getDeliveryInformation';
// Set data
$data = array('dummy' => 1);
// Send request and retrieve response
$result = Dispatcher::s... | [RO] Preia informatiile despre taxele de livrare (https://github.com/celdotro/marketplace/wiki/Preia-informatii-despre-livrare)
[EN] Get information about delivery taxes (https://github.com/celdotro/marketplace/wiki/Get-delivery-information)
@param null $newValue
@param null $newLimit
@return mixed
@throws \GuzzleHttp\... | entailment |
public function getCouriers(){
// Set method and action
$method = 'admininfo';
$action = 'getCouriers';
// Set data
$data = array('dummy' => 1);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result;
... | [RO] Preia lista curierilor (https://github.com/celdotro/marketplace/wiki/Preia-lista-curieri)
[EN] Get couriers list (https://github.com/celdotro/marketplace/wiki/Get-couriers)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getCategoriesFaq(){
// Set method and action
$method = 'admininfo';
$action = 'getCategoriesFaq';
// Set data
$data = array('dummy' => 1);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return ... | [RO] Preia categoriile cu FAQ (https://github.com/celdotro/marketplace/wiki/Preia-FAQ-categorii)
[EN] Retrieves categories with FAQ (https://github.com/celdotro/marketplace/wiki/Get-categories-FAQ)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getCategoryFaqContent($category){
// Sanity check
if(empty($category)) throw new \Exception('Categorie invalida');
// Set method and action
$method = 'admininfo';
$action = 'getCategoryFaqContent';
// Set data
$data = array('category' => $categor... | [RO] Preia continutul FAQ pentru o categorie (https://github.com/celdotro/marketplace/wiki/Continut-FAQ-categorie)
[EN] Retrieve a category's FAQ contents (https://github.com/celdotro/marketplace/wiki/Category-FAQ-contents)
@param $category
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getMccCodes($filters = array(), $start = 0){
// Set method and action
$method = 'admininfo';
$action = 'getMccCodes';
// Set data
$data = array('filters' => $filters, 'start' => $start);
// Send request and retrieve response
$result = Dispatcher:... | [RO] Preia toate codurile MCC (https://github.com/celdotro/marketplace/wiki/Preia-coduri-MCC)
[EN] Get all MCC Codes (https://github.com/celdotro/marketplace/wiki/Get-MCC-Codes)
@param array $filters
@param int $start
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function addMccCode($mcc){
// Set method and action
$method = 'admininfo';
$action = 'addMccCode';
// Set data
$data = array('mcc' => $mcc);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result... | [RO] Adauga un cod MCC in contul curent (https://github.com/celdotro/marketplace/wiki/Atribuie-cod-MCC)
[EN] Add an MCC code to current account (https://github.com/celdotro/marketplace/wiki/Add-MCC-Code)
@param $mcc
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getCurrentMcc(){
// Set method and action
$method = 'admininfo';
$action = 'getCurrentMcc';
// Set data
$data = array('dummy' => 1);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $resul... | [RO] Preia lista MCC-urilor atribuite (https://github.com/celdotro/marketplace/wiki/Preia-MCC-uri-atribuite)
[EN] Get list of currently used MCC (https://github.com/celdotro/marketplace/wiki/Get-currently-used-MCC)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function removeMccCode($mcc){
// Set method and action
$method = 'admininfo';
$action = 'removeMccCode';
// Set data
$data = array('mcc' => $mcc);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $... | [RO] Elimina un MCC atribuit contului curent (https://github.com/celdotro/marketplace/wiki/Elimina-MCC)
[EN] Remove an MCC code linked to the current account (https://github.com/celdotro/marketplace/wiki/Remove-MCC-Code)
@param $mcc
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getCategoriesAccess(){
// Set method and action
$method = 'admininfo';
$action = 'getCategoriesAccess';
// Set data
$data = array('dummy' => 1);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
r... | [RO] Preia date referitoare la accesul la categorii (https://github.com/celdotro/marketplace/wiki/Preia-accesul-la--categorii)
[EN] Retrieve information about category access (https://github.com/celdotro/marketplace/wiki/Retrieve-category-access)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function requestCategoryAccess($categ_id){
// Set method and action
$method = 'admininfo';
$action = 'requestCategoryAccess';
// Set data
$data = array('categ_id' => $categ_id);
// Send request and retrieve response
$result = Dispatcher::send($method, $ac... | [RO] Cere acces la o categorie (https://github.com/celdotro/marketplace/wiki/Cere-acces-la-o-categorie)
[EN] Request access to category (https://github.com/celdotro/marketplace/wiki/Request-category-access)
@param $categ_id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function listCategoryRequests($availability){
// Set method and action
$method = 'admininfo';
$action = 'listCategoryRequests';
// Set data
$data = array('availability' => $availability);
// Send request and retrieve response
$result = Dispatcher::send($m... | [RO] Preia lista ceririlor de acces la categorii (https://github.com/celdotro/marketplace/wiki/Preia-cererile-de-acces-la--categorii)
[EN] Retrieve category access request list (https://github.com/celdotro/marketplace/wiki/Retrieve-access-requests)
@param $availability
@return mixed
@throws \GuzzleHttp\Exception\Guzzle... | entailment |
public function getAll($page = '')
{
$page = !empty($page) ? "/page={$page}" : '';
$request = $this->paystackHttpClient->get(
$this->transformUrl(Resource::GET_TRANSACTION, '').$page
);
return $this->processResourceRequestResponse($request);
} | Get all transactions.
@param string $page
@return \Exception|mixed | entailment |
public function getTransactionTotals()
{
$request = $this->paystackHttpClient->get(
Resource::GET_TRANSACTION_TOTALS
);
return $this->processResourceRequestResponse($request);
} | Get transactions totals. | entailment |
public function verify($reference)
{
$request = $this->paystackHttpClient->get(
$this->transformUrl(Resource::VERIFY_TRANSACTION, $reference, ':reference')
);
return $this->processResourceRequestResponse($request);
} | Verify Transaction by transaction reference.
@param $reference
@return \Exception|mixed | entailment |
public function initialize($body)
{
$request = $this->paystackHttpClient->post(
Resource::INITIALIZE_TRANSACTION,
[
'body' => is_array($body) ? $this->toJson($body) : $body,
]
);
return $this->processResourceRequestResponse($request);
... | Initialize one time transaction.
@param $body
@return \Exception|mixed | entailment |
public function chargeAuthorization($body)
{
$request = $this->paystackHttpClient->post(
Resource::CHARGE_AUTHORIZATION,
[
'body' => is_array($body) ? $this->toJson($body) : $body,
]
);
return $this->processResourceRequestResponse($reques... | charge returning transaction.
@param $body
@return \Exception|mixed | entailment |
public function chargeToken($body)
{
$request = $this->paystackHttpClient->post(
Resource::CHARGE_TOKEN,
[
'body' => is_array($body) ? $this->toJson($body) : $body,
]
);
return $this->processResourceRequestResponse($request);
} | Charge Token.
@param $body
@return \Exception|mixed | entailment |
public function getCategories()
{
// Set method and action
$method = 'import';
$action = 'getSupplierCategories';
// Set data
$data = array();
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result;... | [RO] Returneaza toate categoriile (https://github.com/celdotro/marketplace/wiki/Listeaza-categorii)
[EN] Get all categories (https://github.com/celdotro/marketplace/wiki/List-categories)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function listProducts($start, $limit, $search = null, $forceCount = false, $filters = null, $includeTransport = null, $orderByMostViewed = false){
// Sanity check
if(!isset($start) || !is_int($start) || $start < 0) throw new \Exception('Precizati o valoare de start numar natural');
if(!is... | [RO] Listeaza produsele. Lista este scurtata folosind o valoare de start si o limita. De asemenea, produsele pot fi filtrate. (https://github.com/celdotro/marketplace/wiki/Listeaza-produse)
[EN] Lists products. The list is shrunk using a start and limit value. Also, the products can be filtered. (https://github.com/cel... | entailment |
public function getCategoryCharacteristics($categID){
// Sanity check
if(!isset($categID) || !is_int($categID) || $categID < 0) throw new \Exception('Specificati o categorie valida');
$method = 'products';
$action = 'getCategoryCharacteristics';
// Set data
$data = arra... | [RO] Listeaza caracteristicile unei categorii (https://github.com/celdotro/marketplace/wiki/Listeaza-caracteristicile-unei-categorii)
[EN] Lists the characteristics of a category (https://github.com/celdotro/marketplace/wiki/List-characteristics-of-a-category)
@param $categID
@return mixed
@throws \GuzzleHttp\Exception... | entailment |
public function listFilters($filters = null){
$method = 'products';
$action = 'listFilters';
// Set data
$data = array('filters' => $filters);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result;
} | [RO] Listeaza filtrele disponibile si datele acestora dupa ce au fost corelate (https://github.com/celdotro/marketplace/wiki/Listeaza-filtre )
[EN] List available filters after correlation (https://github.com/celdotro/marketplace/wiki/List-filters)
@param null $filters
@return mixed
@throws \GuzzleHttp\Exception\Guzzle... | entailment |
public function getLiveProductsFromCategory($category, $keyword = null, $start = null, $limit = null){
// Sanity check
if(!isset($category) || !is_int($category) || $category < 0) throw new \Exception('Specificati o categorie valida');
$method = 'products';
$action = 'getLiveProductsFro... | [RO] Listeaza produsele live dintr-o categorie precizata prin parametru (https://github.com/celdotro/marketplace/wiki/Preluare-produse-live-din-categorie)
[EN] List all live products from a category (https://github.com/celdotro/marketplace/wiki/Retrieve-live-products-from-category)
@param $category
@param null $keyword... | entailment |
public function getLiveProductsCategory(){
$method = 'products';
$action = 'getLiveProductsCategory';
// Set data
$data = array('dummy' => true);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $re... | [RO] Preia produsele live pe categorii (https://github.com/celdotro/marketplace/wiki/Preia-produsele-live-pe-categorii)
[EN] Get live products for each category (https://github.com/celdotro/marketplace/wiki/Get-live-products-categories)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function exportProducts(){
$method = 'products';
$action = 'exportProducts';
// Set data
$data = array('dummy' => true);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result;
} | [RO] Exporta lista de produse in format xlsx (https://github.com/celdotro/marketplace/wiki/Export-produse)
[EN] Export products in xlsx format (https://github.com/celdotro/marketplace/wiki/Export-products)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getProductsFamilies($start, $limit, $search){
$method = 'products';
$action = 'getProductsFamilies';
// Set data
$data = array(
'start' => $start,
'limit' => $limit,
);
if(!empty($search)) $data['search'] = $search;
// Se... | [RO] Listeaza familiile de produse (https://github.com/celdotro/marketplace/wiki/Listeaza-familiile-de-produse)
[EN] List product families (https://github.com/celdotro/marketplace/wiki/List-product-families)
@param $start
@param $limit
@param $search
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getProductsForFamily($id){
$method = 'products';
$action = 'getProductsForFamily';
// Set data
$data = array(
'id' => $id
);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $r... | [RO] Preia datele produselor dintr-o familie (https://github.com/celdotro/marketplace/wiki/Preia-produse-din-familie)
[EN] Get product's data for the products that belong to a family (https://github.com/celdotro/marketplace/wiki/Get-product-from-family)
@param $id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleExcep... | entailment |
public function getManufacturerID($name){
$method = 'products';
$action = 'getManufacturerID';
// Set data
$data = array(
'name' => $name
);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $r... | [RO] Preia ID-ul unui producator (https://github.com/celdotro/marketplace/wiki/Preia-ID-producator)
[EN] Retrieve manufacturer's ID (https://github.com/celdotro/marketplace/wiki/Get-manufacturer-ID)
@param $name
@return mixed
@throws \Exception | entailment |
public function getWaitingProducts($start){
// Sanity check
if(!isset($start) || !is_int($start) || $start < 0) throw new \Exception('Precizati o valoare de start numar natural');
// Set method and action
$method = 'products';
$action = 'getWaitingProducts';
// Set data... | [RO] Preia lista produselor aflate in asteptare (https://github.com/celdotro/marketplace/wiki/Preia-produse-in-asteptare)
[EN] Get waiting products list (https://github.com/celdotro/marketplace/wiki/Get-waiting-products)
@param $start
@return mixed
@throws \Exception | entailment |
public function safeUp()
{
$providersTable = $this->dbConnection->schema->getTable('{{oauth_providers}}');
if ($providersTable)
{
if($this->renameColumn('{{oauth_providers}}', 'providerClass', 'class')) {
OauthPlugin::log('Renamed `{{oauth_providers}}`.`providerC... | Any migration code in here is wrapped inside of a transaction.
@return bool | entailment |
public function createProvider()
{
if($this->providerInfos->clientId && $this->providerInfos->clientSecret)
{
$config = [
'identifier' => $this->providerInfos->clientId,
'secret' => $this->providerInfos->clientSecret,
'callback_uri' => $thi... | Create Twitter Provider
@return Twitter | entailment |
public function cancelOrder($cmd, $motiv = 0, $observatii = ''){
// Sanity check
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
// Set method and action
$method = 'orders';
$action = 'cancelOrder';
// Set data
$data = array('order... | [RO] Anuleaza o anumita comanda. Un motiv valid e necesar. (https://github.com/celdotro/marketplace/wiki/Anularea-comenzii)
[EN] Cancel a specific order. A valid reason is necessary. (https://github.com/celdotro/marketplace/wiki/Cancel-Order)
@param $cmd
@param int $motiv
@param string $observatii
@return mixed
@throws... | entailment |
public function confirmOrder($cmd){
// Sanity check
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
// Set method and action
$method = 'orders';
$action = 'confirmOrder';
// Set data
$data = array('order' => $cmd);
// Send... | [RO] Confirma o comanda existenta (https://github.com/celdotro/marketplace/wiki/Confirmare-comanda)
[EN] Confirms an existing order (https://github.com/celdotro/marketplace/wiki/Confirm-order)
@param $cmd
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function listCancellingStatuses(){
// Set method and action
$method = 'orders';
$action = 'listCancellingStatuses';
// Set data
$data = array('dummy' => true);
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
... | [RO] Listeaza statusurile ce pot fi folosite pentru anularea unei comenzi (https://github.com/celdotro/marketplace/wiki/Listare-statusuri-anulare)
[EN] Lists the statuses that can be used for cancelling an order (https://github.com/celdotro/marketplace/wiki/List-order-cancelling-statuses)
@return mixed
@throws \GuzzleH... | entailment |
public function getOrderStatusList(){
// Set method and action
$method = 'orders';
$action = 'getOrderStatusList';
// Set data
$data = array();
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data);
return $result;
... | [RO] Preluare lista de statusuri ale comenzilor (https://github.com/celdotro/marketplace/wiki/Preluare-lista-de-statusuri-pentru-comenzi)
[EN] Retrieves the list of statuses for orders (https://github.com/celdotro/marketplace/wiki/Get-status-list-for-orders)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function stornareComanda($orders_id, $reason){
// Sanity check
if(empty($orders_id) || !is_int($orders_id)) throw new \Exception('Specificati comanda');
if(empty($reason)) throw new \Exception('Specificati motivul');
// Set method and action
$method = 'orders';
$a... | [RO] Storneaza comanda (https://github.com/celdotro/marketplace/wiki/Stornare-comanda)
[EN] Order cancellation (https://github.com/celdotro/marketplace/wiki/Order-cancellation)
@param $orders_id
@param $reason
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function finishOrder($orders_id){
// Sanity check
if(!isset($orders_id) || !is_int($orders_id)) throw new \Exception('Specificati comanda');
// Set method and action
$method = 'orders';
$action = 'finishOrder';
// Set data
$data = array('orders_id' => $or... | [RO] Finalizeaza o comanda (https://github.com/celdotro/marketplace/wiki/Finalizeaza-comanda)
[EN] Finishes an order (https://github.com/celdotro/marketplace/wiki/Finish-order)
@param $orders_id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function processResourceRequestResponse(ResponseInterface $request)
{
$response = json_decode($request->getBody()->getContents());
if (Response::HTTP_OK !== $request->getStatusCode() && Response::HTTP_CREATED !== $request->getStatusCode()) {
return ExceptionHandler::handle(get_cl... | Checks request response and dispatch result to appropriate handler.
@param ResponseInterface $request
@return \Exception|mixed | entailment |
public function setType($type)
{
/**
* Thoses WordType::__MIN and WordType::__MAX values are
* only used to check if given type is okay according to
* what we have in WordType.
*
* @see src/Client/Api/Enum/WordType.php
*/
if (!($type >= WordType:... | Set type of word you gonna translate.
Returns false if type is incorrect.
@param $type
@return $this
@throws InvalidWordTypeException | entailment |
public function setInputType(string $inputType): self
{
$this->inputType = $inputType;
$this->validate();
return $this;
} | @param string $inputType
@return FilterInput | entailment |
public function updateProductsFromOrder($cmd, $arrProducts){
// Sanity check
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
if(!isset($arrProducts) || !is_array($arrProducts) || empty($arrProducts)) throw new \Exception('$arrProducts trebuie sa fie un array care s... | [RO] Actualizeaza produsele pentru o comanda (https://github.com/celdotro/marketplace/wiki/Actualizare-comenzi)
[EN] Update the products of an order (https://github.com/celdotro/marketplace/wiki/Update-orders)
@param $cmd
@param $arrProducts
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function importInvoice($cmd, $serie, $nr_fact){
// Sanity check
if(empty($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
if(empty($serie)) throw new \Exception('Specificati seria facturii');
if(empty($nr_fact)) throw new \Exception('Specificati numarul factur... | [RO] Permite importul unei facturi (https://github.com/celdotro/marketplace/wiki/Import-factura)
[EN] Imports a new invoice (https://github.com/celdotro/marketplace/wiki/Import-Invoice)
@param $cmd
@param $serie
@param $nr_fact
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function changeOrderProductStatus($orders_products_id, $status){
// Sanity check
if(empty($orders_products_id)) throw new \Exception('Specificati ID-ul produsului');
if(!isset($status)) throw new \Exception('Specificati statusul produsului');
// Set method and action
$met... | [RO] Schimba statusul unui produs dintr-o comanda (https://github.com/celdotro/marketplace/wiki/Schimba-statusul-unui-produs-din-comanda)
[EN] Changes the status of a product from a specific order (https://github.com/celdotro/marketplace/wiki/Change-order-product-status)
@param $orders_products_id
@param $status
@retur... | entailment |
public function changeOrderPaymentMethod($order, $paymentMethod){
// Sanity check
if(empty($order)) throw new \Exception('Comanda invalida');
if(empty($paymentMethod)) throw new \Exception('Mod de plata invalid');
// Set method and action
$method = 'orders';
$action = 'C... | [RO] Schimba modul de plata al unei comenzi (https://github.com/celdotro/marketplace/wiki/Schimba-modul-de-plata-al-unei-comenzi)
[EN] Change an order's payment method (https://github.com/celdotro/marketplace/wiki/Change-order-payment-method)
@param $order
@param $paymentMethod
@return mixed
@throws \GuzzleHttp\Excepti... | entailment |
public function returProduct($orderId, $reason, $model){
// Sanity check
if(empty($orderId)) throw new \Exception('Comanda invalida');
if(empty($reason)) throw new \Exception('Motiv invalid');
if(empty($model)) throw new \Exception('Model invalid');
// Set method and action
... | [RO] Marcheaza un produs pentru retur (https://github.com/celdotro/marketplace/wiki/Retur-produs)
[EN] Marks a product for return (https://github.com/celdotro/marketplace/wiki/Product-return)
@param $orderId
@param $reason
@param $model
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function addWeightToOrder($orders_id, $weight){
// Sanity check
if(empty($orders_id)) throw new \Exception('Comanda invalida');
// Set method and action
$method = 'orders';
$action = 'addWeightToOrder';
// Set data
$data = array(
'orders_id' =... | [RO] Permite actualizarea greutatii comenzii (https://github.com/celdotro/marketplace/wiki/Adaugare-greutate)
[EN] Add weight to order (https://github.com/celdotro/marketplace/wiki/Add-weight)
@param $orders_id
@param $weight
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function changeFinishingDate($orders_id, $date){
// Sanity check
if(empty($orders_id)) throw new \Exception('Comanda invalida');
// Set method and action
$method = 'orders';
$action = 'changeFinishingDate';
// Set data
$data = array(
'orders_i... | [RO] Inregistreaza o data personalizata a finalizarii comenzii (https://github.com/celdotro/marketplace/wiki/Schimba-data-finalizarii)
[EN] Submits a custom date for order finishing (https://github.com/celdotro/marketplace/wiki/Change-finishing-date)
@param $orders_id
@param $date
@return mixed
@throws \Exception | entailment |
private function processMethod($method, array $options, array $headers, array $body = [])
{
if ($method === 'get') {
if ($body !== []) {
throw new \Exception('Issuing a GET request with a body');
}
$options[CURLOPT_HTTPGET] = 1;
} elseif ($method =... | Setup behavior for each methods
@param string $method
@param array $options
@param array $headers
@param array $body
@return [$options, $headers]
@throws \Exception | entailment |
private function shouldRetry($errno, $rcode, $numRetries)
{
// Don't make too much retries
if ($numRetries >= $this->getMaxNetworkRetries()) {
return false;
}
// Retry on timeout-related problems (either on open or read).
$timeoutRelated = ($errno === CURLE_OPERA... | Checks if an error is a problem that we should retry on. This includes both
socket errors that may represent an intermittent problem and some special
HTTP statuses.
@param int $errno
@param int $rcode
@param int $numRetries
@return bool | entailment |
public function setSource($source)
{
$crawler = $this->getCrawler();
if (!is_null($crawler) && $crawler instanceof Crawler) {
throw new ParserContextException('It is not allowed to update source when crawler is active.');
}
$this->source = $source;
return $this;... | @param string $source
@return $this
@throws ParserContextException | entailment |
public function setTranslateEntry(TranslateEntry $translateEntry)
{
if (is_null($this->translateEntry)) {
throw new ParserContextException('TranslateEntry should be generated through `generateTranslateEntry()` function first.');
}
$this->translateEntry = $translateEntry;
... | @param TranslateEntry $translateEntry
@return $this
@throws ParserContextException | entailment |
public function generateTranslateEntry()
{
if (is_null($this->getCrawler())) {
throw new ParserContextException('You can\'t generate translate entry without having a crawler initialized.');
}
$parameters = [
'language_from' => $this->getLanguageFrom(),
'l... | @return TranslateEntry
@throws ParserContextException
@throws MissingRequiredParamException | entailment |
public function addWord($text, callable $callback, $textType = WordType::TEXT)
{
$inputWords = $this->getTranslateEntry()->getInputWords();
$index = count($inputWords);
$inputWords->addOne(new WordEntry($text, $textType));
$this->addToTranslateMap($index, $callback);
} | @param string $text
@param callable $callback
@param int $textType
@throws InvalidWordTypeException | entailment |
public function getValidationErrors()
{
$errors = [];
if (isset($this->response->errors)) {
foreach ($this->response->errors as $error => $reasons) {
$errors[] = [
'attribute' => $error,
'reason' => $this->getValidationReasonsAsS... | Get validation errors that occurred in requests.
@return array | entailment |
public function getPages(){
// Set method and action
$method = 'settings';
$action = 'getPages';
// Set data
$data = array(array(1)); // At least one parameter is required by API
// Send request and retrieve response
$result = Dispatcher::send($method, $action, ... | [RO] Returneaza toate paginile (https://github.com/celdotro/marketplace/wiki/Listare-Pagini)
[EN] Get all pages (https://github.com/celdotro/marketplace/wiki/List-pages)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function readCampaign($name, $products, $availableProducts){
// Sanity check
if(!isset($name) || $name == '') throw new \Exception('Specificati numele campaniei');
if(!isset($products)) throw new \Exception('Specificati produsele');
if(!isset($availableProducts)) throw new \Except... | [RO] Returneaza informatii referitoare la o campanie, produsele din ea filtrate in functie de nume, precum si alte produse disponibile care pot, de asemenea, sa fie filtrate in functie de nume (https://github.com/celdotro/marketplace/wiki/Citire-campanie)
[EN] Provides information about a campaign, its products that ca... | entailment |
public function listActiveCampaigns($start, $limit, $dateFrom = NULL, $dateTo = NULL, $search = NULL){
// Sanity check
if(!isset($start) || $start === '' || !is_int($start))
throw new \Exception('Specificati valoarea de start');
if(!isset($limit) || $limit === '' || !is_int($limit))
... | [RO] Listeaza toate campaniile active. Datele pot fi filtrate in functie de data de inceput, data de sfarsit si numele campaniei (https://github.com/celdotro/marketplace/wiki/Listare-campanii-active)
[EN] Lists all active campaigns. Data can be filtered by start date, end date, and campaign name. (https://github.com/ce... | entailment |
public function getCouponCampaign($id){
// Sanity check
if(empty($id)) throw new \Exception('Specificati un ID valid');
// Set method and action
$method = 'coupons';
$action = 'getCouponsCampaignData';
$send = array(
'campaignId' => $id
);
/... | [RO] Datele aferente unei campanii de cupoane (https://github.com/celdotro/marketplace/wiki/Date-campanie-cupoane)
[EN] Get coupon campaign data (https://github.com/celdotro/marketplace/wiki/Coupon-Campaign-Data)
@param $id
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function checkCouponUsage($campaignId, $couponId){
// Sanity check
if(empty($campaignId)) throw new \Exception('Specificati un ID de campanie valid');
if(is_null($couponId)) throw new \Exception('Specificati un ID de cupon valid');
// Set method and action
$method = 'coup... | [RO] Verifica utilizarea cuponului (https://github.com/celdotro/marketplace/wiki/Verifica-utilizarea-cuponului)
[EN] Check coupon's usage (https://github.com/celdotro/marketplace/wiki/Check-coupon-usage)
@param $campaignId
@param $couponId
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getCouponData($couponId){
// Sanity check
if(is_null($couponId)) throw new \Exception('Specificati un ID de cupon valid');
// Set method and action
$method = 'coupons';
$action = 'getCouponData';
$send = array(
'couponId' => $couponId
... | [RO] Preia date cupon (https://github.com/celdotro/marketplace/wiki/Date-cupon)
[EN] Get coupon data (https://github.com/celdotro/marketplace/wiki/Coupon-data)
@param $couponId
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public static function data()
{
return [
'sq' => [
'code' => 'sq',
'english' => 'Albanian',
'local' => 'Shqip',
'rtl' => false,
],
'en' => [
'code' => 'en',
'english' => 'Eng... | Only used to replace API endpoint
We planned to make this endpoint available soon !
@return array | entailment |
public static function send($method, $action, $data, $files = null, $retryResponse = null)
{
### 0. Check fail count ###
if (!isset(self::$failCount) || is_null(self::$failCount)) {
self::$failCount = 0;
}
if (is_null(self::$provider)) {
throw new \Ex... | Send data to API and retrieve response
0. Check fail count
1. Validate method and action, and build URL based on these
2. Authenticate user
3. Uses dispatcher's guzzleClient object and makes a POST request to the API server
4. Process the response in order to throw relevant error messages or return the correctly formed... | entailment |
public static function getGuzzleClient()
{
if (!isset(self::$guzzleClient) || is_null(self::$guzzleClient)) {
self::$guzzleClient = new Client(array('timeout' => Config::TIMEOUT, 'connection_timeout' => Config::CONN_TIMEOUT, 'verify' => Config::$IS_LIVE));
}
return self::$guzzle... | Enforces the use of a single connection
@return Client|null | entailment |
public function deletePage($pageID){
// Sanity check
if(!isset($pageID) || !is_int($pageID)) throw new \Exception('ID-ul trebuie sa fie un numar intreg');
// Set method and action
$method = 'settings';
$action = 'deletePage';
// Set data
$data = array('id' => $p... | [RO] Sterge paginile pe baza ID-ului (https://github.com/celdotro/marketplace/wiki/Stergere-pagini)
[EN] Delete page based on ID (https://github.com/celdotro/marketplace/wiki/Remove-page)
@param $pageID
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function actionProviderTokens(array $variables = [])
{
$variables['provider'] = craft()->oauth->getProvider($variables['handle']);
if($variables['provider'])
{
$this->renderTemplate('oauth/providers/_tokens', $variables);
}
else
{
throw... | Provider Tokens
@return null | entailment |
public function actionDeleteToken(array $variables = array())
{
$this->requirePostRequest();
$id = craft()->request->getRequiredPost('id');
$token = craft()->oauth->getTokenById($id);
if (craft()->oauth->deleteToken($token))
{
if (craft()->request->isAjaxReques... | Delete token.
@return null | entailment |
public function offsetSet($offset, $value)
{
if (isset($this->collection[$offset]) && $value instanceof AbstractCollectionEntry) {
$this->collection[$offset] = $value;
}
} | {@inheritdoc} | entailment |
public function get($id)
{
$request = $this->paystackHttpClient->get(
$this->transformUrl(Resource::CUSTOMERS_URL, $id)
);
return $this->processResourceRequestResponse($request);
} | Get customer by customer code/id.
@param $id
@return \Exception|mixed | entailment |
public function getAll($page = null)
{
$page = !empty($page) ? "page={$page}" : '';
$request = $this->paystackHttpClient->get(
$this->transformUrl(Resource::CUSTOMERS_URL, '').$page
);
return $this->processResourceRequestResponse($request);
} | Get all customer. per page.
@param null $page
@return \Exception|mixed | entailment |
public function save($body)
{
$request = $this->paystackHttpClient->post(
$this->transformUrl(Resource::CUSTOMERS_URL, ''),
[
'body' => is_array($body) ? $this->toJson($body) : $body,
]
);
return $this->processResourceRequestResponse($req... | create new customer.
@param $body
@return \Exception|mixed | entailment |
public function update($id, $body)
{
$request = $this->paystackHttpClient->put(
$this->transformUrl(Resource::CUSTOMERS_URL, $id),
[
'body' => is_array($body) ? $this->toJson($body) : $body,
]
);
return $this->processResourceRequestRespon... | update customer.
@param $id
@param $body
@return \Exception|mixed | entailment |
public function parseJsonString(string $jsonString, string $entityClassName, array $sortColumns = null): ParsedRuleGroup
{
$doctrineParser = $this->newParser($entityClassName);
return $doctrineParser->parse($this->jsonDeserializer->deserialize($jsonString), $sortColumns);
} | @param string $jsonString
@param string $entityClassName
@param array|null $sortColumns
@return ParsedRuleGroup | entailment |
private function newParser(string $className)
{
if (!array_key_exists($className, $this->classNameToDoctrineParser)) {
throw new \DomainException(sprintf(
'You have requested a Doctrine Parser for %s, but you have not defined a mapping for it in your configuration',
... | @param string $className
@return DoctrineParser
@throws \DomainException | entailment |
public function getBillableProducts(){
// Set method and action
$method = 'admininfo';
$action = 'GetBillableProducts';
// Set data
$data = array('param' => 1);
$result = Dispatcher::send($method, $action, $data);
return $result;
} | [RO] Listeaza produsele facturabile (https://github.com/celdotro/marketplace/wiki/Listeaza-produsele-facturabile)
[EN] List all products that can be billed (https://github.com/celdotro/marketplace/wiki/List-billable-products)
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function billProducts($products){
// Set method and action
$method = 'admininfo';
$action = 'BillProducts';
// Set data
$data = array('products' => $products);
$result = Dispatcher::send($method, $action, $data);
return $result;
} | [RO] Factureaza produsele disponibile (https://github.com/celdotro/marketplace/wiki/Factureaza-produse)
[EN] Bills available products (https://github.com/celdotro/marketplace/wiki/Bill-products)
@param $products
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException | entailment |
public function getServiceRequests($type, $page = 1){
// Set method and action
$method = 'admininfo';
$action = 'GetServiceRequests';
// Set data
$data = array('type' => $type, 'page' => $page);
$result = Dispatcher::send($method, $action, $data);
return $resul... | [RO] Preia cererile de service sau retur ale clientilor (https://github.com/celdotro/marketplace/wiki/Preia-cererile-de-service)
[EN] Retrieve service or return requests (https://github.com/celdotro/marketplace/wiki/Retrieve-service-requests)
@param $type
@param int $page
@return mixed | entailment |
public function createProvider()
{
$config = [
'clientId' => $this->providerInfos->clientId,
'clientSecret' => $this->providerInfos->clientSecret,
'redirectUri' => $this->getRedirectUri(),
];
return new \AdamPaterson\OAuth2\Client\Provider\Slack($config);... | Create Provider | entailment |
public function createSubscriber(Oauth_TokenModel $token)
{
$infos = $this->getInfos();
return new \Dukt\OAuth\Guzzle\Subscribers\Slack([
'access_token' => $token->accessToken,
]);
} | Create Subscriber | entailment |
public function getPlan($planCode)
{
$plan = $this->planResource->get($planCode);
if ($plan instanceof \Exception) {
throw $plan;
}
$this->setDeletable(true);
return $this->_setAttributes($plan);
} | Get plan by plan code.
@param $planCode
@throws
@throws \Exception
@return $this | entailment |
public function make($name, $description, $amount, $currency, array $otherAttributes = [])
{
$this->name = $name;
$this->description = $description;
$this->amount = $amount;
$this->currency = $currency;
$this->_setAttributes($otherAttributes);
$this->setCreatable(tru... | Create new Plan Object.
@param $name
@param $description
@param $amount
@param $currency
@param array $otherAttributes
@return $this | entailment |
public function save()
{
$resourceResponse = null;
if ($this->isCreatable() && !$this->isUpdateable()) { //available for creation
$resourceResponse = $this->planResource->save($this->transform(ModelInterface::TRANSFORM_TO_JSON_ARRAY));
}
if ($this->isUpdateable() && !$t... | Save/Update plan object.
@throws \Exception
@throws \Exception|mixed
@throws null
@return $this|Plan | entailment |
public function transform($transformMode = '')
{
$planObject = [
'plan_code' => $this->plan_code,
'name' => $this->name,
'description' => $this->description,
'amount' => $this->amount,
'interval' ... | Outward presentation of object.
@param $transformMode
@return mixed | entailment |
public static function make($authorization, $amount, $email, $plan)
{
return new static(
self::generateTransactionRef(),
$authorization,
$amount,
$email,
$plan
);
} | Create a new returning transaction object.
@param $authorization
@param $amount
@param $email
@param $plan
@return static | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.