_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q1600
CommaListNode.appendItem
train
public function appendItem(Node $item) { if ($this->getItems()->isEmpty()) { $this->append($item); } else { $this->append([ Token::comma(), Token::space(), $item, ]); } return $this; }
php
{ "resource": "" }
q1601
CommaListNode.insertItem
train
public function insertItem(Node $item, $index) { $items = $this->getItems(); if ($items->isEmpty()) { if ($index !== 0) { throw new \OutOfBoundsException('index out of bounds'); } $this->append($item); } else { $max_index = count($items) - 1; if ($index < 0 || $inde...
php
{ "resource": "" }
q1602
CommaListNode.pop
train
public function pop() { $items = $this->getItems(); if ($items->isEmpty()) { return NULL; } if (count($items) === 1) { $pop_item = $items[0]; $pop_item->remove(); return $pop_item; } $pop_item = $items[count($items) - 1]; $pop_item->previousUntil(function ($node) { ...
php
{ "resource": "" }
q1603
CommaListNode.shift
train
public function shift() { $items = $this->getItems(); if ($items->isEmpty()) { return NULL; } if (count($items) === 1) { $pop_item = $items[0]; $pop_item->remove(); return $pop_item; } $pop_item = $items[0]; $pop_item->nextUntil(function ($node) { if ($node inst...
php
{ "resource": "" }
q1604
CommaListNode.toArrayNode
train
public function toArrayNode() { return ($this->parent instanceof ArrayNode) ? clone $this->parent : Parser::parseExpression('[' . $this->getText() . ']'); }
php
{ "resource": "" }
q1605
AbstractPaymentModule.generateGatewayFormResponse
train
public function generateGatewayFormResponse($order, $gateway_url, $form_data) { /** @var ParserInterface $parser */ $parser = $this->getContainer()->get("thelia.parser"); $parser->setTemplateDefinition( $parser->getTemplateHelper()->getActiveFrontTemplate() ); $...
php
{ "resource": "" }
q1606
AbstractPaymentModule.getPaymentSuccessPageUrl
train
public function getPaymentSuccessPageUrl($order_id) { $frontOfficeRouter = $this->getContainer()->get('router.front'); return URL::getInstance()->absoluteUrl( $frontOfficeRouter->generate( "order.placed", array("order_id" => $order_id), Ro...
php
{ "resource": "" }
q1607
PermissionsPresenter.handleClearCacheACL
train
public function handleClearCacheACL(): void { if ($this->isAjax()) { $this->authorizatorFactory->cleanCache(); $this->flashNotifier->success('cms.permissions.aclCacheCleared'); } else { $this->terminate(); } }
php
{ "resource": "" }
q1608
PermissionsPresenter.setRoleName
train
public function setRoleName(int $id, string $value): void { if ($this->isAjax()) { $grid = $this['rolesList']; try { $role = $this->orm->aclRoles->getById($id); $role->setName($value); $this->orm->persistAndFlush($role); $this->flashNotifier->success('default.dataSaved'); } catch (UniqueCons...
php
{ "resource": "" }
q1609
PermissionsPresenter.setRoleParent
train
public function setRoleParent(int $id, string $value): void { if ($this->isAjax()) { $role = $this->orm->aclRoles->getById($id); $role->parent = $value; $this->orm->persistAndFlush($role); $this->flashNotifier->success('default.dataSaved'); $this['rolesList']->redrawItem($id); } else { $this->te...
php
{ "resource": "" }
q1610
PermissionsPresenter.setPermissionRole
train
public function setPermissionRole(int $id, int $value): void { if ($this->isAjax()) { $acl = $this->orm->acl->getById($id); $acl->role = $value; $this->orm->persistAndFlush($acl); $this->flashNotifier->success('default.dataSaved'); $this['permissionsList']->redrawItem($id); } else { $this->term...
php
{ "resource": "" }
q1611
PermissionsPresenter.setPermissionResource
train
public function setPermissionResource(int $id, int $value): void { if ($this->isAjax()) { $acl = $this->orm->acl->getById($id); $acl->resource = $value; $this->orm->persistAndFlush($acl); $this->flashNotifier->success('default.dataSaved'); $this['permissionsList']->redrawItem($id); } else { $th...
php
{ "resource": "" }
q1612
PermissionsPresenter.setPermissionPrivilege
train
public function setPermissionPrivilege(int $id, string $value): void { if ($this->isAjax()) { $permission = $this->orm->acl->getById($id); $permission->privilege = $value; $this->orm->persistAndFlush($permission); $this->flashNotifier->success('default.dataSaved'); $this['permissionsList']->redrawIt...
php
{ "resource": "" }
q1613
PermissionsPresenter.setPermissionState
train
public function setPermissionState(int $id, bool $value): void { if ($this->isAjax()) { $permission = $this->orm->acl->getById($id); $permission->allowed = $value; $this->orm->persistAndFlush($permission); $this->flashNotifier->success('default.dataSaved'); $this['permissionsList']->redrawItem($id);...
php
{ "resource": "" }
q1614
FunctionDeclarationNode.create
train
public static function create($function_name, $parameters = NULL) { /** @var FunctionDeclarationNode $function */ $function = Parser::parseSnippet("function $function_name() {}"); if (is_array($parameters)) { foreach ($parameters as $parameter) { if (is_string($parameter)) { $paramet...
php
{ "resource": "" }
q1615
FunctionDeclarationNode.setName
train
public function setName($name) { /** @var TokenNode $function_name */ $function_name = $this->getName()->firstChild(); $function_name->setText($name); return $this; }
php
{ "resource": "" }
q1616
CurrencyController.updateRatesAction
train
public function updateRatesAction() { // Check current user authorization if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) { return $response; } try { $event = new CurrencyUpdateRateEvent(); $this->d...
php
{ "resource": "" }
q1617
CurrencyController.setVisibleAction
train
public function setVisibleAction() { // Check current user authorization if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) { return $response; } $changeEvent = new CurrencyUpdateEvent((int) $this->getRequest()->get('currency_...
php
{ "resource": "" }
q1618
TwilioFactory.make
train
public function make(array $config) { Arr::requires($config, ['from', 'client', 'token']); $client = new Client(); return new TwilioGateway($client, $config); }
php
{ "resource": "" }
q1619
ClassMethodNode.fromFunction
train
public static function fromFunction(FunctionDeclarationNode $function_node) { $method_name = $function_node->getName()->getText(); $parameters = $function_node->getParameterList()->getText(); $body = $function_node->getBody()->getText(); /** @var ClassNode $class_node */ $class_node = Parser::parseS...
php
{ "resource": "" }
q1620
InterfaceNode.getMethod
train
public function getMethod($name) { $methods = $this ->getMethods() ->filter(function (InterfaceMethodNode $method) use ($name) { return $method->getName()->getText() === $name; }); return $methods->isEmpty() ? NULL : $methods[0]; }
php
{ "resource": "" }
q1621
InterfaceNode.appendMethod
train
public function appendMethod($method) { if (is_string($method)) { $method = InterfaceMethodNode::create($method); } $this->statements->lastChild()->before($method); FormatterFactory::format($this); return $this; }
php
{ "resource": "" }
q1622
Address.makeItDefault
train
public function makeItDefault() { AddressQuery::create()->filterByCustomerId($this->getCustomerId()) ->update(array('IsDefault' => '0')); $this->setIsDefault(1); $this->save(); }
php
{ "resource": "" }
q1623
Address.preInsert
train
public function preInsert(ConnectionInterface $con = null) { parent::preInsert($con); $this->dispatchEvent(TheliaEvents::BEFORE_CREATEADDRESS, new AddressEvent($this)); return true; }
php
{ "resource": "" }
q1624
Address.postInsert
train
public function postInsert(ConnectionInterface $con = null) { parent::postInsert($con); $this->dispatchEvent(TheliaEvents::AFTER_CREATEADDRESS, new AddressEvent($this)); }
php
{ "resource": "" }
q1625
Address.preUpdate
train
public function preUpdate(ConnectionInterface $con = null) { parent::preUpdate($con); $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEADDRESS, new AddressEvent($this)); return true; }
php
{ "resource": "" }
q1626
Address.postUpdate
train
public function postUpdate(ConnectionInterface $con = null) { parent::postUpdate($con); $this->dispatchEvent(TheliaEvents::AFTER_UPDATEADDRESS, new AddressEvent($this)); }
php
{ "resource": "" }
q1627
Address.preDelete
train
public function preDelete(ConnectionInterface $con = null) { parent::preDelete($con); if ($this->getIsDefault()) { return false; } $this->dispatchEvent(TheliaEvents::BEFORE_DELETEADDRESS, new AddressEvent($this)); return true; }
php
{ "resource": "" }
q1628
Address.postDelete
train
public function postDelete(ConnectionInterface $con = null) { parent::postDelete($con); $this->dispatchEvent(TheliaEvents::AFTER_DELETEADDRESS, new AddressEvent($this)); }
php
{ "resource": "" }
q1629
Start.loadPluginTextdomain
train
private function loadPluginTextdomain() { load_textdomain( $this->textdomain, $this->configs->get( 'libraryDir' ) . 'languages/' . $this->textdomain . '-' . get_locale() . '.mo' ); }
php
{ "resource": "" }
q1630
Start.loadPluginInstaller
train
public function loadPluginInstaller() { if ( ! did_action( 'Boldgrid\Library\Library\Start::loadPluginInstaller' ) ) { do_action( 'Boldgrid\Library\Library\Start::loadPluginInstaller' ); if ( class_exists( '\Boldgrid\Library\Plugin\Installer' ) ) { $this->pluginInstaller = new \Boldgrid\Library\Plugin\Inst...
php
{ "resource": "" }
q1631
Start.filterConfigs
train
public function filterConfigs( $configs ) { if ( ! empty( $configs['libraryDir'] ) ) { $configs['libraryUrl'] = str_replace( ABSPATH, get_site_url() . '/', $configs['libraryDir'] ); } return $configs; }
php
{ "resource": "" }
q1632
ImportCommand.listImport
train
protected function listImport(OutputInterface $output) { $table = new Table($output); foreach ((new ImportQuery)->find() as $import) { $table->addRow([ $import->getRef(), $import->getTitle(), $import->getDescription() ]); ...
php
{ "resource": "" }
q1633
ActiveResource._build_xml
train
public function _build_xml ($k, $v) { if (is_object ($v) && strtolower (get_class ($v)) == 'simplexmlelement') { return preg_replace ('/<\?xml(.*?)\?>\n*/', '', $v->asXML ()); } $res = ''; $attrs = ''; if (! is_numeric ($k)) { $res = '<' . $k . '{{attributes}}>'; } if (is_object ($v)) { $v = (arr...
php
{ "resource": "" }
q1634
ActiveResource._unicode_ord
train
public function _unicode_ord (&$c, &$i = 0) { // get the character length $l = strlen($c); // copy the offset $index = $i; // check it's a valid offset if ($index >= $l) { return false; } // check the value $o = ord($c[$index]); // if it's ascii if ($o <= 0x7F) { return $o; // ...
php
{ "resource": "" }
q1635
ActiveResource._xml_entities
train
public function _xml_entities ($s, $hex = true) { // if the string is empty if (empty($s)) { // just return it return $s; } $s = (string) $s; // create the return string $r = ''; // get the length $l = strlen($s); // iterate the string for ($i = 0; $i < $l; $i++) { // get the value of...
php
{ "resource": "" }
q1636
ActiveResource._fetch
train
public function _fetch ($url, $method, $params) { if (! extension_loaded ('curl')) { $this->error = 'cURL extension not loaded.'; return false; } $ch = curl_init (); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_MAXREDIRS, 3); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); curl_set...
php
{ "resource": "" }
q1637
ActiveResource.set
train
public function set ($k, $v = false) { if (! $v && is_array ($k)) { foreach ($k as $key => $value) { $this->_data[$key] = $value; } } else { $this->_data[$k] = $v; } return $this; }
php
{ "resource": "" }
q1638
BasePaymentModuleController.getLog
train
protected function getLog() { if ($this->log == null) { $this->log = Tlog::getNewInstance(); $logFilePath = $this->getLogFilePath(); $this->log->setPrefix("#LEVEL: #DATE #HOUR: "); $this->log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationFile"...
php
{ "resource": "" }
q1639
BasePaymentModuleController.confirmPayment
train
public function confirmPayment($orderId) { try { $orderId = \intval($orderId); if (null !== $order = $this->getOrder($orderId)) { $this->getLog()->addInfo( $this->getTranslator()->trans( "Processing confirmation of order re...
php
{ "resource": "" }
q1640
BasePaymentModuleController.getOrder
train
protected function getOrder($orderId) { if (null == $order = OrderQuery::create()->findPk($orderId)) { $this->getLog()->addError( $this->getTranslator()->trans("Unknown order ID: %id", array('%id' => $orderId)) ); } return $order; }
php
{ "resource": "" }
q1641
BasePaymentModuleController.redirectToSuccessPage
train
public function redirectToSuccessPage($orderId) { $this->getLog()->addInfo("Redirecting customer to payment success page"); throw new RedirectException( $this->retrieveUrlFromRouteId( 'order.placed', [], [ 'order_id' =>...
php
{ "resource": "" }
q1642
GitterFactory.make
train
public function make(array $config) { Arr::requires($config, ['token']); $client = new Client(); return new GitterGateway($client, $config); }
php
{ "resource": "" }
q1643
Sale.getPriceOffsets
train
public function getPriceOffsets() { $currencyOffsets = SaleOffsetCurrencyQuery::create()->filterBySaleId($this->getId())->find(); $offsetList = []; /** @var SaleOffsetCurrency $currencyOffset */ foreach ($currencyOffsets as $currencyOffset) { $offsetList[$currencyOffset...
php
{ "resource": "" }
q1644
Sale.getSaleProductList
train
public function getSaleProductList() { $saleProducts = SaleProductQuery::create()->filterBySaleId($this->getId())->groupByProductId()->find(); return $saleProducts; }
php
{ "resource": "" }
q1645
Sale.getSaleProductsAttributeList
train
public function getSaleProductsAttributeList() { $saleProducts = SaleProductQuery::create()->filterBySaleId($this->getId())->orderByProductId()->find(); $selectedAttributes = []; $currentProduct = false; /** @var SaleProduct $saleProduct */ foreach ($saleProducts as $saleP...
php
{ "resource": "" }
q1646
DefaultController.noAction
train
public function noAction(Request $request) { $view = null; if (! $view = $request->query->get('view')) { if ($request->request->has('view')) { $view = $request->request->get('view'); } } if (null !== $view) { $request->attributes->...
php
{ "resource": "" }
q1647
ConditionEvaluator.isMatching
train
public function isMatching(ConditionCollection $conditions) { $isMatching = true; /** @var ConditionInterface $condition */ foreach ($conditions as $condition) { if (!$condition->isMatching()) { return false; } } return $isMatching; ...
php
{ "resource": "" }
q1648
ConditionEvaluator.variableOpComparison
train
public function variableOpComparison($v1, $o, $v2) { switch ($o) { case Operators::DIFFERENT: // != return ($v1 != $v2); case Operators::SUPERIOR: // > return ($v1 > $v2); case Operators::SUPERIOR_OR_EQUAL:...
php
{ "resource": "" }
q1649
BaseHookRenderEvent.getArgument
train
public function getArgument($key, $default = null) { return array_key_exists($key, $this->arguments) ? $this->arguments[$key] : $default; }
php
{ "resource": "" }
q1650
BaseHookRenderEvent.getTemplateVar
train
public function getTemplateVar($templateVariableName) { if (! isset($this->templateVars[$templateVariableName])) { throw new \InvalidArgumentException(sprintf("Template variable '%s' is not defined.", $templateVariableName)); } return $this->templateVars[$templateVariableName]; ...
php
{ "resource": "" }
q1651
FilterRuleTags.sanitizeValue
train
public function sanitizeValue() { $strColNameId = $this->objAttribute->get('tag_id') ?: 'id'; $strColNameAlias = $this->objAttribute->get('tag_alias'); $arrValues = \is_array($this->value) ? $this->value : \explode(',', $this->value); if (!$this->isMetaModel()) { ...
php
{ "resource": "" }
q1652
NotifyMeFactory.make
train
public function make(array $config) { if (!isset($config['driver'])) { throw new InvalidArgumentException('A driver must be specified.'); } return $this->factory($config['driver'])->make($config); }
php
{ "resource": "" }
q1653
NotifyMeFactory.factory
train
public function factory($name) { if (isset($this->factories[$name])) { return $this->factories[$name]; } if (class_exists($class = $this->inflect($name))) { return $this->factories[$name] = new $class(); } throw new InvalidArgumentException("Unsuppor...
php
{ "resource": "" }
q1654
Category.getRoot
train
public function getRoot($categoryId) { $category = CategoryQuery::create()->findPk($categoryId); if (0 !== $category->getParent()) { $parentCategory = CategoryQuery::create()->findPk($category->getParent()); if (null !== $parentCategory) { $categoryId = $thi...
php
{ "resource": "" }
q1655
LoaderFactory.addRemoteFile
train
public function addRemoteFile(string $file, string $locale = null): self { $collection = $this->getCollection($this->getType($file), $locale); $collection->addRemoteFile($file); return $this; }
php
{ "resource": "" }
q1656
LoaderFactory.createCssLoader
train
public function createCssLoader(): CssLoader { $compiler = Compiler::createCssCompiler($this->files[self::CSS][null], $this->wwwDir . '/' . $this->outputDir); foreach ($this->filters[self::CSS] as $filter) { $compiler->addFileFilter($filter); } return new CssLoader($compiler, $this->httpRequest->getUrl()->b...
php
{ "resource": "" }
q1657
LoaderFactory.createJavaScriptLoader
train
public function createJavaScriptLoader(string $locale = null): JavaScriptLoader { $compilers[] = $this->createJSCompiler($this->files[self::JS][null]); if ($locale !== null && isset($this->files[self::JS][$locale])) { $compilers[] = $this->createJSCompiler($this->files[self::JS][$locale]); } return new Jav...
php
{ "resource": "" }
q1658
LoaderFactory.getCollection
train
private function getCollection(string $type, string $locale = null): FileCollection { if (!isset($this->files[$type][$locale])) { $this->files[$type][$locale] = new FileCollection($this->root); } return $this->files[$type][$locale]; }
php
{ "resource": "" }
q1659
LoaderFactory.getType
train
private function getType(string $file): string { $css = '/\.(css|less)$/'; $js = '/\.js$/'; if (preg_match($css, $file)) { return self::CSS; } elseif (preg_match($js, $file)) { return self::JS; } throw new InvalidArgumentException("Unknown assets file '$file'"); }
php
{ "resource": "" }
q1660
Product.getDefaultCategoryId
train
protected function getDefaultCategoryId($product) { $defaultCategoryId = null; if ((bool) $product->getVirtualColumn('is_default_category')) { $defaultCategoryId = $product->getVirtualColumn('default_category_id'); } else { $defaultCategoryId = $product->getDefaultCat...
php
{ "resource": "" }
q1661
ProfilePresenter.createComponentPasswordForm
train
protected function createComponentPasswordForm(): Form { $form = $this->formFactory->create(); $form->setAjaxRequest(); $form->addPassword('oldPassword', 'cms.user.oldPassword') ->setRequired(); $form->addPassword('password', 'cms.user.newPassword') ->setRequired() ->addRule(Form::MIN_LENGTH, null, ...
php
{ "resource": "" }
q1662
ProductSaleElement.create
train
public function create(ProductSaleElementCreateEvent $event) { $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); $con->beginTransaction(); try { // Check if we have a PSE without combination, this is the "default" PSE. Attach the combination to this...
php
{ "resource": "" }
q1663
ProductSaleElement.update
train
public function update(ProductSaleElementUpdateEvent $event) { $salesElement = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId()); $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); $con->beginTransaction(); try { ...
php
{ "resource": "" }
q1664
ProductSaleElement.delete
train
public function delete(ProductSaleElementDeleteEvent $event) { if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) { $product = $pse->getProduct(); $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); ...
php
{ "resource": "" }
q1665
ProductSaleElement.generateCombinations
train
public function generateCombinations(ProductCombinationGenerationEvent $event) { $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); $con->beginTransaction(); try { // Delete all product's productSaleElement ProductSaleElementsQuery::creat...
php
{ "resource": "" }
q1666
ProductSaleElement.createCombination
train
protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes) { foreach ($combinationAttributes as $attributeAvId) { $attributeAv = AttributeAvQuery::create()->findPk($attributeAvId); if ($attributeAv !== null) { ...
php
{ "resource": "" }
q1667
ProductSaleElement.clonePSE
train
public function clonePSE(ProductCloneEvent $event) { $clonedProduct = $event->getClonedProduct(); // Get original product's PSEs $originalProductPSEs = ProductSaleElementsQuery::create() ->orderByIsDefault(Criteria::DESC) ->findByProductId($event->getOriginalProduct(...
php
{ "resource": "" }
q1668
Customer.getCustomerLang
train
public function getCustomerLang() { $lang = $this->getLangModel(); if ($lang === null) { $lang = (new LangQuery) ->filterByByDefault(1) ->findOne() ; } return $lang; }
php
{ "resource": "" }
q1669
Customer.setPassword
train
public function setPassword($password) { if ($this->isNew() && ($password === null || trim($password) == "")) { throw new InvalidArgumentException("customer password is mandatory on creation"); } if ($password !== null && trim($password) != "") { $this->setAlgo("PASS...
php
{ "resource": "" }
q1670
Plugin.getDownloadUrl
train
public function getDownloadUrl() { $url = Configs::get( 'api' ) . '/v1/plugins/' . $this->slug . '/download'; $url = add_query_arg( 'key', Configs::get( 'key' ), $url ); return $url; }
php
{ "resource": "" }
q1671
DatabasePresenter.createComponentUploadForm
train
protected function createComponentUploadForm(): Form { $form = $this->formFactory->create(); $form->addUpload('sql', 'cms.database.file') ->setRequired(); $form->addSubmit('upload', 'cms.database.upload'); $form->onSuccess[] = [$this, 'uploadFormSucceeded']; return $form; }
php
{ "resource": "" }
q1672
PlatformServiceConfig.getSolrType
train
public static function getSolrType() { $relationships = PlatformAppConfig::get('relationships'); if (!isset($relationships['solr'])) { return FALSE; } list($solr_key, ) = explode(':', $relationships['solr']); $solr_config = self::get($solr_key); if (!isset($so...
php
{ "resource": "" }
q1673
PlatformServiceConfig.getSolrMajorVersion
train
public static function getSolrMajorVersion() { $type = static::getSolrType(); $version = FALSE; if ($type) { list(, $version) = explode(":", $type); if (preg_match('/^(\d)\./', $version, $matches)) { $version = $matches[1]; } else {...
php
{ "resource": "" }
q1674
ArchiverManager.getArchivers
train
public function getArchivers($isAvailable = null) { if ($isAvailable === null) { return $this->archivers; } $filteredArchivers = []; /** @var \Thelia\Core\Archiver\ArchiverInterface $archiver */ foreach ($this->archivers as $archiver) { if ($archiver...
php
{ "resource": "" }
q1675
ArchiverManager.get
train
public function get($archiverId, $isAvailable = null) { $this->has($archiverId, true); if ($isAvailable === null) { return $this->archivers[$archiverId]; } if ($this->archivers[$archiverId]->isAvailable() === (bool) $isAvailable) { return $this->archivers[$a...
php
{ "resource": "" }
q1676
Message.getMessageBody
train
protected function getMessageBody($parser, $message, $layout, $template, $compressOutput = true) { $body = false; // Try to get the body from template file, if a file is defined if (! empty($template)) { try { $body = $parser->render($template, [], $compressOutpu...
php
{ "resource": "" }
q1677
Message.getHtmlMessageBody
train
public function getHtmlMessageBody(ParserInterface $parser) { return $this->getMessageBody( $parser, $this->getHtmlMessage(), $this->getHtmlLayoutFileName(), $this->getHtmlTemplateFileName() ); }
php
{ "resource": "" }
q1678
Message.getTextMessageBody
train
public function getTextMessageBody(ParserInterface $parser) { $message = $this->getMessageBody( $parser, $this->getTextMessage(), $this->getTextLayoutFileName(), $this->getTextTemplateFileName(), true // Do not compress the output, and keep empty l...
php
{ "resource": "" }
q1679
Message.buildMessage
train
public function buildMessage(ParserInterface $parser, \Swift_Message $messageInstance, $useFallbackTemplate = true) { // Set mail template, and save the current template $parser->pushTemplateDefinition( $parser->getTemplateHelper()->getActiveMailTemplate(), $useFallbackTempla...
php
{ "resource": "" }
q1680
PlatformController.renderPlatformModalContentAction
train
public function renderPlatformModalContentAction() { $pids_id = $this->params()->fromQuery('id'); // Get Cms Platform ID form from App Tool $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig'); $genericPlatformForm = $melisMelisCoreConfig->getFormMergedAndOrdered('...
php
{ "resource": "" }
q1681
PlatformController.getPlatformList
train
public function getPlatformList() { $success = 0; $data = array(); if($this->getRequest()->isPost()){ $success = 0; $platform = $this->getServiceLocator()->get("Melisplatform"); $data = $platform->getPlatformList(); } return $data; ...
php
{ "resource": "" }
q1682
ExportHandler.getExport
train
public function getExport($exportId, $dispatchException = false) { $export = (new ExportQuery)->findPk($exportId); if ($export === null && $dispatchException) { throw new \ErrorException( Translator::getInstance()->trans( 'There is no id "%id" in the ...
php
{ "resource": "" }
q1683
ExportHandler.getExportByRef
train
public function getExportByRef($exportRef, $dispatchException = false) { $export = (new ExportQuery)->findOneByRef($exportRef); if ($export === null && $dispatchException) { throw new \ErrorException( Translator::getInstance()->trans( 'There is no ref...
php
{ "resource": "" }
q1684
ExportHandler.getCategory
train
public function getCategory($exportCategoryId, $dispatchException = false) { $category = (new ExportCategoryQuery)->findPk($exportCategoryId); if ($category === null && $dispatchException) { throw new \ErrorException( Translator::getInstance()->trans( ...
php
{ "resource": "" }
q1685
ExportHandler.processExportImages
train
protected function processExportImages(AbstractExport $export, ArchiverInterface $archiver) { foreach ($export->getImagesPaths() as $imagePath) { $archiver->add($imagePath); } }
php
{ "resource": "" }
q1686
ExportHandler.processExportDocuments
train
protected function processExportDocuments(AbstractExport $export, ArchiverInterface $archiver) { foreach ($export->getDocumentsPaths() as $documentPath) { $archiver->add($documentPath); } }
php
{ "resource": "" }
q1687
BaseI18nLoop.configureI18nProcessing
train
protected function configureI18nProcessing( ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false ) { /* manage translations */ $this->locale = ModelCriteriaToo...
php
{ "resource": "" }
q1688
ArrayNode.isMultidimensional
train
public function isMultidimensional() { foreach ($this->elements->getItems() as $element) { if ($element instanceof ArrayPairNode) { if ($element->getValue() instanceof ArrayNode) { return TRUE; } } elseif ($element instanceof ArrayNode) { return TRUE; } ...
php
{ "resource": "" }
q1689
ArrayNode.toValue
train
public function toValue() { $ret = array(); foreach ($this->elements->getItems() as $element) { if ($element instanceof ArrayNode) { $ref[] = $element->toValue(); } elseif ($element instanceof ArrayPairNode) { $key = $element->getKey(); $value = $element->getValue(); ...
php
{ "resource": "" }
q1690
ArrayNode.hasKey
train
public function hasKey($key, $recursive = TRUE) { if (!($key instanceof ExpressionNode) && !is_scalar($key)) { throw new \InvalidArgumentException(); } $keys = $this->getKeys($recursive); if (is_scalar($key)) { return $keys ->filter(Filter::isInstanceOf('\Pharborist\Types\ScalarNode...
php
{ "resource": "" }
q1691
ArrayNode.getKeys
train
public function getKeys($recursive = TRUE) { $keys = new NodeCollection(); $index = 0; foreach ($this->elements->getItems() as $element) { if ($element instanceof ArrayPairNode) { $keys->add($element->getKey()); $value = $element->getValue(); } else { $keys->add(Tok...
php
{ "resource": "" }
q1692
ArrayNode.getValues
train
public function getValues($recursive = TRUE) { $values = new NodeCollection(); foreach ($this->elements->getItems() as $element) { if ($element instanceof ArrayPairNode) { $value = $element->getValue(); if ($recursive && $value instanceof ArrayNode) { $values->add($value->getValu...
php
{ "resource": "" }
q1693
ExportController.configureAction
train
public function configureAction($id) { /** @var \Thelia\Handler\Exporthandler $exportHandler */ $exportHandler = $this->container->get('thelia.export.handler'); $export = $exportHandler->getExport($id); if ($export === null) { return $this->pageNotFound(); } ...
php
{ "resource": "" }
q1694
ExportController.exportAction
train
public function exportAction($id) { /** @var \Thelia\Handler\Exporthandler $exportHandler */ $exportHandler = $this->container->get('thelia.export.handler'); $export = $exportHandler->getExport($id); if ($export === null) { return $this->pageNotFound(); } ...
php
{ "resource": "" }
q1695
TokenIterator.current
train
public function current() { if ($this->position >= $this->length) { return NULL; } return $this->tokens[$this->position]; }
php
{ "resource": "" }
q1696
TokenIterator.peek
train
public function peek($offset) { if ($this->position + $offset >= $this->length) { return NULL; } return $this->tokens[$this->position + $offset]; }
php
{ "resource": "" }
q1697
TokenIterator.next
train
public function next() { $this->position++; if ($this->position >= $this->length) { $this->position = $this->length; return NULL; } return $this->tokens[$this->position]; }
php
{ "resource": "" }
q1698
YoFactory.make
train
public function make(array $config) { Arr::requires($config, ['token']); $client = new Client(); return new YoGateway($client, $config); }
php
{ "resource": "" }
q1699
OrderStatus.isNotPaid
train
public function isNotPaid($exact = true) { //return $this->hasStatusHelper(OrderStatus::CODE_NOT_PAID); if ($exact) { return $this->hasStatusHelper(OrderStatus::CODE_NOT_PAID); } else { return ! $this->isPaid(false); } }
php
{ "resource": "" }