sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
protected function getWidgetCartPreview(array $cart) { if (empty($cart['items'])) { return ''; } $options = array( 'cart' => $cart, 'limit' => $this->config('cart_preview_limit', 5) ); return $this->render('cart/preview', $options, true);...
Returns rendered cart preview @param array $cart @return string
entailment
protected function execute(InputInterface $input, OutputInterface $output) { $indentation = 4; if ($input->getOption('app-only')) { $message = "This is the configuration defined in the app/ directory (not processed):\n"; $config = $this->getServiceManager()->get('Applicatio...
{@inheritdoc}
entailment
public function order(array &$submitted, array $options = array()) { $this->options = $options; $this->submitted = &$submitted; $this->validateOrder(); $this->validateStoreId(); $this->validatePaymentOrder(); $this->validateShippingOrder(); $this->validateSta...
Performs full order data validation @param array $submitted @param array $options @return array|boolean
entailment
protected function validateOrder() { $id = $this->getUpdatingId(); if ($id === false) { return null; } $data = $this->order->get($id); if (empty($data)) { $this->setErrorUnavailable('update', $this->translation->text('Order')); return fa...
Validates an order to be updated @return boolean
entailment
protected function validatePaymentOrder() { $field = 'payment'; if ($this->isExcluded($field)) { return null; } $value = $this->getSubmitted($field); if ($this->isUpdating() && !isset($value)) { $this->unsetSubmitted($field); return null...
Validates a payment method @return boolean|null
entailment
protected function validateStatusOrder() { $field = 'status'; $value = $this->getSubmitted($field); if (!isset($value)) { $this->unsetSubmitted($field); return null; } $statuses = $this->order->getStatuses(); if (empty($statuses[$value])) { ...
Validates a status @return boolean|null
entailment
protected function validatePaymentAddressOrder() { $field = 'payment_address'; if ($this->isExcluded($field)) { return null; } $value = $this->getSubmitted($field); if (!isset($value) && $this->isUpdating()) { $this->unsetSubmitted($field); ...
Validates a payment address @return boolean
entailment
protected function validateCreatorOrder() { $field = 'creator'; $value = $this->getSubmitted($field); if (!isset($value) && $this->isUpdating()) { $this->unsetSubmitted($field); return null; } if (empty($value)) { return null; } ...
Validates a creator user ID @return boolean|null
entailment
protected function validateTotalOrder() { $field = 'total'; $value = $this->getSubmitted($field); if (!isset($value)) { $this->unsetSubmitted($field); return null; } $label = $this->translation->text('Total'); if (!is_numeric($value)) { ...
Validates order total @return boolean|null
entailment
protected function validateComponentPricesOrder() { $field = 'data.components'; $components = $this->getSubmitted($field); if (empty($components)) { $this->unsetSubmitted($field); return null; } $label = $this->translation->text('Price'); if...
Validates order component prices @return bool
entailment
protected function validateTransactionOrder() { $field = 'transaction_id'; $value = $this->getSubmitted($field); if (!isset($value)) { $this->unsetSubmitted($field); return null; } $label = $this->translation->text('Transaction'); if (!is_nu...
Validates a transaction ID @return boolean|null
entailment
protected function validateLogOrder() { if (mb_strlen($this->getSubmitted('log')) > 255) { $this->setErrorLengthRange('log', $this->translation->text('Log'), 0, 255); return false; } return true; }
Validates a log message @return boolean|null
entailment
public function run($handler_id, &$submitted, array $options = array()) { $result = null; $this->hook->attach('validator.run.before', $submitted, $options, $result, $this); if (isset($result)) { return $result; } $result = $this->callHandler($handler_id, $submit...
Performs validation using the given handler @param string $handler_id @param mixed $submitted @param array $options @return mixed
entailment
public function callHandler($handler_id, &$submitted, array $options) { try { $handlers = $this->getHandlers(); $callback = Handler::get($handlers, $handler_id, 'validate'); return call_user_func_array($callback, array(&$submitted, $options)); } catch (Exception $...
Call a validation handler @param string $handler_id @param mixed $submitted @param array $options @return mixed
entailment
public function submitProductCompare($compare_action_model) { $this->setSubmitted('product'); $this->filterSubmitted(array('product_id')); if ($this->isPosted('remove_from_compare')) { $this->deleteFromProductCompare($compare_action_model); } else if ($this->isPosted('ad...
Handles adding/removing a submitted product from comparison @param \gplcart\core\models\ProductCompareAction $compare_action_model
entailment
public function addToProductCompare($compare_action_model) { $errors = $this->error(); if (empty($errors)) { $submitted = $this->getSubmitted(); $result = $compare_action_model->add($submitted['product'], $submitted); } else { $result = array( ...
Adds a submitted product to comparison @param \gplcart\core\models\ProductCompareAction $compare_action_model
entailment
public function deleteFromProductCompare($compare_action_model) { $product_id = $this->getSubmitted('product_id'); $result = $compare_action_model->delete($product_id); if ($this->isAjax()) { $this->outputJson($result); } $this->controlDeleteProductCompare($resu...
Deletes a submitted product from comparison @param \gplcart\core\models\ProductCompareAction $compare_action_model
entailment
protected function controlDeleteProductCompare(array &$result, $product_id) { if (empty($result['redirect'])) { $segments = explode(',', $this->path()); if (isset($segments[0]) && $segments[0] === 'compare' && !empty($segments[1])) { $ids = array_filter(array_map('tri...
Controls result after a product has been deleted from comparison @param array $result @param integer $product_id
entailment
public static function configRoutes($groupConfig) { $groups = ''; $i = 0; foreach($groupConfig['register_groups'] as $key => $value) { $i++; if($i == 1){ $groups .= $value; } else { $groups .= '|' . $value; } } Route::group([ 'middleware' => ...
Get a Cms route registrar. @param array $options @return RouteRegistrar
entailment
protected function getSignature(array $options) { $signature = "\r\n\r\n-------------------------------------\r\n@owner\r\n@address\r\n@phone\r\n@fax\r\n@store_email\r\n@map"; // @text $replacements = array(); $replacements['@owner'] = empty($options['owner']) ? '' : $options['owner']; ...
Returns a string containing default e-mail signature @param array $options @return string
entailment
public function resolveArray(array $data) { $self = $this; array_walk_recursive($data, function (&$value, $key) use ($self) { if (is_string($value)) { $value = $self->resolveString($value); } }); return $data; }
Replaces parameter placeholders (%name%) by their values in every string element of the $array. @param array $data @return array
entailment
protected function flatten(array &$parameters, array $subnode = null, $path = null) { if (null === $subnode) { $subnode = & $parameters; } foreach ($subnode as $key => $value) { if (is_array($value)) { $nodePath = $path ? $path . '.' . $key : $key; ...
Flattens an nested array of parameters. The scheme used is: 'key' => array('key2' => array('key3' => 'value')) Becomes: 'key.key2.key3' => 'value' This function takes an array by reference and will modify it @param array &$parameters The array that will be flattened @param array $subnode Current subnode being ...
entailment
public function get($code) { $result = &gplcart_static("country.get.$code"); if (isset($result)) { return $result; } $this->hook->attach('country.get.before', $code, $result, $this); if (isset($result)) { return $result; } $sql = 'S...
Loads a country from the database @param string $code @return array
entailment
public function getFormat($country, $only_enabled = false) { $data = is_string($country) ? $this->get($country) : (array) $country; if (empty($data['format'])) { $format = $this->getDefaultFormat(); gplcart_array_sort($format); } else { $format = $data['f...
Returns an array of country format @param string|array $country @param bool $only_enabled @return array
entailment
public function add(array $data) { $result = null; $this->hook->attach('country.add.before', $data, $result, $this); if (isset($result)) { return (bool) $result; } $result = true; $this->db->insert('country', $data); $this->hook->attach('country....
Adds a country @param array $data @return boolean
entailment
public function getIso($code = null) { $data = (array) gplcart_config_get(GC_FILE_CONFIG_COUNTRY); if (isset($code)) { return isset($data[$code]) ? $data[$code] : ''; } return $data; }
Returns an array of country names or a country name if the code parameter is set @param null|string $code @return array|string
entailment
protected function deleteLinked($code) { $this->db->delete('city', array('country' => $code)); $this->db->delete('state', array('country' => $code)); }
Deletes all database records related to the country @param string $code
entailment
public function delete(array $data = array()) { $sql = 'DELETE FROM log'; $conditions = array(); if (empty($data['log_id'])) { $sql .= " WHERE log_id IS NOT NULL"; } else { settype($data['log_id'], 'array'); $placeholders = rtrim(str_repeat('?,',...
Delete log records @param array $data @return boolean
entailment
public function getStatus() { $statuses = array(); $statuses['core_version'] = array( 'title' => $this->translation->text('Core version'), 'description' => '', 'severity' => 'info', 'status' => gplcart_version(), 'weight' => 0, ); ...
Returns an array of system statuses @return array
entailment
public function getSeverities() { return array( 'info' => $this->translation->text('Info'), 'danger' => $this->translation->text('Danger'), 'warning' => $this->translation->text('Warning') ); }
Returns an array of log severity types @return array
entailment
public function checkFilesystem() { $results = array( $this->checkPermissions(GC_FILE_CONFIG_COMPILED) ); if (file_exists(GC_FILE_CONFIG_COMPILED_OVERRIDE)) { $results[] = $this->checkPermissions(GC_FILE_CONFIG_COMPILED_OVERRIDE); } $filtered = array...
Checks file system @return boolean|array
entailment
protected function checkPermissions($file, $permissions = '0444') { if (substr(sprintf('%o', fileperms($file)), -4) === $permissions) { return true; } $vars = array('%name' => $file, '%perm' => $permissions); return $this->translation->text('File %name is not secure. The...
Checks file permissions @param string $file @param string $permissions @return boolean|array
entailment
public function setItemOrderShippingName(&$item, $shipping_model) { if (isset($item['shipping'])) { $data = $shipping_model->get($item['shipping']); $item['shipping_name'] = empty($data['title']) ? 'Unknown' : $data['title']; } }
Adds "shipping_name" key @param array $item @param \gplcart\core\models\Shipping $shipping_model
entailment
public function setItemOrderPaymentName(&$item, $payment_model) { if (isset($item['payment'])) { $data = $payment_model->get($item['payment']); $item['payment_name'] = empty($data['title']) ? 'Unknown' : $data['title']; } }
Adds "payment_name" key @param array $item @param \gplcart\core\models\Payment $payment_model
entailment
public function setItemOrderAddress(&$order, $address_model) { $order['address'] = array(); foreach (array('shipping', 'payment') as $type) { $address = $address_model->get($order["{$type}_address"]); if (!empty($address)) { $order['address'][$type] = $addres...
Adds an address information for the order item @param array $order @param \gplcart\core\models\Address $address_model
entailment
public function setItemOrderStatusName(&$item, $order_model) { if (isset($item['status'])) { $data = $order_model->getStatusName($item['status']); $item['status_name'] = empty($data) ? 'Unknown' : $data; } }
Adds "status_name" key @param array $item @param \gplcart\core\models\Order $order_model
entailment
public function setItemOrderStoreName(&$item, $store_model) { if (isset($item['store_id'])) { $data = $store_model->get($item['store_id']); $item['store_name'] = empty($data['name']) ? 'Unknown' : $data['name']; } }
Adds "store_name" key @param array $item @param \gplcart\core\models\Store $store_model
entailment
public static function deserializeObject(array $data) { $result = new static($data['resourceType'], isset($data['created']) ? Helper::string2dateTime($data['created']) : null); if (isset($data['lastModified'])) { $result->lastModified = Helper::string2dateTime($data['lastModified']); ...
@param array $data @return Meta
entailment
public function listCategoryGroup() { $this->setTitleListCategoryGroup(); $this->setBreadcrumbListCategoryGroup(); $this->setFilterListCategoryGroup(); $this->setPagerListCategoryGroup(); $this->setData('category_groups', $this->getListCategoryGroup()); $this->setDat...
Displays the category group overview page
entailment
protected function setPagerListCategoryGroup() { $options = $this->query_filter; $options['count'] = true; $pager = array( 'query' => $this->query_filter, 'total' => (int) $this->category_group->getList($options) ); return $this->data_limit = $this->...
Sets pager @return array
entailment
protected function getListCategoryGroup() { $conditions = $this->query_filter; $conditions['limit'] = $this->data_limit; return $this->category_group->getList($conditions); }
Returns an array of category groups @return array
entailment
public function editCategoryGroup($category_group_id = null) { $this->setCategoryGroup($category_group_id); $this->setTitleEditCategoryGroup(); $this->setBreadcrumbEditCategoryGroup(); $this->setData('category_group', $this->data_category_group); $this->setData('can_delete',...
Displays the edit category group page @param integer|null $category_group_id
entailment
protected function canDeleteCategoryGroup() { return isset($this->data_category_group['category_group_id']) && $this->category_group->canDelete($this->data_category_group['category_group_id']) && $this->access('category_group_delete'); }
Whether the category group can be deleted @return boolean
entailment
protected function setCategoryGroup($category_group_id) { $this->data_category_group = array(); if (is_numeric($category_group_id)) { $conditions = array( 'language' => 'und', 'category_group_id' => $category_group_id ); $this->d...
Sets the category group data @param integer $category_group_id
entailment
protected function submitEditCategoryGroup() { if ($this->isPosted('delete')) { $this->deleteCategoryGroup(); } else if ($this->isPosted('save') && $this->validateEditCategoryGroup()) { if (isset($this->data_category_group['category_group_id'])) { $this->updat...
Handles a submitted category group data
entailment
protected function validateEditCategoryGroup() { $this->setSubmitted('category_group'); $this->setSubmitted('update', $this->data_category_group); $this->validateComponent('category_group'); return !$this->hasErrors(false); }
Validates a submitted category group data
entailment
protected function deleteCategoryGroup() { $this->controlAccess('category_group_delete'); if ($this->category_group->delete($this->data_category_group['category_group_id'])) { $this->redirect('admin/content/category-group', $this->text('Category group has been deleted'), 'success'); ...
Deletes a category group
entailment
protected function updateCategoryGroup() { $this->controlAccess('category_group_edit'); if ($this->category_group->update($this->data_category_group['category_group_id'], $this->getSubmitted())) { $this->redirect('admin/content/category-group', $this->text('Category group has been updat...
Updates a category group
entailment
protected function addCategoryGroup() { $this->controlAccess('category_group_add'); if ($this->category_group->add($this->getSubmitted())) { $this->redirect('admin/content/category-group', $this->text('Category group has been added'), 'success'); } $this->redirect('', $...
Adds a new category group
entailment
protected function setTitleEditCategoryGroup() { if (isset($this->data_category_group['category_group_id'])) { $title = $this->text('Edit %name', array('%name' => $this->data_category_group['title'])); } else { $title = $this->text('Add category group'); } $t...
Sets titles on the category group edit page
entailment
protected function setBreadcrumbEditCategoryGroup() { $breadcrumbs = array(); $breadcrumbs[] = array( 'url' => $this->url('admin'), 'text' => $this->text('Dashboard') ); $breadcrumbs[] = array( 'url' => $this->url('admin/content/category-group'),...
Sets breadcrumbs on the edit category group page
entailment
public function listTrigger() { $this->actionListTrigger(); $this->setTitleListTrigger(); $this->setBreadcrumbListTrigger(); $this->setFilterListTrigger(); $this->setPagerListTrigger(); $this->setData('triggers', $this->getListTrigger()); $this->outputListTr...
Displays the trigger overview page
entailment
protected function setPagerListTrigger() { $conditions = $this->query_filter; $conditions['count'] = true; $pager = array( 'query' => $this->query_filter, 'total' => (int) $this->trigger->getList($conditions) ); return $this->data_limit = $this->setP...
Sets pager @return array
entailment
protected function getListTrigger() { $conditions = $this->query_filter; $conditions['limit'] = $this->data_limit; return (array) $this->trigger->getList($conditions); }
Returns an array of triggers @return array
entailment
public function editTrigger($trigger_id = null) { $this->setTrigger($trigger_id); $this->setTitleEditTrigger(); $this->setBreadcrumbEditTrigger(); $this->setData('trigger', $this->data_trigger); $this->setData('can_delete', $this->canDeleteTrigger()); $this->setData(...
Displays the trigger edit page @param null|integer $trigger_id
entailment
protected function setTrigger($trigger_id) { $this->data_trigger = array(); if (is_numeric($trigger_id)) { $this->data_trigger = $this->trigger->get($trigger_id); if (empty($this->data_trigger)) { $this->outputHttpStatus(404); } } }
Sets a trigger data @param integer $trigger_id
entailment
protected function submitEditTrigger() { if ($this->isPosted('delete')) { $this->deleteTrigger(); } else if ($this->isPosted('save') && $this->validateEditTrigger()) { if (isset($this->data_trigger['trigger_id'])) { $this->updateTrigger(); } else {...
Handles a submitted trigger data
entailment
protected function validateEditTrigger() { $this->setSubmitted('trigger', null, false); $this->setSubmittedBool('status'); $this->setSubmittedArray('data.conditions'); $this->setSubmitted('update', $this->data_trigger); $this->validateComponent('trigger'); return !$...
Validates a submitted trigger @return bool
entailment
protected function deleteTrigger() { $this->controlAccess('trigger_delete'); if ($this->trigger->delete($this->data_trigger['trigger_id'])) { $this->redirect('admin/settings/trigger', $this->text('Trigger has been deleted'), 'success'); } $this->redirect('', $this->text...
Deletes a trigger
entailment
protected function updateTrigger() { $this->controlAccess('trigger_edit'); if ($this->trigger->update($this->data_trigger['trigger_id'], $this->getSubmitted())) { $this->redirect('admin/settings/trigger', $this->text('Trigger has been updated'), 'success'); } $this->red...
Updates a trigger
entailment
protected function addTrigger() { $this->controlAccess('trigger_add'); if ($this->trigger->add($this->getSubmitted())) { $this->redirect('admin/settings/trigger', $this->text('Trigger has been added'), 'success'); } $this->redirect('', $this->text('Trigger has not been ...
Adds a new trigger
entailment
protected function setDataEditTrigger() { $conditions = $this->getData('trigger.data.conditions'); if (empty($conditions) || !is_array($conditions)) { return null; } if (!$this->isError()) { gplcart_array_sort($conditions); } $modified = arr...
Converts an array of conditions into a multiline string
entailment
protected function setTitleEditTrigger() { if (isset($this->data_trigger['name'])) { $title = $this->text('Edit %name', array('%name' => $this->data_trigger['name'])); } else { $title = $this->text('Add trigger'); } $this->setTitle($title); }
Sets title on the edit trigger page
entailment
protected function setBreadcrumbEditTrigger() { $breadcrumbs = array(); $breadcrumbs[] = array( 'url' => $this->url('admin'), 'text' => $this->text('Dashboard') ); $breadcrumbs[] = array( 'url' => $this->url('admin/settings/trigger'), ...
Sets breadcrumbs on the edit trigger page
entailment
public function initialize(array $config) { $table = Configure::check('CakephpBlueimpUpload.upload_table') ? Configure::read('CakephpBlueimpUpload.upload_table') : 'uploads'; $this->setTable($table); $this->setDisplayField('id'); $this->setPrimaryKey('id'); $this->addBehavio...
Initialize method @param array $config The configuration for the Table. @return void
entailment
public function validationDefault(Validator $validator) { $validator ->add('id', 'valid', ['rule' => 'numeric']) ->allowEmpty('id', 'create'); $validator ->requirePresence('upload_id', 'create') ->notEmpty('upload_id'); $validator ...
Default validation rules. @param \Cake\Validation\Validator $validator Validator instance. @return \Cake\Validation\Validator
entailment
public function trigger(array &$submitted, array $options) { $this->options = $options; $this->submitted = &$submitted; $this->validateTrigger(); $this->validateBool('status'); $this->validateName(); $this->validateStoreId(); $this->validateWeight(); ...
Performs full trigger data validation @param array $submitted @param array $options @return array|boolean
entailment
protected function validateTrigger() { $id = $this->getUpdatingId(); if ($id === false) { return null; } $data = $this->trigger->get($id); if (empty($data)) { $this->setErrorUnavailable('update', $this->translation->text('Trigger')); ret...
Validates a trigger to be updated @return boolean
entailment
public function validateConditionsTrigger() { $field = 'data.conditions'; if ($this->isExcluded($field)) { return null; } $value = $this->getSubmitted($field); if ($this->isUpdating() && !isset($value)) { $this->unsetSubmitted($field); r...
Validates and modifies trigger conditions @return boolean|null
entailment
protected function validateConditionTrigger($condition_id, array $args) { try { $handlers = $this->condition->getHandlers(); return static::call($handlers, $condition_id, 'validate', $args); } catch (Exception $ex) { return $ex->getMessage(); } }
Call a validator handler @param string $condition_id @param array $args @return mixed
entailment
public function configureServiceManager(ServiceManager $serviceManager) { $config = $serviceManager->get('Config'); $appRootDir = $config['parameters']['app.root_dir']; $appCacheDir = $config['parameters']['app.cache_dir']; $appCharset = $config['parameters']['app.charset']; ...
Templating engines currently supported: - PHP - Twig - Smarty - Mustache. @param ServiceManager $serviceManager @throws \RuntimeException
entailment
protected function processConfiguration(array $config, ServiceManager $serviceManager = null) { $config = $config['framework']; if (!isset($config['templating'])) { $config['templating'] = array(); } if (isset($config['view'])) { $config['templating'] = $this...
{@inheritDoc}
entailment
public function getByProduct($product_id) { $result = null; $this->hook->attach('rating.get.before', $product_id, $result, $this); if (isset($result)) { return $result; } $sql = 'SELECT rating, votes FROM rating WHERE product_id=?'; $result = $this->db->...
Returns an array of rating data for a given product @param integer $product_id @return array
entailment
public function getByUser($product_id, $user_id) { $result = null; $this->hook->attach('rating.get.user.before', $product_id, $user_id, $result, $this); if (isset($result)) { return $result; } $user_ids = (array) $user_id; $conditions = array_merge($user...
Returns an array of user voting data for the given user(s) @param integer $product_id @param integer|array $user_id @return array
entailment
public function set(array $data) { $result = null; $this->hook->attach('rating.set.before', $data, $result, $this); if (isset($result)) { return $result; } $conditions = array( 'user_id' => $data['user_id'], 'product_id' => $data['product...
Sets a rating for the given user and product @param array $data @return array
entailment
protected function addByUser(array $data) { $result = null; $this->hook->attach('rating.add.user.before', $data, $result, $this); if (isset($result)) { return (int) $result; } if (empty($data['rating'])) { return 0; // Do not add rating 0 (unvote) ...
Adds a user rating @param array $data @return integer
entailment
protected function setBayesian(array $data) { $rating = $this->getBayesian($data); if (empty($rating['bayesian_rating'])) { $this->db->delete('rating', array('product_id' => $data['product_id'])); return array(); } $sql = 'INSERT INTO rating ...
Sets bayesian rating and votes for the given product @param array $data @return array
entailment
public function getModulesPath() { $paths = array(); foreach ($this->getLoadedModules(true) as $module) { $paths[$module->getName()] = $module->getPath(); } return $paths; }
Returns an array of paths to modules. @return array An array of paths to each loaded module
entailment
public function locateResource($name, $dir = null, $first = true) { if ('@' !== $name[0]) { throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); } if (false !== strpos($name, '..')) { throw new \RuntimeException(spri...
Returns the file path for a given resource. A Resource can be a file or a directory. The resource name must follow the following pattern: @<ModuleName>/path/to/a/file.something where ModuleName is the name of the module and the remaining part is the relative path in the module. If $dir is passed, and the first seg...
entailment
protected function validate(array $values, $operator) { if (!in_array($operator, array('=', '!='))) { return $this->translation->text('Unsupported operator'); } if (count($values) != 1) { return $this->translation->text('@field has invalid value', array( ...
Common scope validator @param array $values @param string $operator @return boolean|string
entailment
public function render($name, array $parameters = array()) { $engine = $this->getEngine($name); if (!empty($this->globals)) { foreach ($this->globals as $key => $val) { $engine->addGlobal($key, $val); } } // @todo - This only supports addHelp...
Renders a template. @param mixed $name A template name or a TemplateReferenceInterface instance @param array $parameters An array of parameters to pass to the template @throws \InvalidArgumentException If the template does not exist @throws \RuntimeException If the template cannot be rendered @return s...
entailment
public function getMeta($key) { $taxonomymeta = $this->taxonomymeta; $taxonomymeta = $taxonomymeta->keyBy('meta_key'); if(array_has($taxonomymeta, $key . '.meta_value')){ $returnValue = $taxonomymeta[$key]['meta_value']; return $returnValue; } }
Retrieve the meta value of a certain key
entailment
public static function deserializeObject(array $data) { /** @var Bulk $result */ $result = parent::deserializeObject($data); $result->maxOperations = $data['maxOperations']; $result->maxPayloadSize = $data['maxPayloadSize']; return $result; }
@param array $data @return Bulk
entailment
public function set($name, $service, $shared = true) { return $this->setService($name, $service, $shared); }
Register a service with the locator. This method is an alias to $this->setService(). @param string $name @param mixed $service @param bool $shared @return ServiceManager
entailment
public function getParameter($name) { $config = $this->get('config'); if (!isset($config['parameters'][$name])) { throw new \InvalidArgumentException(sprintf('You have requested a non-existent parameter "%s".', $name)); } return $config['parameters'][$name]; }
Gets a parameter. @param string $name The parameter name @throws \InvalidArgumentException if the parameter is not defined @return mixed The parameter value
entailment
public function setParameter($name, $value) { $config = $this->get('config'); $config['parameters'][$name] = $value; $this->set('config', $config); }
Sets a parameter. @param string $name The parameter name @param mixed $value The parameter value
entailment
protected function createConfig() { $this->setCliMessage('Creating configuration file...'); $config = file_get_contents(GC_FILE_CONFIG); if (empty($config)) { $error = $this->translation->text('Failed to read file @path', array('@path' => GC_FILE_CONFIG)); throw new...
Create the configuration file using data from a default file @throws UnexpectedValueException
entailment
protected function createPages() { $this->setCliMessage('Creating pages...'); $pages = array(); $pages[] = array( 'title' => 'Contact us', 'description' => 'Contact information', ); $pages[] = array( 'title' => 'Help', 'descr...
Creates default pages
entailment
protected function createLanguages() { $this->setCliMessage('Configuring language...'); if (!empty($this->data['store']['language']) && $this->data['store']['language'] !== 'en') { $this->getLanguageModel()->update($this->data['store']['language'], array('default' => true)); } ...
Creates default languages
entailment
protected function createSuperadmin() { $this->setCliMessage('Creating superadmin...'); $user = array( 'status' => 1, 'name' => 'Superadmin', 'store_id' => $this->context['store_id'], 'email' => $this->data['user']['email'], 'password' => ...
Creates user #1 (super-admin)
entailment
protected function createStore() { $this->setCliMessage('Creating store...'); $default = $this->getStoreModel()->getDefaultData(); $default['title'] = $this->data['store']['title']; $default['email'] = array($this->data['user']['email']); $store = array( 'statu...
Creates default store
entailment
protected function createContent() { $this->setCliMessage('Creating content...'); $this->initConfig(); $this->createDbConfig(); $this->createStore(); $this->createSuperadmin(); $this->createCountries(); $this->createLanguages(); $this->createPages(); ...
Create default content for the site
entailment
protected function createDbConfig() { $this->setCliMessage('Configuring database...'); $this->config->set('intro', 1); $this->config->set('installed', GC_TIME); $this->config->set('cron_key', gplcart_string_random()); $this->config->set('installer', $this->data['installer'])...
Create store settings in the database
entailment
protected function setContext($key, $value) { gplcart_array_set($this->context, $key, $value); $this->session->set("install.context.$key", $value); }
Sets the current context @param string $key @param mixed $value
entailment
protected function getContext($key) { if (GC_CLI) { return gplcart_array_get($this->context, $key); } return $this->session->get("install.context.$key"); }
Returns a value from the current context @param string $key @return mixed
entailment
protected function setContextError($step, $message) { $pos = count($this->getContext("errors.$step")) + 1; $this->setContext("errors.$step.$pos", $message); }
Sets context error message @param integer $step @param string $message
entailment
protected function getContextErrors($flatten = true) { $errors = $this->getContext('errors'); if (empty($errors)) { return array(); } if ($flatten) { return gplcart_array_flatten($errors); } return $errors; }
Returns an array of context errors @param bool $flatten @return array
entailment
protected function createCountries() { $rows = $placeholders = array(); foreach ((array) $this->getCountryModel()->getIso() as $code => $country) { $placeholders[] = '(?,?,?,?,?)'; $native_name = empty($country['native_name']) ? $country['name'] : $country['native_name']; ...
Creates countries from ISO list
entailment
protected function start() { set_time_limit(0); $this->session->delete('user'); $this->session->delete('install'); $this->session->set('install.data', $this->data); }
Does initial tasks before installation
entailment
protected function getSuccessMessage() { if (GC_CLI) { $vars = array('@url' => rtrim("{$this->data['store']['host']}/{$this->data['store']['basepath']}", '/')); return $this->translation->text("Your store has been installed.\nURL: @url\nAdmin area: @url/admin\nGood luck!", $vars); ...
Returns success message @return string
entailment