sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function charge() { return !is_null($this->transactionRef) ? $this->getTransactionResource()->chargeAuthorization($this->_requestPayload()) : new PaystackInvalidTransactionException( json_decode( json_encode( [ ...
Charge returning transaction. @return \Exception|mixed|PaystackInvalidTransactionException
entailment
public function _requestPayload() { $payload = [ 'authorization_code' => $this->authorization, 'amount' => $this->amount, 'reference' => $this->transactionRef, 'email' => $this->email, ]; if (!empt...
Get returning transaction request body. @return string
entailment
private function filtersDefaultOperators(array $filters): array { foreach ($filters as $key => $filter) { // give the filter default operators, according to its type if ( (!array_key_exists('operators', $filter)) || (empty($filter['operators'])) ...
@param array $filters @return array
entailment
private function filtersOverrides(array $filters, string $builderId): array { foreach ($filters as $key => $filter) { $filterId = $filter['id']; $filterValueCollection = new FilterValueCollection(); $filterInput = new FilterInput(FilterInput::INPUT_TYPE_TEXT); ...
@param array $filters @param string $builderId @return array @throws \LogicException
entailment
private function filtersBooleanOverride(array $filters): array { foreach ($filters as $key => $filter) { $builderType = $filter['type']; switch ($builderType) { case 'boolean': $filter['values'] = [ 1 => 'Yes', ...
@param array $filters @return array
entailment
private function filtersDateOverrides(array $filters): array { foreach ($filters as $key => $filter) { $builderType = $filter['type']; switch ($builderType) { case 'date': $filter['validation'] = [ 'format' => 'YYYY/MM/DD',...
Use with @link https://eonasdan.github.io/bootstrap-datetimepicker/ Also make sure to account for @link https://github.com/mistic100/jQuery-QueryBuilder/issues/176. @param array $filters @return array
entailment
private function filtersOverrideValues(array $filters): array { foreach ($filters as $key => $filter) { // Php converts an array such as ["0" => "red", "1" => "green"] into [0 => "red", 1 => "green"] // Thus the json_encoding would be ["red", "green"] instead of {"0" : "red", "1" : "...
@param array $filters @return array
entailment
private function validateValueCollectionAgainstInput(FilterValueCollection $collection, FilterInput $input, string $filterId, string $builderId) { if ( in_array($input->getInputType(), FilterInput::INPUT_TYPES_REQUIRE_NO_VALUES) && 0 !== $collection->getFilterValues()->count() ...
@param FilterValueCollection $collection @param FilterInput $input @param string $filterId @param string $builderId @throws \LogicException
entailment
public function getBuilderById(string $builderId) { if (array_key_exists($builderId, $this->builders)) { return $this->builders[$builderId]; } return; }
@param string $builderId @return Builder|null
entailment
public static function getRealToken(Oauth_TokenModel $token) { $provider = craft()->oauth->getProvider($token->providerHandle); if($provider) { switch($provider->getOauthVersion()) { case 1: return $provider->createAccessToken([ ...
Get real token
entailment
public static function realTokenToArray($token) { $class = get_class($token); $tokenArray = array( 'class' => $class, // 'extraParams' => $token->getExtraParams(), ); if(get_class($token) === 'League\OAuth1\Client\Credentials\TokenCredentials' || is_subclas...
Real token to array
entailment
public function getProductEmails($product_model){ // Set method and action $method = 'email'; $action = 'GetProductEmails'; // Set data if(empty($product_model)) $data = array(); else $data = array('product_model' => $product_model); $result = Dispatcher::send($...
[RO] Preia email-urile fara raspuns despre produse (https://github.com/celdotro/marketplace/wiki/Preia-email-urile-despre-produse) [EN] Retrieve all unanswered emails about products (https://github.com/celdotro/marketplace/wiki/Retrieve-products-emails) @param $product_model @return mixed @throws \GuzzleHttp\Exception\...
entailment
public function answerProductEmail($questionID, $answer){ // Sanity check if(empty($questionID)) throw new \Exception('Specificati un ID valid al intrebarii'); if(empty($answer) || strlen(trim($answer)) < 10) throw new \Exception('Specificati un raspuns valid mai mare de 10 caractere diferite de...
[RO] Trimite un raspuns catre email-ul unui client referitor la un anumit produs (https://github.com/celdotro/marketplace/wiki/Raspunde-email-ului-unui-produs) [EN] Answer a specific email for a product (https://github.com/celdotro/marketplace/wiki/Answer-a-specific-email-for-a-product) @param $questionID @param $answe...
entailment
public function getServiceRequests($minDate = null, $maxDate = null, $product_model = null, $start = null){ // Set method and action $method = 'email'; $action = 'GetServiceRequests'; // Set data $data = array('dummy' => 1); if (!is_null($minDate)) $data['minDate'] = $mi...
[RO] Preia cererile de service aferente afiliatului (https://github.com/celdotro/marketplace/wiki/Preia-cererile-de-retur) [EN] Get service requests for the current affiliate (https://github.com/celdotro/marketplace/wiki/Get-return-requests) @param null $minDate @param null $maxDate @param null $product_model @param nu...
entailment
public function answerServiceRequest($id, $answer, $images = null){ // Set method and action $method = 'email'; $action = 'AnswerServiceRequest'; // Set data $data = array( 'id' => $id, 'answer' => $answer ); $result = Dispatcher::send($m...
[RO] Raspunde unei cereri de service (https://github.com/celdotro/marketplace/wiki/Raspunde-unei-cereri-de-service) [EN] Send an answer to a service request (https://github.com/celdotro/marketplace/wiki/Answer-service-request) @param $id @param $answer @param null $images @return mixed @throws \GuzzleHttp\Exception\Guz...
entailment
public function getOrderContact($orders_id){ // Set method and action $method = 'email'; $action = 'GetOrderContact'; // Set data $data = array('orders_id' => $orders_id); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia intrebarile despre o comanda (https://github.com/celdotro/marketplace/wiki/Preia-intrebari-comanda) [EN] Get order's questions (https://github.com/celdotro/marketplace/wiki/Get-order-questions) @param $orders_id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function answerOrderContact($id, $answer){ // Set method and action $method = 'email'; $action = 'AnswerOrderContact'; // Set data $data = array( 'id' => $id, 'answer' => $answer ); $result = Dispatcher::send($method, $action, $dat...
[RO] Trimite raspuns unei intrebari aferenta comenzii (https://github.com/celdotro/marketplace/wiki/Raspunde-intrebarii-comenzii) [EN] Give an answer to an order's question (https://github.com/celdotro/marketplace/wiki/Answer-order-question) @param $id @param $answer @return mixed @throws \GuzzleHttp\Exception\GuzzleEx...
entailment
public function getServiceRequest($uniqueID){ // Set method and action $method = 'email'; $action = 'GetServiceRequest'; // Set data $data = array('uniqueID' => $uniqueID); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia datele unei cereri de service (https://github.com/celdotro/marketplace/wiki/Preia-cerere-service) [EN] Get the data of a service request (https://github.com/celdotro/marketplace/wiki/Get-service-request) @param $uniqueID @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getReturnRequest($uniqueID){ // Set method and action $method = 'email'; $action = 'GetReturnRequest'; // Set data $data = array('uniqueID' => $uniqueID); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia datele unei cereri de retur (https://github.com/celdotro/marketplace/wiki/Preia-cerere-retur) [EN] Get the data of a return request (https://github.com/celdotro/marketplace/wiki/Get-return-request) @param $uniqueID @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function get($attributes) { //get function args $argsAsArray = func_get_args(); //is attributes passed as args is an array and count greater than 1 if (!is_array($attributes) && count($argsAsArray) > 1) { //recalls itself to get attributes as array retu...
Get specific model attribute(s) Accepts array of attributes, comma separated attributes or individual attribute. @param $attributes @return mixed
entailment
public function _setAttributes($attributes) { if (is_array($attributes)) { foreach ($attributes as $attribute => $value) { $this->{$attribute} = $value; } return $this; } //@todo: put real exception here cos exception' gon be thrown eithe...
Set attributes of the model. @param $attributes @throws \Exception @return $this
entailment
public function transform($transformMode = '') { switch ($transformMode) { case ModelInterface::TRANSFORM_TO_JSON_ARRAY: return json_encode($this->objectToArray($this)); default: return $this->objectToArray($this); } }
get Outward presentation of object. @param $transformMode @return mixed
entailment
public function isTranslable() { if ($this->getPath() === null) { $this->detectUrlDetails(); } foreach ($this->config->getExcludedUrls() as $regex) { $escapedRegex = Text::escapeForRegex(Text::fullTrim($regex)); $fullRegex = sprintf('/%s/', $escapedRegex)...
Check if we need to translate given URL @return bool
entailment
public function detectCurrentLanguage() { // parsing url to get only path & removing prefix if there is one $escapedPathPrefix = Text::escapeForRegex($this->config->getPathPrefix()); $uriPath = parse_url($this->config->getRaw(), PHP_URL_PATH); $uriPath = preg_replace('/^' . $escapedP...
Check current locale, based on URI segments from the given URL @return mixed
entailment
public function detectUrlDetails() { $escapedPathPrefix = Text::escapeForRegex($this->config->getPathPrefix()); $languages = implode('|', $this->translate->getLanguages()); $fullUrl = preg_replace('#' . $escapedPathPrefix . '\/(' . $languages . ')$#i', '', $this->getUrl()); $fullUrl...
Generate possible host & base URL then store it into internal variables @return string Host + path prefix + base URL
entailment
public function currentRequestAllUrls() { $urls = $this->allUrls; if ($urls === null) { if ($this->getPath() === null) { $this->detectUrlDetails(); } $urls = []; $current = $this->getHost() . $this->config->getPathPrefix() . $this->ge...
Returns array with all possible URL for current Request @return array
entailment
public function generateHrefLangsTags() { $render = ''; $urls = $this->currentRequestAllUrls(); foreach ($urls as $language => $url) { $render .= '<link rel="alternate" href="' .$url. '" hreflang="' .$language. '"/>'."\n"; } return $render; }
Render hreflang links for SEO @return string
entailment
public function addAddress($address = null, $id_curier = null, $accData = array()){ // Sanity check if(is_null($address) || $address === '') throw new \Exception('Specificati o adresa valida'); // Set method and action $method = 'admininfo'; $action = 'editAddress'; // ...
[RO] Adauga o adresa pentru ridicarea coletelor de catre curieri (https://github.com/celdotro/marketplace_examples/blob/master/Admin/4.addAddress.php) [EN] Adds a new pick-up address that will be sent to couriers (https://github.com/celdotro/marketplace_examples/blob/master/Admin/4.addAddress.php) @param null $address ...
entailment
public function editAddress($id = null, $address = null, $courier){ // Sanity check if(is_null($address) || $address === '') throw new \Exception('Specificati o adresa valida'); if(is_null($id) || !is_numeric($id)) throw new \Exception('Specificati un ID valid'); // Set method and actio...
[RO] Actualizeaza adresa unui punct de ridicare pentru curieri (https://github.com/celdotro/marketplace_examples/blob/master/Admin/5.editAddress.php) [EN] Updates address information of a pick-up point (https://github.com/celdotro/marketplace_examples/blob/master/Admin/5.editAddress.php) @param null $id @param null $ad...
entailment
public function listAddresses(){ // Set method and action $method = 'admininfo'; $action = 'listAddresses'; // Set data $data = array('param' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $resul...
[RO] Listeaza toate adresele punctelor de ridicare pentru curieri (https://github.com/celdotro/marketplace_examples/blob/master/Admin/6.listAddresses.php) [EN] Lists all pick-up points addresses (https://github.com/celdotro/marketplace_examples/blob/master/Admin/6.listAddresses.php) @return mixed @throws \GuzzleHttp\Ex...
entailment
public function deleteAddress($id = null, $address = null){ // Sanity check if(is_null($id) || !is_numeric($id)) throw new \Exception('Specificati un ID valid'); // Set method and action $method = 'admininfo'; $action = 'deleteAddress'; // Set data $data = array...
[RO] Stergerea adresei unui punct de ridicare pentru curieri (https://github.com/celdotro/marketplace_examples/blob/master/Admin/7.deleteAddress.php) [EN] Delete a pick-up point's address (https://github.com/celdotro/marketplace_examples/blob/master/Admin/7.deleteAddress.php) @param null $id @param null $address @retur...
entailment
public function addCourier($name){ // Set method and action $method = 'admininfo'; $action = 'addCourier'; // Set data $data = array('name' => $name); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $res...
[RO] Trimite email pentru adaugarea unui nou curier (https://github.com/celdotro/marketplace/wiki/Adauga-curier) [EN] Sends an email with a request to add a new courier (https://github.com/celdotro/marketplace/wiki/Add-courier) @param $name @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function savePage($pageID, $pageData){ // Sanity check if(!isset($pageID) || !is_int($pageID)) throw new \Exception('Specificati un ID al paginii'); if(!isset($pageData) || !is_array($pageData) || empty($pageData)) throw new \Exception('$pages trebuie sa contina un array cu datele paginii...
[RO] Salveaza datele paginii (https://github.com/celdotro/marketplace/wiki/Salvare-pagina) [EN] Save page data (https://github.com/celdotro/marketplace/wiki/Save-pages) @param $pageID @param $pageData @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function actionIndex() { $providers = craft()->oauth->getProviders(false); $allProviderInfos = []; foreach($providers as $provider) { $allProviderInfos[$provider->getHandle()] = craft()->oauth->getProviderInfos($provider->getHandle()); } $variabl...
Providers Index @return null
entailment
public function actionProviderInfos(array $variables = array()) { if(!empty($variables['handle'])) { $provider = craft()->oauth->getProvider($variables['handle'], false, true); if($provider) { $variables['infos'] = craft()->oauth->getProviderInfos...
Edit Provider @return null
entailment
public function actionProviderSave() { $handle = craft()->request->getParam('handle'); $attributes = craft()->request->getPost('provider'); $provider = craft()->oauth->getProvider($handle, false); $providerInfos = new Oauth_ProviderInfosModel($attributes); $providerInfos->i...
Save provider @return null
entailment
public function updateAccountInformation ($cif = NULL, $iban = NULL, $telephone = NULL, $password = NULL, $bankName = NULL, $fullName = NULL, $hqAddress = NULL, $description = NULL, $apiLink = NULL, $contactPerson, $county, $city, $reg) { // Sanity check - skip it because it needs additional methods and package...
[RO] Actualizeaza urmatoarele date aferente afiliatului: CIF, IBAN, numar de telefon, parola, denumirea bancii, denumire completa, adresa sediu, api link si scurta descriere (https://github.com/celdotro/marketplace/wiki/Actualizare-informatii-cont) [EN] Updates the following data of an affiliate: CIF, IBAN, phone numbe...
entailment
public function markAsSeen($id){ // Set method and action $method = 'admininfo'; $action = 'markAsSeen'; // Send request and retrieve response $result = Dispatcher::send($method, $action, array('id' => $id)); return $result; }
[RO] Marcheaza o notificare drept citita (https://github.com/celdotro/marketplace/wiki/Marcheaza-drept-citita) [EN] Marks a notification as seen (https://github.com/celdotro/marketplace/wiki/Mark-as-seen) @param $id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function safeUp() { $tokensTable = $this->dbConnection->schema->getTable('{{oauth_tokens}}'); if ($tokensTable) { if (($userMappingColumn = $tokensTable->getColumn('userMapping')) == null) { OauthPlugin::log('Adding `userMapping` column to the ...
Any migration code in here is wrapped inside of a transaction. @return bool
entailment
public function safeUp() { // unique index for 'userMapping' and 'provider' $tableName = 'oauth_tokens'; $providersTable = $this->dbConnection->schema->getTable('{{'.$tableName.'}}'); if ($providersTable) { $columns = 'userMapping, provider'; $uniq...
Any migration code in here is wrapped inside of a transaction. @return bool
entailment
protected function type(\DOMNode $node) { $type = null; switch ($node->localName) { case 'alt': $type = WordType::IMG_ALT; break; case 'src': $type = WordType::IMG_SRC; break; } return $type; ...
{@inheritdoc}
entailment
public function createProvider() { $config = [ 'clientId' => $this->providerInfos->clientId, 'clientSecret' => $this->providerInfos->clientSecret, 'redirectUri' => $this->getRedirectUri(), ]; return new \Dukt\OAuth2\Client\Provider\Vimeo($config); }
Create Vimeo Provider @return Vimeo
entailment
public function createProvider() { $config = [ 'clientId' => $this->providerInfos->clientId, 'clientSecret' => $this->providerInfos->clientSecret, 'redirectUri' => $this->getRedirectUri(), ]; return new \League\OAuth2\Client\Provider\Instagram($config); ...
Creates the provider. @return Instagram
entailment
public function getInvoicesData($paymentStatus, $numInvoice = NULL, $startDate_inv = NULL, $endDate_inv = NULL, $numOrder = NULL, $startDate_order = NULL, $endDate_order = NULL, $page = NULL){ // Sanity check if (!isset($paymentStatus) || is_null($paymentStatus) || !in_array($paymentStatus, array(1,2,3)...
[RO] Returneaza date despre platile efectuate catre afiliat pentru fiecare factura (https://github.com/celdotro/marketplace/wiki/Date-plati-facturi) [EN] Returns data about the payments done in an affiliate's account for each invoice (https://github.com/celdotro/marketplace/wiki/Invoices-payment-data) @param $paymentSt...
entailment
public function showPayments($numInvoice, $numOrder){ // Sanity check if (!isset($numInvoice) || is_null($numInvoice)) throw new \Exception ('Specificati numarul facturii'); if (!isset($numInvoice) || is_null($numOrder)) throw new \Exception ('Specificati numarul comenzii'); // Set meth...
[RO] Returneaza date despre platile efectuate pe baza unei facturi (https://github.com/celdotro/marketplace/wiki/Date-plati-pentru-o-factura) [EN] Returns an invoice's payments and other relevant data (https://github.com/celdotro/marketplace/wiki/Detailed-payment-data-for-an-invoice) @param $numInvoice @param $numOrder...
entailment
protected function defineAttributes() { $attributes = array( 'id' => AttributeType::Number, 'providerHandle' => AttributeType::String, 'pluginHandle' => AttributeType::String, 'accessToken' => AttributeType::String, 'secret' => ...
Define Attributes
entailment
public function setClassName(string $className): self { if (!class_exists($className)) { throw new \InvalidArgumentException(sprintf( 'Class %s does not exist', $className )); } $this->className = $className; return $this; ...
@param string $className @return Builder
entailment
public function addResultColumn(ResultColumn $resultColumn): self { // prevent columns with the same machine_name or human_readable_name to be added foreach ($this->resultColumns as $column) { /** @var ResultColumn $column */ if ( $column->getHumanReadableName...
@param ResultColumn $resultColumn @return Builder
entailment
public function getHumanReadableWithMachineName(string $machineName) { /** @var ResultColumn $column */ foreach ($this->resultColumns as $column) { if ($column->getMachineName() === $machineName) { return $column->getHumanReadableName(); } } r...
@param string $machineName @return string|null
entailment
public function sendBugReport($message, $debug){ // Sanity check if(is_null($message) || empty(trim($message)) || strlen(trim($message)) < 10) throw new \Exception('Specificati un mesaj valid de cel putin 10 caractere in afara de spatiu'); if(empty($debug) && !is_array($debug)) throw new \Except...
[RO] Returneaza un graf cu conversatiile purtate prin intermediul email-ului cu clientii (hthttps://github.com/celdotro/marketplace/wiki/Trimitere-raport-bug) [EN] Returns a graph with the conversations made through the email with the client (https://github.com/celdotro/marketplace/wiki/Send-bug-report) @param $message...
entailment
public function defineAttributes() { return array( 'class' => array(AttributeType::String, 'required' => true), 'clientId' => array(AttributeType::String, 'required' => false), 'clientSecret' => array(AttributeType::String, 'required' => false) ); }
Define Attributes
entailment
public function addBonus($model, $bonus = array()){ // Sanity check if(!isset($model) || trim($model) === '') throw new \Exception('Specificati modelul'); if(!isset($bonus) || !is_array($bonus)) throw new \Exception('$bonus trebuie sa fie un array cu bonusuri'); // Set method and action...
[RO] Adauga bonusul pentru un produs (https://github.com/celdotro/marketplace/wiki/Adauga-bonus) [EN] Adds bonuses for a product (https://github.com/celdotro/marketplace/wiki/Add-bonus) @param $model @param array $bonus @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getBonus($model){ // Sanity check if(!isset($model) || trim($model) === '') throw new \Exception('Specificati modelul'); // Set method and action $method = 'products'; $action = 'getBonus'; // Set data $data = array('model' => $model); /...
[RO] Listeaza bonusurile unui produs (https://github.com/celdotro/marketplace/wiki/Listeaza-bonus) [EN] Get a product's bonuses (https://github.com/celdotro/marketplace/wiki/List-bonus) @param $model @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public static function transformUrl($url, $id, $key = '') { return str_replace(!empty($key) ? $key : ':id', $id, $url); }
Transform url by replacing dummy data. @param $url @param $id @param string $key @return mixed
entailment
public function objectToArray($object) { if (!is_object($object) && !is_array($object)) { return $object; } if (is_object($object)) { $object = get_object_vars($object); } return array_map([get_class(), 'objectToArray'], $object); }
Converts a bowl of object to an array. @todo: replace with function that only shows accessible properties of the object @param $object @return array
entailment
public static function env($key, $default = null) { $value = getenv($key); if ($value === false) { return value($default); } switch (strtolower($value)) { case 'true': case '(true)': return true; case 'false': ...
Gets the value of an environment variable. Supports boolean, empty and null. From Laravel/lumen-framework/src/helpers.php. @param string $key @param mixed $default @return mixed
entailment
public function getCustomer($customerId) { //retrieve customer, set customer attributes $customerModel = $this->customerResource->get($customerId); if ($customerModel instanceof \Exception) { throw $customerModel; } $this->_setAttributes($customerModel); ...
Get customer by ID. @param $customerId @throws \Exception|mixed @return $this
entailment
public function make($first_name, $last_name, $email, $phone, $otherAttributes = []) { $this->first_name = $first_name; $this->last_name = $last_name; $this->email = $email; $this->phone = $phone; $this->_setAttributes($otherAttributes); //set creatable $this...
set up a new customer object. @param $first_name @param $last_name @param $email @param $phone @param array $otherAttributes @return $this
entailment
public function setUpdateData($updateAttributes) { if (empty($updateAttributes)) { throw new \InvalidArgumentException('Update Attributes Empty'); } $this->_setAttributes($updateAttributes); $this->setUpdateable(true); return $this; }
set update data on customer model. @param $updateAttributes @throws \Exception @return $this
entailment
public function save() { $resourceResponse = null; if ($this->isCreatable() && !$this->isUpdateable()) { //available for creation $resourceResponse = $this->customerResource->save( $this->transform(ModelInterface::TRANSFORM_TO_JSON_ARRAY) ); } ...
save/update customer model on paystack. @throws \Exception @throws \Exception|mixed @throws null @return $this
entailment
protected function xpath() { $selectors = []; foreach ($this->types as $type) { $selectors[] = '@type = \'' .$type. '\''; } return '//*[(self::input[' .implode(' or ', $selectors). '] or self::textarea) and not(ancestor-or-self::*[@' .Parser::ATTRIBUTE_NO_TRANSLATE. '])]...
{@inheritdoc}
entailment
public function addContent($content, $type = null) { if (preg_match('/(?<content><\!DOCTYPE(?:.*?)?>)/is', $content, $this->doctypeMatches)) { $this->hasDoctype = true; } parent::addContent($content, $type); }
{@inheritdoc}
entailment
public function addHtmlContent($content, $charset = 'UTF-8') { if (preg_match('/(?<before><html(?:.*?)?>)(?:.*?)(?<after><\/html>)/is', $content, $this->htmlMatches)) { $this->hasHtml = true; } if (preg_match('/<head(?:.*?)?>(?:.*?)<\/head>/i', $content)) { $this->has...
{@inheritdoc}
entailment
public function html() { $html = ''; foreach ($this->getNode(0)->childNodes as $child) { $html .= $child->ownerDocument->saveHTML($child); } return $this->cleaningHtml($html); }
{@inheritdoc}
entailment
protected function cleaningHtml($html) { $xml = false; $childrens = null; try { $xml = @simplexml_load_string($html); } catch (\Exception $e) { // ignore } if ($xml !== false) { if (!$this->hasHead && $xml->getName() === 'head') {...
Cleaning HTML from parts it should not contains @param string $html @return string
entailment
public function getCardPayments($month){ // Sanity check // Set method and action $method = 'commissions'; $action = 'getCardOrdersByMonth'; // Set data $data = array('month' => $month); // Send request and retrieve response $result = Dispatcher::send($...
[RO] Preia informatii aferente platilor lunare cu cardul (https://github.com/celdotro/marketplace/wiki/Plati-cu-cardul) [EN] Retrieve information about monthly card payments (https://github.com/celdotro/marketplace/wiki/Card-payments) @param $month @return mixed @throws \Exception
entailment
public function getCardPaymentMonths(){ // Sanity check // Set method and action $method = 'commissions'; $action = 'getCardPaymentMonths'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method...
[RO] Preia lunile aferente platilor cu cardul (https://github.com/celdotro/marketplace/wiki/Preia-lunile-platilor-cu-cardul) [EN] Retrieve card payment months (https://github.com/celdotro/marketplace/wiki/Retrieve-card-payments-months) @return mixed @throws \Exception
entailment
public function getSummaryMonths(){ // Sanity check // Set method and action $method = 'commissions'; $action = 'getMonths'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $dat...
[RO] Preia lunile in care s-au generat borderouri (https://github.com/celdotro/marketplace/wiki/Preia-lunile-borderourilor) [EN] Get months in which orders summary was generated (https://github.com/celdotro/marketplace/wiki/Get-summary-months) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getUnbilledCommissions(){ // Sanity check // Set method and action $method = 'commissions'; $action = 'getComosioaneNefacturate'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($...
[RO] Preia comisioanele nefacturate (https://github.com/celdotro/marketplace/wiki/Preia-comisioanele-nefacturate) [EN] Get unbilled commissions (https://github.com/celdotro/marketplace/wiki/Get-unbilled-commissions) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getBilledCommissions($month){ // Sanity check if(empty($month)) throw new \Exception('Nu ati specificat luna'); // Set method and action $method = 'commissions'; $action = 'getComisioaneFacturate'; // Set data $data = array('month' => $month); ...
[RO] Preia comisioanele facturate (https://github.com/celdotro/marketplace/wiki/Preia-comisioane-facturate) [EN] Retrieve billed commissions (https://github.com/celdotro/marketplace/wiki/Retrieve-billed-commissions) @param $month @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function approveOrder($oid, $borderou){ // Sanity check if(empty($oid)) throw new \Exception('Nu ati specificat id-ul comenzii'); if(empty($borderou)) throw new \Exception('Nu ati specificat borderoul'); // Set method and action $method = 'commissions'; $action = ...
[RO] Aproba comanda (https://github.com/celdotro/marketplace/wiki/Aproba-comanda) [EN] Approve order (https://github.com/celdotro/marketplace/wiki/Approve-order) @param $oid @param $borderou @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function rejectOrder($oid, $borderou, $reason){ // Sanity check if(empty($oid)) throw new \Exception('Nu ati specificat id-ul comenzii'); if(empty($borderou)) throw new \Exception('Nu ati specificat borderoul'); if(empty($reason)) throw new \Exception('Nu ati specificat problema')...
[RO] Respinge comanda (https://github.com/celdotro/marketplace/wiki/Respinge-comanda) [EN] Reject order (https://github.com/celdotro/marketplace/wiki/Reject-order) @param $oid @param $borderou @param $reason @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function downloadSummaryXlsx($borderou){ // Sanity check if(empty($borderou)) throw new \Exception('Nu ati specificat borderoul'); // Set method and action $method = 'commissions'; $action = 'downloadXLSBorderou'; // Set data $data = array( 'b...
[RO] Descarca borderoul in format XLSX (https://github.com/celdotro/marketplace/wiki/Descarca-borderou-XLSX) [EN] Download XLSX format summary (https://github.com/celdotro/marketplace/wiki/Download-summary-XLSX) @param $borderou @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function printAwb($cmd){ // Sanity check if(!isset($cmd) || is_null($cmd) || $cmd === '' || !is_int($cmd)) throw new \Exception('Specificati comanda'); // Set method and action $method = 'orders'; $action = 'printAwb'; // Set data $data = array('cmd' => $...
[RO] Printeaza AWB-ul unei comenzi (https://github.com/celdotro/marketplace/wiki/Listare-AWB) [EN] Prints the AWB of a specified order (https://github.com/celdotro/marketplace/wiki/AWB-Print) @param $cmd @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function setTitle($title) { $this->setAutoDiscoverTitle($title === null); $this->title = $title; return $this; }
If we put a null value into $title, we would force the auto discover for the Parser. @param null|string $title @return $this
entailment
public function asArray() { $data = [ 'request_url' => $this->getUrl(), 'bot' => $this->getBot() ]; if (!$this->getAutoDiscoverTitle()) { $data['title'] = $this->getTitle(); } return $data; }
{@inheritdoc}
entailment
final private static function validateClassHasProperty(string $className, string $classProperty, string $builderId) { $propertyInfo = new PropertyInfoExtractor([new ReflectionExtractor()]); $properties = $propertyInfo->getProperties($className); if (false === strpos($classProperty, '.')) { ...
@param string $className @param string $classProperty @param string $builderId @see http://symfony.com/doc/current/components/property_info.html#components-property-info-extractors @throws \InvalidArgumentException
entailment
public function getCustomers($page = '') { $customerObjects = []; $customers = $this->getCustomerResource()->getAll($page); if ($customers instanceof \Exception) { throw $customers; } foreach ($customers as $customer) { $customerObject = new Customer...
Get all customers. @param string $page @throws \Exception|mixed @return \Exception|mixed
entailment
public function createCustomer($first_name, $last_name, $email, $phone) { return $this->getCustomerModel()->make($first_name, $last_name, $email, $phone)->save(); }
Create new customer. @param $first_name @param $last_name @param $email @param $phone @throws \Exception|mixed @throws null @return mixed
entailment
public function updateCustomerData($customerId, $updateData) { return $this->getCustomerModel()->getCustomer($customerId) ->setUpdateData($updateData) ->save(); }
Update customer by customer id/code. @param $customerId @param array $updateData @throws \Exception|mixed @throws null @return mixed
entailment
public function getPlans($page = '') { $planObjects = []; $plans = $this->getPlanResource()->getAll($page); if ($plans instanceof \Exception) { throw $plans; } foreach ($plans as $plan) { $planObject = new Plan($this->getPlanResource()); ...
Get all plans. @param string $page @throws \Exception|mixed @return \Exception|mixed
entailment
public function createPlan($name, $description, $amount, $currency) { return $this->getPlanModel()->make($name, $description, $amount, $currency)->save(); }
Create new plan. @param $name @param $description @param $amount @param $currency @throws \Exception|mixed @throws null @return mixed
entailment
public function updatePlan($planCode, $updateData) { return $this->getPlanModel()->getPlan($planCode) ->setUpdateData($updateData) ->save(); }
Update plan. @param $planCode @param $updateData @throws \Exception|mixed @throws null @return mixed
entailment
public function startOneTimeTransaction($amount, $email, $plan = '') { $oneTimeTransaction = OneTimeTransaction::make( $amount, $email, $plan instanceof Plan ? $plan->get('plan_code') : $plan ); $oneTimeTransaction->setTransactionResource($this->getTransac...
Init a one time transaction to get payment page url. @param $amount @param $email @param string $plan @throws \Exception|mixed|Exceptions\PaystackInvalidTransactionException @return \Exception|mixed|Exceptions\PaystackInvalidTransactionException
entailment
public function chargeReturningTransaction($authorization, $amount, $email, $plan = '') { $returningTransaction = ReturningTransaction::make( $authorization, $amount, $email, $plan instanceof Plan ? $plan->get('plan_code') : $plan ); $returning...
Charge a returning customer. @param $authorization @param $amount @param $email @param string $plan @throws \Exception|mixed|Exceptions\PaystackInvalidTransactionException @return \Exception|mixed|Exceptions\PaystackInvalidTransactionException
entailment
public function getSummary($nrDays = 0){ // Sanity check if(!isset($nrDays) || !is_int($nrDays)) throw new \Exception('$nrDays trebuie sa fie de tip integer'); // Set method and action $method = 'home'; $action = 'getOrders'; // Set data $data = array('nrDays' =...
[RO] Returneaza un sumar pentru ultimele zile. (https://github.com/celdotro/marketplace/wiki/Sumar-comenzi) [EN] Get orders summary for the last days. (https://github.com/celdotro/marketplace/wiki/Orders-summary) @param int $nrDays @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function updateData($arrProducts){ // Sanity check if(!is_array($arrProducts) || empty($arrProducts)) throw new \Exception('Functia primeste ca parametru un array cu datele fiecarui produs grupate intr-un sub-array'); // Set method and action $method = 'products'; $action...
[RO] Actualizeaza datele produselor deja existente (https://github.com/celdotro/marketplace/wiki/Actualizeaza-date-produs) [EN] Updates an already existing product's data (https://github.com/celdotro/marketplace/wiki/Update-product-data) @param $arrProducts @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function updateStatus($model, $status){ // Sanity check if(empty($model)) throw new \Exception('Specificati modelul produsului'); // Set method and action $method = 'products'; $action = 'updateStatus'; // Set data $data = array( 'model' => $m...
[RO] Actualizeaza statusul unui produs (https://github.com/celdotro/marketplace/wiki/Actualizare-status-produs) [EN] Update product's status (https://github.com/celdotro/marketplace/wiki/Update-product-status) @param $model @param $status @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function addProductToFamily($familyId, $model){ // Sanity check if(empty($model)) throw new \Exception('Specificati modelul produsului'); if(empty($familyId)) throw new \Exception('Specificati familia produsului'); // Set method and action $method = 'products'; $a...
[RO] Adauga un produs intr-o familie de produse (https://github.com/celdotro/marketplace/wiki/Adauga-produs-in-familie) [EN] Add a product to a product family (https://github.com/celdotro/marketplace/wiki/Add-product-to-family) @param $familyId @param $model @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function removeProductFromFamily($model){ // Sanity check if(empty($model)) throw new \Exception('Specificati modelul produsului'); // Set method and action $method = 'products'; $action = 'removeProductFromFamily'; // Set data $data = array( ...
[RO] Elimina produs din familie (https://github.com/celdotro/marketplace/wiki/Elimina-produs-din-familie) [EN] Remove product from family (https://github.com/celdotro/marketplace/wiki/Remove-product-from-family) @param $model @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function updatePromotion($model, $promotion){ // Sanity check if(empty($model)) throw new \Exception('Specificati modelul produsului'); if(!in_array($promotion, array(0, 1, 2))) throw new \Exception('Specificati o promotie valida'); // Set method and action $method = 'pro...
[RO] Actualizeaza promotia unui produs (https://github.com/celdotro/marketplace/wiki/Actualizare-promotie-produs) [EN] Update product's promotion (https://github.com/celdotro/marketplace/wiki/Update-product-promotion) @param $model @param $promotion @return mixed @throws \Exception
entailment
public function addProductsFamily($id, $name, $characts){ // Set method and action $method = 'products'; $action = 'addProductsFamily'; // Set data $data = array( 'id' => $id, 'name' => $name, 'characts' => $characts ); // Sen...
[RO] Adauga o familie de produse (https://github.com/celdotro/marketplace/wiki/Adauga-familie-de-produse) [EN] Add a products family (https://github.com/celdotro/marketplace/wiki/Add-products-family) @param $id @param $name @param $characts @return mixed @throws \Exception
entailment
protected function xpath() { $selectors = []; foreach ($this->attributes as $name => $values) { foreach ($values as $value) { $selectors[] = '@' .$name. ' = \'' .$value. '\''; } } return '//meta[(' .implode(' or ', $selectors). ') and not(ance...
{@inheritdoc}
entailment
public function jsonSerialize() { $words = []; foreach ($this->collection as $entry) { $words[] = $entry->jsonSerialize(); } return $words; }
{@inheritdoc}
entailment
public function cardPayments($dateMin, $dateMax){ $method = 'reports'; $action = 'cardPayments'; // Set data $data = array( 'dateMin' => $dateMin, 'dateMax' => $dateMax, ); // Send request and retrieve response $result = Dispatcher::send(...
[RO] Preia datele agregate lunar ale platilor cu cardul (https://github.com/celdotro/marketplace/wiki/Plati-cu-cardul) [EN] Retrieves aggregate monthly reports of card payments (https://github.com/celdotro/marketplace/wiki/Card-payments) @param $dateMin @param $dateMax @return mixed @throws \Exception
entailment
public function defineAttributes() { return array( 'providerHandle' => array(AttributeType::String, 'required' => true), 'pluginHandle' => array(AttributeType::String, 'required' => true), 'accessToken' => array(AttributeType::String, 'column' => ColumnType::Text), ...
Define Attributes
entailment
public function connect($variables) { if(!craft()->httpSession->get('oauth.response')) { // we don't have any response yet, get ready to connect // clean session $this->_sessionClean(); // get provider $provider = craft()->oauth->getPr...
Connect
entailment
public function getProvider($handle, $configuredOnly = true, $fromRecord = false) { $this->_loadProviders($fromRecord); $lcHandle = strtolower($handle); if($configuredOnly) { if(isset($this->_configuredProviders[$lcHandle])) { return $this->...
Get provider
entailment
public function getProviders($configuredOnly = true) { $this->_loadProviders(); if($configuredOnly) { return $this->_configuredProviders; } else { return $this->_allProviders; } }
Get providers
entailment
public function providerSave(Oauth_ProviderInfosModel $model) { // save record $record = $this->_getProviderInfosRecordById($model->id); $record->class = $model->class; $record->clientId = $model->clientId; $record->clientSecret = $model->clientSecret; return $recor...
Save provider
entailment