_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | 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[... | 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($... | 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;
}
$uniq... | php | {
"resource": ""
} |
q11503 | FilterHelper.getBtnConditionGroup | train | public function getBtnConditionGroup($inputCondField = null) {
$options = $this->_getOptionsForElem('getBtnConditionGroup.options');
$title = $this->_getOptionsForElem('getBtnConditionGroup.title');
return $this->_getBtnCondition($inputCondField, $options, $title, false);
} | 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 {
$request... | php | {
"resource": ""
} |
q11505 | FilterHelper._getExtendOptionsPaginationUrl | train | protected function _getExtendOptionsPaginationUrl() {
$options = [];
$ext = (string)$this->request->param('ext');
$ext = mb_strtolower($ext);
if (empty($ext) || ($ext !== 'prt')) {
return $options;
}
$options = compact('ext');
return $options;
} | 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) {
if ($data instanceof DestroyableObject... | php | {
"resource": ""
} |
q11507 | GraphViz.getView | train | private function getView(string $name, array $data = [])
{
$filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%');
$templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader);
return $templating->render($name . '.phtml', $data);
} | 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() );
array_walk( $files, function(... | php | {
"resource": ""
} |
q11509 | JsWriterAbstract.getOptionsForSeries | train | public function getOptionsForSeries( $series )
{
$seriesTitle = $this->getSeriesTitle( $series );
if (! isset( $this->options['seriesStorage'][$seriesTitle] ) ) {
throw new \Exception( 'Series not registered with JsWriter' );
}
return $this->options['seriesStorage'][$ser... | php | {
"resource": ""
} |
q11510 | JsWriterAbstract.getSeriesOption | train | public function getSeriesOption( $series, $option, $default = null )
{
$seriesTitle = $this->getSeriesTitle( $series );
return ( isset( $this->options['seriesStorage'][$seriesTitle] ) && isset( $this->options['seriesStorage'][$seriesTitle][$option] ) )
? $this->options['seriesStorage'... | php | {
"resource": ""
} |
q11511 | JsWriterAbstract.setSeriesOption | train | public function setSeriesOption( $series, $name, $value )
{
$this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), $name, $value );
return $this;
} | 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 );
... | php | {
"resource": ""
} |
q11513 | JsWriterAbstract.getType | train | public function getType( $series = null )
{
$series = $series ?: 'default';
$seriesTitle = $this->getSeriesTitle( $series );
return isset( $this->types[$seriesTitle] ) ? $this->types[$seriesTitle] : null;
} | 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 \BadMethodCallExcepti... | 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 \BadMethodCallExceptio... | php | {
"resource": ""
} |
q11516 | MainMenuBuilderListener.onMainMenuBuild | train | public function onMainMenuBuild(MenuBuilderEvent $event): void
{
if (!$this->authorizationChecker->isGranted('ROLE_NGBM_ADMIN')) {
return;
}
$this->addLayoutsSubMenu($event->getMenu());
} | 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;... | 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->for... | 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
$cache = $this->createCache($name);
if (!\is_null($cache)) {
$this->addCache($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 find the cache from the list
$cache = ( $this->caches[\strtolower($name)] ?? null);
}
... | php | {
"resource": ""
} |
q11521 | CacheManager.addCache | train | public function addCache(AbstractCacheAdapterInterface $cache)
{
$this->caches[\strtolower($cache->getDriver())] = $cache;
return $this;
} | php | {
"resource": ""
} |
q11522 | CacheManager.removeCache | train | public function removeCache(string $name)
{
# Sanity check
if (empty($name)) return false;
$cache = $this->findCache($name);
if ($cache) {
unset( $this->caches[\strtolower($cache->getDriver())] );
unset($cache);
$cache = null;
}
return $this;
} | 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);
... | php | {
"resource": ""
} |
q11524 | StreamFactory.createStreamFromFile | train | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
# Open the file
$resource = \fopen($filename, $mode);
return \GuzzleHttp\Psr7\stream_for($resource);
} | 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, ArrayOb... | php | {
"resource": ""
} |
q11526 | EnchantSpell.& | train | function &getSuggestions($lang, $word) {
$r = enchant_broker_init();
$suggs = array();
if (enchant_broker_dict_exists($r,$lang)) {
$d = enchant_broker_request_dict($r, $lang);
$suggs = enchant_dict_suggest($d, $word);
enchant_broker_free_dict($d);
} else {
}
enchant_broker_free($r);
... | php | {
"resource": ""
} |
q11527 | AbstractPdfGenerator.generate | train | public function generate(array $parameters = array(), array $options = array())
{
$parametersResolver = new OptionsResolver();
$this->setDefaultParameters($parametersResolver);
$parameters = $parametersResolver->resolve($parameters);
$optionsResolver = new OptionsResolver();
... | 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(),
'cpu' => self::getUsageCPU(),
... | php | {
"resource": ""
} |
q11529 | Profiler.getTime | train | public function getTime($seconds) {
$dtF = new \DateTime("@0");
$dtT = new \DateTime("@$seconds");
return $dtF->diff($dtT)->format('%h hours, %i minutes %s sec.');
} | 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) {
$result[] = "$i. ".basename($node['file']) .":" .$node['function'] ."(" .$node['line'].")";
}
$... | php | {
"resource": ""
} |
q11531 | Profiler.getMemoryUsage | train | private static function getMemoryUsage() {
$memory = memory_get_peak_usage();
$floor = floor((strlen($memory) - 1) / 3);
return sprintf("%.2f", $memory/pow(1024, $floor)).' '.@'BKMGTPEZY'[$floor].'B';
} | 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... | 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() ... | php | {
"resource": ""
} |
q11534 | Bootstrap._maybe_refresh_cache | train | protected function _maybe_refresh_cache( $url ) {
$cache = Cache::get( $url );
if ( ! $cache || is_admin() ) {
Cache::refresh( $url );
}
} | 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 )
: View::get_pre_blog_card_template( $url );
}
return View::get_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_oem... | 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 = $url;
$this->_autosuggestParamReq = $paramReq;
$this->_autosuggestCallback ... | php | {
"resource": ""
} |
q11538 | CsvBase.getEncoding | train | public function getEncoding($direction)
{
if (!isset($this->encoding[$direction])) {
throw new Exception("Encoding direction invalid");
}
return $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;
$var = substr($buffer, $i+7, $tamparam);
... | php | {
"resource": ""
} |
q11541 | PageXml.addJavaScript | train | public function addJavaScript($javascript, $location = 'up')
{
$nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script", "");
XmlUtil::AddAttribute($nodeWorking, "language", "javascript");
XmlUtil::AddAttribute($nodeWorking, "location", $location);
XmlUtil::AddTextNode($nodeWorking, $javascript);
} | 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 {
$this->socketService->run();
}
catch(SocketServiceException $e) {
... | 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) {... | 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(), "");
$link->addXmlnukeObject(new XmlnukeText($this->myWords->Value("LINK_LIST... | 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, ... | php | {
"resource": ""
} |
q11546 | Visitor.setUa | train | public function setUa($ua)
{
$this->ua = $this->detector->setUserAgent($ua);
// set browser & platform
$this->setBrowser();
return $this;
} | php | {
"resource": ""
} |
q11547 | Visitor.setBrowser | train | private function setBrowser()
{
$client = parse_user_agent($this->detector->getUserAgent());
$this->browser = $client['browser'];
$this->setPlatform($client['platform']);
return $this;
} | 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 && $this->tablet === 0) {
$this->pc = 1;
}
return $this;
} | php | {
"resource": ""
} |
q11549 | Visitor.toArray | train | public function toArray() {
$properties = get_object_vars($this);
foreach($properties as $var => &$value) {
if(gettype($value) === 'object') {
unset($properties[$var]);
}
}
return $properties;
} | php | {
"resource": ""
} |
q11550 | DecimaAccountingServiceProvider.registerAccountChartTypeInterface | train | protected function registerAccountChartTypeInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\AccountChartTypeInterface', function()
{
return new \Mgallegos\DecimaAccounting\System\Repositories\AccountChartType\EloquentAccountChartType( new AccountChartType() );
})... | 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($Authenti... | php | {
"resource": ""
} |
q11552 | DecimaAccountingServiceProvider.registerAccountTypeInterface | train | protected function registerAccountTypeInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\AccountType\AccountTypeInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return n... | 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');
return new \Mgallegos\D... | php | {
"resource": ""
} |
q11554 | DecimaAccountingServiceProvider.registerFiscalYearInterface | train | protected function registerFiscalYearInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\FiscalYear\FiscalYearInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new ... | php | {
"resource": ""
} |
q11555 | DecimaAccountingServiceProvider.registerAccountInterface | train | protected function registerAccountInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Account\AccountInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new \Mgallego... | php | {
"resource": ""
} |
q11556 | DecimaAccountingServiceProvider.registerSystemAccountInterface | train | protected function registerSystemAccountInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\System\Repositories\Account\AccountInterface', function()
{
return new \Mgallegos\DecimaAccounting\System\Repositories\Account\EloquentAccount( new SystemAccount() );
});
} | php | {
"resource": ""
} |
q11557 | DecimaAccountingServiceProvider.registerCostCenterInterface | train | protected function registerCostCenterInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\CostCenter\CostCenterInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new ... | php | {
"resource": ""
} |
q11558 | DecimaAccountingServiceProvider.registerDocumentTypeInterface | train | protected function registerDocumentTypeInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\DocumentType\DocumentTypeInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
retur... | php | {
"resource": ""
} |
q11559 | DecimaAccountingServiceProvider.registerClientInterface | train | protected function registerClientInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Client\ClientInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new \Mgallegos\D... | php | {
"resource": ""
} |
q11560 | DecimaAccountingServiceProvider.registerSupplierInterface | train | protected function registerSupplierInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Supplier\SupplierInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new \Mgall... | php | {
"resource": ""
} |
q11561 | DecimaAccountingServiceProvider.registerEmployeeInterface | train | protected function registerEmployeeInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Employee\EmployeeInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
return new \Mgall... | php | {
"resource": ""
} |
q11562 | DecimaAccountingServiceProvider.registerApportionmentInterface | train | protected function registerApportionmentInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\Apportionment\ApportionmentInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
re... | php | {
"resource": ""
} |
q11563 | DecimaAccountingServiceProvider.registerApportionmentEntryInterface | train | protected function registerApportionmentEntryInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\ApportionmentEntry\ApportionmentEntryInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInte... | php | {
"resource": ""
} |
q11564 | DecimaAccountingServiceProvider.registerJournalVoucherInterface | train | protected function registerJournalVoucherInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalVoucher\JournalVoucherInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
... | php | {
"resource": ""
} |
q11565 | DecimaAccountingServiceProvider.registerJournalEntryInterface | train | protected function registerJournalEntryInterface()
{
$this->app->bind('Mgallegos\DecimaAccounting\Accounting\Repositories\JournalEntry\JournalEntryInterface', function($app)
{
$AuthenticationManager = $app->make('App\Kwaai\Security\Services\AuthenticationManagement\AuthenticationManagementInterface');
retur... | 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'),
... | 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... | 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\AuthenticationMan... | php | {
"resource": ""
} |
q11569 | EntityType.getRoot | train | public function getRoot()
{
$next_parent = $this->getParent();
$parent = null;
while ($next_parent) {
$parent = $next_parent;
$next_parent = $parent->getParent();
}
return $parent ? $parent : $this;
} | 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_... | php | {
"resource": ""
} |
q11571 | EntityType.getAttribute | train | public function getAttribute($name)
{
if (mb_strpos($name, '.')) {
return $this->getAttributeByPath($name);
}
if ($this->attribute_map->hasKey($name)) {
return $this->attribute_map->getItem($name);
} else {
throw new RuntimeException('Type has no ... | 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 the given enti... | 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)
->exec();
} else {
... | 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);
$currencyEntry->setSuc... | 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);
$curr... | 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... | 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",
"... | 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]];
}
$it... | 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() == $path[0]) {
if (empty($remai... | php | {
"resource": ""
} |
q11580 | ParentItem.isVisibleFor | train | public function isVisibleFor($login)
{
$personalVisibility = parent::isVisibleFor($login);
if (!$personalVisibility) {
return $personalVisibility;
}
foreach ($this->getChilds() as $childItem) {
if ($childItem->isVisibleFor($login)) {
return t... | php | {
"resource": ""
} |
q11581 | Ean.hasValidLength | train | public static function hasValidLength($value)
{
// Sanitize
$value = (int) $value;
$length = strlen($value);
// Validate
return !($length < 9 || $length > 13);
} | 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;
}
// Convert
$isbn = $found[1];
$isbn = sta... | 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... | php | {
"resource": ""
} |
q11584 | Convertor.convertDocument | train | public function convertDocument($keepId = false, $addExtId = false,
$keepCode = false, $handleAccountig = false)
{
if ($handleAccountig === false) {
unset($this->rules['ucetni']);
}
$this->convertItems($keepId, $addExtId, $keepCode, $handleAcco... | 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[$columnT... | 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']);
}
... | 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');
$rules[$index] = ... | php | {
"resource": ""
} |
q11588 | Convertor.commonItems | train | public function commonItems()
{
return array_intersect(array_keys($this->input->getColumnsInfo()),
array_keys($this->output->getColumnsInfo()));
} | php | {
"resource": ""
} |
q11589 | CommandBuilder.doBuild | train | protected function doBuild($user, $isApi = false)
{
$this->register($user, $isApi);
$this->container->setAlias(
$this->alias($user, $isApi),
$this->definition($user, $isApi)
);
return $this->container;
} | 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_IG... | 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 MelisC... | 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... | 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) {
if ($entity instanceof DeletableIn... | 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->containe... | 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 u... | 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] === '{'
) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q11597 | JWT.checkProvider | train | public function checkProvider($provider)
{
if (($prv = $this->payload()->get('prv')) === null) {
return true;
}
return $this->hashProvider($provider) === $prv;
} | 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) {
return "&#$n;";
},
$t);
return implode("", $t);
} | php | {
"resource": ""
} |
q11599 | GroupVersionHydrator.hydrateArray | train | private function hydrateArray($array, $group, $version)
{
foreach ($array as $key => $value) {
$this->hydrate($value, $group, $version);
}
return $array;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.