_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q11500
FilterHelper.createFilterForm
train
public function createFilterForm($formInputs = null, $plugin = null, $usePrint = true, $exportType = null) { $result = ''; if (empty($formInputs) || !is_array($formInputs)) { return $result; } if ($usePrint) { $urlOptions = $this->_getExtendOptionsPaginationUrl(); if (!isset($this->Paginator->options['url'])) { $this->Paginator->options['url'] = []; }
php
{ "resource": "" }
q11501
FilterHelper.createGroupActionControls
train
public function createGroupActionControls($formInputs = null, $groupActions = null, $useSelectAll = false) { $result = ''; if (empty($formInputs) || !is_array($formInputs) || (!empty($groupActions) && !is_array($groupActions)) || (empty($groupActions) && !$useSelectAll)) { return $result; } if (empty($groupActions)) { $groupActions = []; } $colspan = null; $countFormInputs = count($formInputs); if ($countFormInputs > 2) { $colspan = $countFormInputs; } $selectOptions = []; foreach ($groupActions as $value => $text) { $selectOptions[] = compact('text', 'value'); } $tableFoother = []; if ($useSelectAll) { if (!empty($colspan)) { $colspan--; } $tableFoother[] = $this->_getOptionsForElem('createGroupActionControls.selectAllBtn'); } $inputField = ''; if (!empty($selectOptions)) { $this->ExtBs3Form->unlockField('FilterGroup.action'); $tableFoother[] = [
php
{ "resource": "" }
q11502
FilterHelper.createFilterRowCheckbox
train
public function createFilterRowCheckbox($inputField = null, $value = null) { $result = ''; if (is_array($inputField)) { $inputField = array_keys($inputField); $inputField = (string)array_shift($inputField); } if (empty($inputField) || (strpos($inputField, '.') === false)) { return $result; } $uniqid = uniqid(); $dataPath = 'FilterData.0.' . $inputField; $inputFieldName = $dataPath . '.'; $data = (array)$this->request->data($dataPath); $options = [ 'value' => $value, 'checked ' => in_array($value, $data), 'hiddenField' => false,
php
{ "resource": "" }
q11503
FilterHelper.getBtnConditionGroup
train
public function getBtnConditionGroup($inputCondField = null) { $options = $this->_getOptionsForElem('getBtnConditionGroup.options'); $title =
php
{ "resource": "" }
q11504
FilterHelper._getFilterRequestData
train
protected function _getFilterRequestData($baseKey = null, $key = null) { $filterData = []; if (empty($baseKey)) { return $filterData; } if ($this->_getFlagUsePost()) { $requestData = $this->request->data($baseKey); if (!empty($requestData)) { $filterData = $requestData; } } else { $requestData = $this->request->query('data.' . $baseKey); if (!empty($requestData)) { $filterData
php
{ "resource": "" }
q11505
FilterHelper._getExtendOptionsPaginationUrl
train
protected function _getExtendOptionsPaginationUrl() { $options = []; $ext = (string)$this->request->param('ext'); $ext = mb_strtolower($ext); if (empty($ext)
php
{ "resource": "" }
q11506
Manialink.destroy
train
public function destroy() { // This is not mandatory as GC will free the memory eventually but allows memory to be freed faster // by removing circular dependencies. if (!empty($this->data)) { foreach ($this->data as $data) {
php
{ "resource": "" }
q11507
GraphViz.getView
train
private function getView(string $name, array $data = []) { $filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%'); $templating
php
{ "resource": "" }
q11508
JsWriterAbstract.getFiles
train
public function getFiles() { $files = $this->files; foreach ($this->types as $type) { $files = array_merge($files, $type->getFiles()); } $path = \Altamira\Config::getInstance()->getPluginPath( $this->getLibrary() );
php
{ "resource": "" }
q11509
JsWriterAbstract.getOptionsForSeries
train
public function getOptionsForSeries( $series ) { $seriesTitle = $this->getSeriesTitle( $series ); if (! isset( $this->options['seriesStorage'][$seriesTitle] ) ) { throw new \Exception(
php
{ "resource": "" }
q11510
JsWriterAbstract.getSeriesOption
train
public function getSeriesOption( $series, $option, $default = null ) { $seriesTitle = $this->getSeriesTitle( $series ); return ( isset( $this->options['seriesStorage'][$seriesTitle] ) &&
php
{ "resource": "" }
q11511
JsWriterAbstract.setSeriesOption
train
public function setSeriesOption( $series, $name, $value ) { $this->setNestedOptVal( $this->options, 'seriesStorage',
php
{ "resource": "" }
q11512
JsWriterAbstract.setType
train
public function setType( $type, $options = array(), $series = 'default' ) { $options = $options ?: array(); // i shouldn't have to do this $className = $this->typeNamespace . ucwords( $type ); if( class_exists( $className ) ) { $type = new $className( $this ); } else { throw new \Exception( "Type {$type} does not exist" ); } $type->setOptions( $options ); $series = $this->getSeriesTitle( $series ); $this->types[$series] = $type; if ( isset( $this->options['seriesStorage'][$series] ) ) { $this->options['seriesStorage'][$series] =
php
{ "resource": "" }
q11513
JsWriterAbstract.getType
train
public function getType( $series = null ) { $series = $series ?: 'default'; $seriesTitle = $this->getSeriesTitle( $series );
php
{ "resource": "" }
q11514
JsWriterAbstract.setNestedOptVal
train
protected function setNestedOptVal( array &$options, $arg ) { //@codeCoverageIgnoreStart $args = func_get_args(); if ( count( $args ) == 2 && is_array( $args[1] ) ) { $args = $args[1]; } else if ( count( $args ) < 3 ) { throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::setNestedOptVal requires at least three arguments' ); } else { array_shift( $args ); } do { $arg
php
{ "resource": "" }
q11515
JsWriterAbstract.getNestedOptVal
train
protected function getNestedOptVal( array $options, $arg ) { //@codeCoverageIgnoreStart $args = func_get_args(); if ( count( $args ) == 2 && is_array( $args[1] ) ) { $args = $args[1]; } else if ( count( $args ) < 3 ) { throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::getNestedOptVal requires at least three arguments' );
php
{ "resource": "" }
q11516
MainMenuBuilderListener.onMainMenuBuild
train
public function onMainMenuBuild(MenuBuilderEvent $event): void { if (!$this->authorizationChecker->isGranted('ROLE_NGBM_ADMIN')) {
php
{ "resource": "" }
q11517
Bar.setOption
train
public function setOption($name, $value) { switch ($name) { case 'horizontal': $this->options['bars']['horizontal'] = $value; break; case 'stackSeries': $this->pluginFiles[] = 'jquery.flot.stack.js'; $this->options['series']['stack'] = true; break;
php
{ "resource": "" }
q11518
SlackHandler.prepareContentData
train
protected function prepareContentData($record) { $dataArray = array( 'token' => $this->token, 'channel' => $this->channel, 'username' => $this->username, 'text' => '', 'attachments' => array(), ); if ($this->formatter) { $message = $this->formatter->format($record); } else { $message = $record['message']; } if ($this->useAttachment) { $attachment = array( 'fallback' => $message, 'color' => $this->getAttachmentColor($record['level']), 'fields' => array(), ); if ($this->useShortAttachment) { $attachment['title'] = $record['level_name']; $attachment['text'] = $message; } else { $attachment['title'] = 'Message'; $attachment['text'] = $message; $attachment['fields'][] = array( 'title' => 'Level', 'value' => $record['level_name'], 'short' => true, ); } if ($this->includeContextAndExtra) { if (!empty($record['extra'])) { if ($this->useShortAttachment) { $attachment['fields'][] = array(
php
{ "resource": "" }
q11519
CacheManager.getCache
train
public function getCache(string $name='') { # Find the cache (if we already have it created) $cache = $this->findCache($name); if (\is_null($cache)) { # Attempt to create the cache
php
{ "resource": "" }
q11520
CacheManager.findCache
train
public function findCache(string $name='') { if ( empty($name) ) { # Take first available $cache = \reset($this->caches); if ($cache === false) return null; } else { # Attempt to
php
{ "resource": "" }
q11521
CacheManager.addCache
train
public function addCache(AbstractCacheAdapterInterface $cache)
php
{ "resource": "" }
q11522
CacheManager.removeCache
train
public function removeCache(string $name) { # Sanity check if (empty($name)) return false; $cache = $this->findCache($name);
php
{ "resource": "" }
q11523
MenuItems.registerConfigItems
train
protected function registerConfigItems(ParentItem $root, $parentId, $configItems) { foreach ($configItems as $configId => $configItem) { $subItems = reset($configItem); $path = $parentId . '/' . $configId; $configPath = str_replace("admin/server/config/",'', $path); $translationKey = 'expansion_config.menu.' . implode('.', explode('/', $configPath)) . '.label'; if (is_array($subItems)) { $root->addChild( ParentItem::class, $path, $translationKey, null );
php
{ "resource": "" }
q11524
StreamFactory.createStreamFromFile
train
public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface { # Open the file $resource = \fopen($filename,
php
{ "resource": "" }
q11525
Config.apply
train
public function apply(Injector $injector): void { $dependencies = $this->config['dependencies'] ?? []; // Define the "config" service, accounting for the fact that Auryn // requires all returns are objects. $dependencies['services']['config'] = new ArrayObject($this->config, ArrayObject::ARRAY_AS_PROPS);
php
{ "resource": "" }
q11526
EnchantSpell.&
train
function &getSuggestions($lang, $word) { $r = enchant_broker_init(); $suggs = array(); if (enchant_broker_dict_exists($r,$lang)) {
php
{ "resource": "" }
q11527
AbstractPdfGenerator.generate
train
public function generate(array $parameters = array(), array $options = array()) { $parametersResolver = new OptionsResolver(); $this->setDefaultParameters($parametersResolver);
php
{ "resource": "" }
q11528
Profiler.finish
train
public static function finish() { if(empty(self::$profiler) === false) { self::$profiler = array_merge([ 'elapsed' => self::getTime(time() - self::$profiler['start']), 'memory' => self::getMemoryUsage(),
php
{ "resource": "" }
q11529
Profiler.getTime
train
public function getTime($seconds) { $dtF = new \DateTime("@0");
php
{ "resource": "" }
q11530
Profiler.getStackCalls
train
private static function getStackCalls() { $i = 1; $result = []; foreach(xdebug_get_function_stack() as $node) { if(isset($node['line']) === true) {
php
{ "resource": "" }
q11531
Profiler.getMemoryUsage
train
private static function getMemoryUsage() { $memory = memory_get_peak_usage(); $floor = floor((strlen($memory) - 1) / 3); return
php
{ "resource": "" }
q11532
Profiler.pretty
train
private static function pretty(array $data) { $color = new Color(); $output = $color->getColoredString(self::VERBOSE_TITLE, 'blue', 'light-gray').PHP_EOL; foreach($data as $key => $value) { if(is_array($value) === false) { $output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, $value), 'dark_gray').PHP_EOL; } else { $output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, ''), 'dark_gray').PHP_EOL; foreach($value as $line => $string) {
php
{ "resource": "" }
q11533
Bootstrap._block_filter_oembed_result
train
public function _block_filter_oembed_result( $response, $handler, $request ) { if ( 'GET' !== $request->get_method() ) { return $response; } if ( is_wp_error( $response ) && 'oembed_invalid_url' !== $response->get_error_code() ) { return $response; } if ( '/oembed/1.0/proxy' !== $request->get_route() ) { return $response; } $provider_name = 'wp-oembed-blog-card handler'; if ( isset( $response->provider_name ) && $response->provider_name === $provider_name ) { return
php
{ "resource": "" }
q11534
Bootstrap._maybe_refresh_cache
train
protected function _maybe_refresh_cache( $url ) { $cache = Cache::get( $url ); if ( !
php
{ "resource": "" }
q11535
Bootstrap._render
train
protected function _render( $url ) { $this->_maybe_refresh_cache( $url ); if ( ! is_admin() ) { return $this->_is_block_embed_rendering_request() ? View::get_block_template( $url )
php
{ "resource": "" }
q11536
Bootstrap._is_admin_request
train
protected function _is_admin_request() { if ( ! isset( $_SERVER['REQUEST_URI'] ) ) { return false; } $request_uri = wp_unslash( $_SERVER['REQUEST_URI'] ); // WPCS: sanitization ok. if ( false !== strpos( $request_uri, '/wp-admin/admin-ajax.php' ) ) { return false === strpos( $request_uri, 'action=wp_oembed_blog_card_render' ); }
php
{ "resource": "" }
q11537
XmlInputTextBox.setAutosuggest
train
public function setAutosuggest($context, $url, $paramReq, $jsCallback="", $jsonArray = "select.option", $jsonObjKey = "value", $jsonObjValue = "_text", $jsonObjInfo = "_text") { $this->_context = $context; $this->_autosuggestUrl
php
{ "resource": "" }
q11538
CsvBase.getEncoding
train
public function getEncoding($direction) { if (!isset($this->encoding[$direction])) {
php
{ "resource": "" }
q11539
CsvBase.setEncoding
train
public function setEncoding($direction, $encoding) { if (!isset($this->encoding[$direction])) { throw new Exception("Encoding direction invalid"); } if (!$encoding) { throw new Exception("Encoding value invalid"); } elseif (preg_match('/utf.?8/ui', $encoding)) {
php
{ "resource": "" }
q11540
BaseProcessResult.SearchAndReplace
train
public function SearchAndReplace($buffer) { $context = Context::getInstance(); $posi = 0; $i = strpos($buffer, "<param-", $posi); while ($i !== false) { echo substr($buffer, $posi, $i-$posi); $if = strpos($buffer, "</param-", $i); $tamparam = $if-$i-8;
php
{ "resource": "" }
q11541
PageXml.addJavaScript
train
public function addJavaScript($javascript, $location = 'up') { $nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script",
php
{ "resource": "" }
q11542
AppService.run
train
public function run() { if (PHP_SAPI !== 'cli') { throw new AppServiceException('Warning: Script should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'); } try {
php
{ "resource": "" }
q11543
ManageUsersGroups.getRolesFromSite
train
protected function getRolesFromSite($site) { $newDataSet = new AnyDataset(); $it = $this->user->getRolesIterator($site); while ($it->hasNext()) { $sr = $it->moveNext(); $dataArray = $sr->getFieldArray($this->user->getRolesTable()->Role); if (sizeof($dataArray) > 0) { foreach ($dataArray as $roles) { $siteName = $sr->getField($this->user->getRolesTable()->Site); if ($siteName == "_all") { $siteName =
php
{ "resource": "" }
q11544
ManageUsersGroups.AddListLink
train
protected function AddListLink($block) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("action", ModuleAction::Listing); $link = new XmlAnchorCollection($this->url->getUrl(), "");
php
{ "resource": "" }
q11545
ManageUsersGroups.AddEditListToSite
train
protected function AddEditListToSite($block, $site, $dataset) { $para = new XmlParagraphCollection(); $this->_mainBlock->addXmlnukeObject($para); $this->url->addParam("editsite", $site); $editList = new XmlEditList($this->_context, $this->myWords->Value("EDITLIST_TITLE", $site), $this->url->getUrl(), true, false, true, true); $editList->setDataSource($dataset->getIterator()); $listField = new
php
{ "resource": "" }
q11546
Visitor.setUa
train
public function setUa($ua) { $this->ua = $this->detector->setUserAgent($ua);
php
{ "resource": "" }
q11547
Visitor.setBrowser
train
private function setBrowser() { $client = parse_user_agent($this->detector->getUserAgent()); $this->browser = $client['browser'];
php
{ "resource": "" }
q11548
Visitor.deviceDetect
train
private function deviceDetect() { $this->mobile = (int)$this->detector->isMobile(); $this->tablet = (int)$this->detector->isTablet(); if ($this->mobile === 0 &&
php
{ "resource": "" }
q11549
Visitor.toArray
train
public function toArray() { $properties = get_object_vars($this); foreach($properties as $var => &$value) { if(gettype($value) === 'object') {
php
{ "resource": "" }
q11550
DecimaAccountingServiceProvider.registerAccountChartTypeInterface
train
protected function registerAccountChartTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface', function() { return new
php
{ "resource": "" }
q11551
DecimaAccountingServiceProvider.registerSettingInterface
train
protected function registerSettingInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'); //var_dump($AuthenticationManager->getCurrentUserOrganizationConnection());die();
php
{ "resource": "" }
q11552
DecimaAccountingServiceProvider.registerAccountTypeInterface
train
protected function registerAccountTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11553
DecimaAccountingServiceProvider.registerPeriodInterface
train
protected function registerPeriodInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface', function($app) { $AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
php
{ "resource": "" }
q11554
DecimaAccountingServiceProvider.registerFiscalYearInterface
train
protected function registerFiscalYearInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11555
DecimaAccountingServiceProvider.registerAccountInterface
train
protected function registerAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11556
DecimaAccountingServiceProvider.registerSystemAccountInterface
train
protected function registerSystemAccountInterface() { $this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface', function() { return new
php
{ "resource": "" }
q11557
DecimaAccountingServiceProvider.registerCostCenterInterface
train
protected function registerCostCenterInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11558
DecimaAccountingServiceProvider.registerDocumentTypeInterface
train
protected function registerDocumentTypeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\DocumentTypeInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11559
DecimaAccountingServiceProvider.registerClientInterface
train
protected function registerClientInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Client\ClientInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11560
DecimaAccountingServiceProvider.registerSupplierInterface
train
protected function registerSupplierInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\SupplierInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11561
DecimaAccountingServiceProvider.registerEmployeeInterface
train
protected function registerEmployeeInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EmployeeInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11562
DecimaAccountingServiceProvider.registerApportionmentInterface
train
protected function registerApportionmentInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\ApportionmentInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11563
DecimaAccountingServiceProvider.registerApportionmentEntryInterface
train
protected function registerApportionmentEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\ApportionmentEntryInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11564
DecimaAccountingServiceProvider.registerJournalVoucherInterface
train
protected function registerJournalVoucherInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11565
DecimaAccountingServiceProvider.registerJournalEntryInterface
train
protected function registerJournalEntryInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface', function($app) { $AuthenticationManager
php
{ "resource": "" }
q11566
DecimaAccountingServiceProvider.registerSettingManagementInterface
train
protected function registerSettingManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\SettingManagement\SettingManagementInterface', function($app) { return new SettingManager( $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Setting\SettingInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface'), $app->make('App\Kwaai\System\Repositories\Currency\CurrencyInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\System\Repositories\AccountType\AccountTypeInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface'),
php
{ "resource": "" }
q11567
DecimaAccountingServiceProvider.registerPeriodManagementInterface
train
protected function registerPeriodManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\PeriodManagement\PeriodManagementInterface', function($app) { return new PeriodManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\Period\EloquentPeriodGridRepository( $app['db'], $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app['translator'] ), $app->make('Mgallegos\DecimaAccounting\Accounting\Repositories\Period\PeriodInterface'),
php
{ "resource": "" }
q11568
DecimaAccountingServiceProvider.registerFiscalYearManagementInterface
train
protected function registerFiscalYearManagementInterface() { $this->app->bind('Mgallegos\DecimaAccounting\Accounting\Services\FiscalYearManagement\FiscalYearManagementInterface', function($app) { return new FiscalYearManager( $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface'), $app->make('App\Kwaai\Security\Services\JournalManagement\JournalManagementInterface'), $app->make('Mgallegos\DecimaAccounting\Accounting\Services\JournalManagement\JournalManagementInterface'), $app->make('App\Kwaai\Security\Repositories\Journal\JournalInterface'), new \Mgallegos\LaravelJqgrid\Encoders\JqGridJsonEncoder($app->make('excel')), new \Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\EloquentFiscalYearGridRepository(
php
{ "resource": "" }
q11569
EntityType.getRoot
train
public function getRoot() { $next_parent = $this->getParent(); $parent = null; while ($next_parent) { $parent = $next_parent;
php
{ "resource": "" }
q11570
EntityType.getAttributes
train
public function getAttributes(array $attribute_names = [], array $types = []) { $attribute_map = []; if (empty($attribute_names)) { $attribute_map = $this->attribute_map->getItems(); } else { foreach ($attribute_names as $attribute_name) { $attribute_map[$attribute_name] = $this->getAttribute($attribute_name); } } if (!empty($types)) { $attribute_map = array_filter(
php
{ "resource": "" }
q11571
EntityType.getAttribute
train
public function getAttribute($name) { if (mb_strpos($name, '.')) { return $this->getAttributeByPath($name); } if ($this->attribute_map->hasKey($name)) {
php
{ "resource": "" }
q11572
EntityType.createEntity
train
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false) { $implementor = $this->getEntityImplementor(); if (!class_exists($implementor, true)) { throw new InvalidTypeException( "Unable to resolve
php
{ "resource": "" }
q11573
RedisHandler.writeCapped
train
protected function writeCapped(array $record) { if ($this->redisClient instanceof \Redis) { $this->redisClient->multi() ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1)
php
{ "resource": "" }
q11574
GameCurrencyService.sendBill
train
public function sendBill($bill, callable $onSuccess, callable $onFailure) { // return if the bill is not defined by creating one. if ($bill === false) { return; } $currencyEntry = new CurrencyEntry(); $currencyEntry->setBill($bill);
php
{ "resource": "" }
q11575
GameCurrencyService.createBill
train
public function createBill($login, $amount, $receiver, $message) { $currencyEntry = new Gamecurrency(); $currencyEntry->setAmount($amount); $currencyEntry->setSenderlogin($login); $currencyEntry->setReceiverlogin($receiver); $currencyEntry->setMessage($message);
php
{ "resource": "" }
q11576
ReservationForm.goToNextStep
train
public function goToNextStep(array $data, ReservationForm $form) { $reservation = $form->getReservation(); foreach ($data['Attendee'] as $attendeeID => $attendeeData) { /** @var Attendee $attendee */ $attendee = Attendee::get()->byID($attendeeID); // populate the attendees foreach ($attendeeData as $field => $value) { if (is_int($field)) { $attendee->Fields()->add($field, array('Value' => $value));
php
{ "resource": "" }
q11577
BaseOAuth20.validateRequest
train
function validateRequest($result) { $statusCodes = array( "200" => "", "304" => "Not Modified", "400" => "Bad Request", "401" => "Unauthorized: Authentication credentials were missing or incorrect", "403" => "Forbidden: The request is understood, but it has been refused", "404" => "Not Found", "406" => "Not Acceptable", "420" => "Enhance Your Calm", "500" => "Internal Server Error", "502" =>
php
{ "resource": "" }
q11578
ParentItem.addChild
train
public function addChild($class, $id, $label, $permission, $options =[]) { if (is_string($id)) { $id = explode('/', $id); } if (count($id) == 1) { if (isset($this->childItems[$id[0]])) { return $this->childItems[$id[0]]; } $item = $this->itemBuilder->create(
php
{ "resource": "" }
q11579
ParentItem.getChild
train
public function getChild($path) { if (is_string($path)) { $path = explode('/', $path); } $remaining = array_splice($path, 1, count($path) - 1); foreach ($this->childItems as $childItem) { if ($childItem->getId() ==
php
{ "resource": "" }
q11580
ParentItem.isVisibleFor
train
public function isVisibleFor($login) { $personalVisibility = parent::isVisibleFor($login); if (!$personalVisibility) { return $personalVisibility; } foreach ($this->getChilds() as $childItem) {
php
{ "resource": "" }
q11581
Ean.hasValidLength
train
public static function hasValidLength($value) { // Sanitize $value = (int) $value; $length = strlen($value);
php
{ "resource": "" }
q11582
Ean.toIsbn10
train
public static function toIsbn10($ean, $onError = null) { // Sanitize $ean = preg_replace('/[^0-9]/', '', $ean); // Validate if (!preg_match('/^978(\d{9})\d?$/', $ean, $found)) { return $onError; }
php
{ "resource": "" }
q11583
Convertor.prepareRules
train
public function prepareRules() { switch (self::baseClassName($this->input)) { case 'FakturaVydana': case 'Banka': switch (self::baseClassName($this->output)) { case 'FakturaVydana': // Banka['typPohybuK' => 'typPohybu.prijem'] -> FakturaVydana['typDokl' => 'ZDD'] // $this->output->setDataValue('firma', \FlexiPeeHP\FlexiBeeRO::code( $this->input->getDataValue('firma'))); $this->rules = array_combine($this->commonItems(), $this->commonItems()); unset($this->rules['stavUhrK']); unset($this->rules['datUcto']); unset($this->rules['datUcto']); foreach (array_keys($this->output->getData()) as $colname) { unset($this->rules[$colname]); } if ($this->input->getDataValue('typDokl') != $this->output->getDataValue('typDokl')) { unset($this->rules['rada']); } foreach ($this->rules as $rule) { if (preg_match('/^sum/', $rule)) { unset($this->rules[$rule]); } } $polozkyDokladu
php
{ "resource": "" }
q11584
Convertor.convertDocument
train
public function convertDocument($keepId = false, $addExtId = false, $keepCode = false, $handleAccountig = false)
php
{ "resource": "" }
q11585
Convertor.convertSubitems
train
public function convertSubitems($columnToTake, $keepId = false, $keepCode = false, $keepAccountig = false) { $subitemRules = $this->rules[$columnToTake]; if (self::isAssoc($this->input->data[$columnToTake])) { $sourceData = [$this->input->data[$columnToTake]]; } else { $sourceData = $this->input->getDataValue($columnToTake); } $typUcOp = $this->input->getDataValue('typUcOp'); foreach ($sourceData as $subItemData) { foreach (array_keys($subItemData) as $subitemColumn) { if (!array_key_exists($subitemColumn, $subitemRules)) { unset($subItemData[$subitemColumn]); } } if ($keepAccountig && array_key_exists('ucetni', $subItemData) && array_key_exists('ucetni', $this->output->getData())) { $subItemData['ucetni'] = $this->output->getDataValue('ucetni'); } else { unset($subItemData['ucetni']);
php
{ "resource": "" }
q11586
Convertor.convertItems
train
public function convertItems($keepId = false, $addExtId = true, $keepCode = false, $handleAccounting = false) { if ($keepCode === false) { unset($this->rules['kod']); } if ($keepId === false) { unset($this->rules['id']); } foreach (self::removeRoColumns($this->rules, $this->output) as $columnToTake => $subitemColumns) { if (is_array($subitemColumns)) { if (!empty($this->input->getSubItems())) { $this->convertSubitems($columnToTake, $keepId, $keepCode,$handleAccounting);
php
{ "resource": "" }
q11587
Convertor.removeRoColumns
train
public static function removeRoColumns(array $rules, $engine) { foreach ($rules as $index => $subrules) { if (is_array($subrules)) { $eback = $engine->getEvidence(); $engine->setEvidence($engine->getEvidence().'-polozka');
php
{ "resource": "" }
q11588
Convertor.commonItems
train
public function commonItems() { return array_intersect(array_keys($this->input->getColumnsInfo()),
php
{ "resource": "" }
q11589
CommandBuilder.doBuild
train
protected function doBuild($user, $isApi = false) { $this->register($user, $isApi); $this->container->setAlias( $this->alias($user, $isApi),
php
{ "resource": "" }
q11590
VisitorFactory.createVisitors
train
final public function createVisitors(int $flags = 0): VisitorInterface { $flag = function (int $needle) use ($flags) { return ($needle & $flags) == $needle; }; $errorObj = new ErrorObject; $container = new VisitorContainer($errorObj); if (!$flag(self::VISITOR_IGNORE_BASIC_VALIDATION)) { $container->addVisitor(new NumberVisitor($errorObj)); $container->addVisitor(new TextVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_MESSAGES)) { $container->addVisitor(new MessageVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_DATES)) { $container->addVisitor(new DateVisitor($errorObj)); } if (!$flag(self::VISITOR_IGNORE_ACCOUNTS)) { $container->addVisitor( new AccountVisitor( $errorObj, new DelegatingFactory(new AccountFactory, new BankgiroFactory), new BankgiroFactory ) ); }
php
{ "resource": "" }
q11591
NewsController.listAction
train
public function listAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; /** * Listing News using MelisCmsNewsListNewsPlugin */ $listNewsPluginView = $this->MelisCmsNewsListNewsPlugin(); $listNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/news-list',
php
{ "resource": "" }
q11592
NewsController.detailsAction
train
public function detailsAction() { // Getting the Site config "MelisDemoCms.config.php" $siteConfig = $this->getServiceLocator()->get('config'); $siteConfig = $siteConfig['site']['MelisDemoCms']; $siteDatas = $siteConfig['datas']; $dateMax = date("Y-m-d H:i:s", strtotime("now")); $listNewsPluginView = $this->MelisCmsNewsShowNewsPlugin(); $listNewsParameters = array( 'id' => 'newsDetails', 'template_path' => 'MelisDemoCms/plugin/news-details', ); // add generated view to children views for displaying it in the contact view $this->view->addChild($listNewsPluginView->render($listNewsParameters), 'newsDetails'); /** * Generating Homepage Latest News slider using MelisCmsNewsLatestNewsPlugin Plugin */ $latestNewsPluginView = $this->MelisCmsNewsLatestNewsPlugin(); $latestNewsParameters = array( 'template_path' => 'MelisDemoCms/plugin/latest-news', 'pageIdNews' => $siteDatas['news_details_page_id'], 'filter' => array(
php
{ "resource": "" }
q11593
RemoveDeletedAggregatesListener.preFlush
train
public function preFlush(PreFlushEventArgs $event) { $entityManager = $event->getEntityManager(); $uow = $entityManager->getUnitOfWork(); foreach ($uow->getIdentityMap() as $class => $entities) { foreach ($entities as $entity) {
php
{ "resource": "" }
q11594
OrkestraPdfBundle.initializeTcpdf
train
private function initializeTcpdf() { if (defined('K_TCPDF_EXTERNAL_CONFIG')) { return; } define('K_TCPDF_EXTERNAL_CONFIG', true); /** * Installation path (/var/www/tcpdf/). */ define('K_PATH_MAIN', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * URL path to tcpdf installation folder (http://localhost/tcpdf/). * * TODO: This should probably be some public path */ define('K_PATH_URL', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.root_dir'))); /** * path for PDF fonts * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts */ define('K_PATH_FONTS', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.fonts_dir'))); /** * cache directory for temporary files (full path) */ define('K_PATH_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** * cache directory for temporary files (url path) */ define('K_PATH_URL_CACHE', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.cache_dir'))); /** *images directory */ define('K_PATH_IMAGES', $this->ensurePathEndsWithSlash($this->container->getParameter('orkestra.pdf.tcpdf.image_dir'))); /**
php
{ "resource": "" }
q11595
MySql.getDsn
train
public function getDsn(): string { /* MYSQL: $connection = new \PDO('mysql:host=localhost;port=3306;dbname=test', $user, $pass, array( \PDO::ATTR_PERSISTENT => true \PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, \PDO::ATTR_AUTOCOMMIT => FALSE, \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" // Set UTF8 as charset ) ); */
php
{ "resource": "" }
q11596
ClassFinder.isAfterOpeningBracket
train
private function isAfterOpeningBracket(FoundClass $c) { for ($k = $c->from; $k >= 0; $k--) { if (is_string($this->file->tokens[$k]) && $this->file->tokens[$k]
php
{ "resource": "" }
q11597
JWT.checkProvider
train
public function checkProvider($provider) { if (($prv = $this->payload()->get('prv')) === null) { return true;
php
{ "resource": "" }
q11598
AntiSpam._encodeEntities
train
public function _encodeEntities($string) { $string = mb_convert_encoding($string, 'UTF-32', 'UTF-8'); $t = unpack("N*", $string); $t = array_map(function ($n) {
php
{ "resource": "" }
q11599
GroupVersionHydrator.hydrateArray
train
private function hydrateArray($array, $group, $version) { foreach ($array as
php
{ "resource": "" }