_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q7400
Utility.getRoute
train
public function getRoute() { /** @var Http $req */ $req = $this->context->getRequest(); if (isset($this->map[$req->getControllerName()])) { return $this->map[$req->getControllerName()]; } return $this->map[Generic::CONTROLLER_KEY]; }
php
{ "resource": "" }
q7401
Retriever.getPaymentMethods
train
public function getPaymentMethods() { $this->quote->setStoreId($this->storeManager->getStore()->getId()); $export = []; $paymentMethods = $this->paymentModel->getAvailableMethods($this->quote); foreach ($paymentMethods as $method) { $export[] = [ ...
php
{ "resource": "" }
q7402
Builder.buildHttpRedirect
train
public function buildHttpRedirect() { if (!is_null($this->http)) { return $this->http; } $builder = new ShopgateBuilder($this->initConfig()); $userAgent = $this->header->getHttpUserAgent(); try { $this->http = $builder->buildHttpRedirect($userAgent...
php
{ "resource": "" }
q7403
Builder.buildJsRedirect
train
public function buildJsRedirect() { if (!is_null($this->js)) { return $this->js; } $builder = new ShopgateBuilder($this->initConfig()); try { $this->js = $builder->buildJsRedirect($this->request->getParams(), $_COOKIE); } catch (\ShopgateMerchantApiE...
php
{ "resource": "" }
q7404
Pagination.prepare
train
public function prepare(OptionList $objOptions = null): OptionList { if (is_null($objOptions)) { $objOptions = new OptionList; } // Page if ('post' == $this->options->get('method')) { $requestBody = $this->serverRequest->getParsedBody(); if (is_a...
php
{ "resource": "" }
q7405
Pagination.handle
train
public function handle($mixed): Pagination { if ($mixed instanceof Collection) { $this->mixed = $mixed; $this->nb_pages = ceil(max(count($mixed), 1) / max($this->nb_per_page, 1)); } else { if ($mixed instanceof \Countable) { $this->mixed = $mixed; ...
php
{ "resource": "" }
q7406
Pagination.canBeShowed
train
public function canBeShowed(): bool { return ($this->mixed instanceof Collection || $this->mixed instanceof \Countable || is_int($this->mixed)); }
php
{ "resource": "" }
q7407
Pagination.getParam
train
public function getParam(): string { if ($this->options->is_null('param')) { $this->options->set('param', 'page' . (1 == self::$iPagination ? '' : self::$iPagination)); } return $this->options->get('param'); }
php
{ "resource": "" }
q7408
Pagination.getHttpQueryString
train
public function getHttpQueryString(array $moreQuery = null): string { $queries = []; if (!(is_null($this->page) || 1 == $this->page)) { $queries[$this->getParam()] = $this->page; } if (!empty($moreQuery)) { $queries = array_merge($queries, $moreQuery); ...
php
{ "resource": "" }
q7409
StateMachineAbstract.parseYAML
train
protected function parseYAML() { try { $yaml = $this->configuration; $yaml_fixed = []; $yaml_fixed['class'] = $yaml['class']; foreach ($yaml['states'] as $key => $value) { if ($value['type'] != \Mothership\StateMachine\S...
php
{ "resource": "" }
q7410
StateMachineAbstract.initWorkflow
train
protected function initWorkflow() { $className = $this->workflowConfiguration['class']['name']; if (!class_exists($className, true)) { throw new StateMachineException('The class ' . $className . ' does not exist!', 100); } try { $this->workflow = new $classN...
php
{ "resource": "" }
q7411
StateMachineAbstract.renderGraph
train
public function renderGraph($outputPath = './workflow.png', $stopAfterExecution = true) { /* * This example is based on http://martin-thoma.com/how-to-draw-a-finite-state-machine/ * Feel free to tweak the rendering output. I have decided do use the most simple * implementation ove...
php
{ "resource": "" }
q7412
StateMachineAbstract.run
train
public function run(array $args = [], $enableLog = false) { try { return $this->workflow->run($args, $enableLog); } catch (WorkflowException $ex) { throw new StateMachineException('Error running State Machine', 100, $ex); } }
php
{ "resource": "" }
q7413
Generic.generate
train
public function generate($pageTitle) { return [ Shopgate_Helper_Redirect_TagsGenerator::SITE_PARAMETER_SITENAME => $this->getSiteName(), Shopgate_Helper_Redirect_TagsGenerator::SITE_PARAMETER_DESKTOP_URL => $this->getShopUrl(), Shopgate_Helper_Redirect_TagsGenera...
php
{ "resource": "" }
q7414
CURLFactory.getInstance
train
public static function getInstance($method, CURLConfiguration $configuration = null, $resourcePath = null) { // Check the configuration. if (null === $configuration) { $configuration = new CURLConfiguration(); } // Switch into $method. switch ($method) { ...
php
{ "resource": "" }
q7415
ARC2.createGraph
train
public function createGraph(NamedNode $graph, array $options = []) { if (false === isset($this->getGraphs()[$graph->getUri()])) { // table names $g2t = $this->configuration['table-prefix'].'_g2t'; $id2val = $this->configuration['table-prefix'].'_id2val'; /* ...
php
{ "resource": "" }
q7416
ARC2.getRowCount
train
public function getRowCount($tableName) { $result = $this->store->queryDB( 'SELECT COUNT(*) as count FROM '.$tableName, $this->store->getDBCon() ); $row = $result->fetch_assoc(); return $row['count']; }
php
{ "resource": "" }
q7417
ARC2.openConnection
train
protected function openConnection() { // set standard values $this->configuration = array_merge([ 'host' => 'localhost', 'database' => '', 'username' => '', 'password' => '', 'table-prefix' => 'saft_', ], $this->configuration); ...
php
{ "resource": "" }
q7418
SgProfiler.start
train
public function start($identifier = null) { $this->loadProfile($identifier); $this->currentProfile->start(); return $this; }
php
{ "resource": "" }
q7419
SgProfiler.loadProfile
train
protected function loadProfile($identifier = null) { if (!$identifier) { $identifier = 'generic'; } if (isset($this->profiles[$identifier])) { $this->currentProfile = $this->profiles[$identifier]; } else { $this->currentProfile = new SgProf...
php
{ "resource": "" }
q7420
SgProfiler.debug
train
public function debug($message = "%s seconds") { $this->logger->debug(sprintf($message, $this->currentProfile->getDuration())); }
php
{ "resource": "" }
q7421
AbstractTextTranslator.weeks
train
public function weeks($weeks) { return sprintf($this->formatPattern, $weeks, $this->week_words[$this->pluralization($weeks)]); }
php
{ "resource": "" }
q7422
AbstractTextTranslator.months
train
public function months($months) { return sprintf($this->formatPattern, $months, $this->month_words[$this->pluralization($months)]); }
php
{ "resource": "" }
q7423
AbstractTextTranslator.years
train
public function years($years) { return sprintf($this->formatPattern, $years, $this->year_words[$this->pluralization($years)]); }
php
{ "resource": "" }
q7424
TimeSlot.leftJoinWithout
train
public function leftJoinWithout() { // Sort and count the time slots. $buffer = TimeSlotHelper::merge($this->getTimeSlots()); $number = count($buffer); // Check the time slots count. if (0 === $number) { return [$this]; } // Initialize the output. ...
php
{ "resource": "" }
q7425
TimeSlot.removeTimeSlot
train
public function removeTimeSlot(TimeSlot $timeSlot) { for ($i = count($this->timeSlots) - 1; 0 <= $i; --$i) { if (true !== TimeSlotHelper::equals($timeSlot, $this->timeSlots[$i])) { continue; } unset($this->timeSlots[$i]); } return $this; }
php
{ "resource": "" }
q7426
Config.setConfigDirectory
train
private function setConfigDirectory(string $dirName): void { $dirName = realpath($this->getDirectory(Config::DIR_ROOT) . $dirName); if (is_dir($dirName)) { $this->configDirectory = $dirName; } else { if ($dirName !== false) { throw new \InvalidArgumen...
php
{ "resource": "" }
q7427
Retriever.getCustomerGroups
train
public function getCustomerGroups() { $groups = []; /** @var GroupInterface $customerGroup */ foreach ($this->customerGroupCollection->getItems() as $customerGroup) { $group = []; $group['id'] = $customerGroup->getId(); $group['name'...
php
{ "resource": "" }
q7428
AbstractValidator.create_error_message
train
protected function create_error_message( $message_name, $value ) { $message = $this->get_message_template( $message_name ); if ( ! is_scalar( $value ) ) { $value = $this->get_value_as_string( $value ); } // replacing the placeholder for the %value% $message = str_replace( '%value%', $value, $message ); ...
php
{ "resource": "" }
q7429
AbstractValidator.get_value_as_string
train
protected function get_value_as_string( $value ) { if ( is_object( $value ) && ! in_array( '__toString', get_class_methods( $value ) ) ) { $value = get_class( $value ) . ' object'; } else if ( is_array( $value ) ) { $value = var_export( $value, TRUE ); } return (string) $value; }
php
{ "resource": "" }
q7430
ZypioSNMP.addOid
train
public function addOid( $oid, $type = STRING, $value= NULL, $allowed = [] ){ $this->tree[$oid] = [ 'type' => $type, 'value' => $value, 'allowed' => $allowed ]; return $this; }
php
{ "resource": "" }
q7431
Image.resize
train
public function resize($props = array(), $coords = null) { $croppable = elgg_extract('croppable', $props, false); $width = elgg_extract('w', $props); $height = elgg_extract('h', $props); if (is_array($coords) && $croppable) { $master_width = elgg_extract('master_width', $coords, self::MASTER); $master_...
php
{ "resource": "" }
q7432
Image.save
train
public function save($path, $quality = array()) { $ext = pathinfo($path, PATHINFO_EXTENSION); $jpeg_quality = elgg_extract('jpeg_quality', $quality); $png_quality = elgg_extract('png_quality', $quality); $png_filter = elgg_extract('png_filter', $quality); switch ($ext) { default : $this->source->save...
php
{ "resource": "" }
q7433
CMySQLConnector.clearStats
train
private function clearStats() { $this->queries_executed = 0; $this->queries_released = 0; $this->queries_erroneous = 0; $this->sentences_executed = 0; $this->sentences_erroneous = 0; $this->inserts_executed = 0; $this->inserts_erroneous = 0; $this->...
php
{ "resource": "" }
q7434
CMySQLConnector.enqueueStatement
train
public function enqueueStatement(CNabuDBAbstractStatement $statement) { if ($statement instanceof CMySQLStatement) { $hash = $statement->getHash(); if (!is_array($this->statements) || count($this->statements) === 0) { $this->statements = array($hash => $statement); ...
php
{ "resource": "" }
q7435
CMySQLConnector.dequeueStatement
train
public function dequeueStatement(CNabuDBAbstractStatement $statement) { if ($statement instanceof CMySQLStatement) { $hash = $statement->getHash(); if ($hash !== null && count($this->statements) > 0 && array_key_exists($hash, $this->statements)) { unset($this->stateme...
php
{ "resource": "" }
q7436
CMySQLConnector.clearLeadingAndTrailingSpaces
train
private function clearLeadingAndTrailingSpaces(string $sentence) : string { if ($this->trailing_optimization) { $sentence = preg_replace('/^\\s+/', '', $sentence); $sentence = preg_replace('/\\s+$/', '', $sentence); $sentence = preg_replace('/\\s*\\n\\s*/', ' ', $sentence...
php
{ "resource": "" }
q7437
UserCredentialAuthenticationLdapTrait.initializeLdap
train
public function initializeLdap() { //initialize from parent $this->initialize(); //validate ldap settings $ldapSettings = $this->_passwordAuthenticationPlatformSettings; if( !(array_key_exists('ldap_account_suffix', $ldapSettings)) ||!(array_key_...
php
{ "resource": "" }
q7438
UserCredentialAuthenticationLdapTrait.initializeLdapAuthenticationHandler
train
protected function initializeLdapAuthenticationHandler() { $ldapSettings = $this->_passwordAuthenticationPlatformSettings; $ldapAuthenticationHandler = new MultiotpWrapper(); $ldapAuthenticationHandler->SetLdapServerPassword($this->getCurrentPassword()); $ldapAuthenticationHandl...
php
{ "resource": "" }
q7439
Observer.execute
train
public function execute(\Magento\Framework\Event\Observer $observer) { if (!$this->redirect->isAllowed()) { $this->session->unsetScript(); return; } foreach ($this->getRedirects() as $redirect) { $redirect->run(); } }
php
{ "resource": "" }
q7440
Observer.getRedirects
train
private function getRedirects() { $httpWithJsBackup = [ $this->httpRedirect, $this->jsRedirect ]; return $this->redirect->isTypeJavaScript() ? [$this->jsRedirect] : $httpWithJsBackup; }
php
{ "resource": "" }
q7441
AbstractTriplePatternStore.getStatement
train
protected function getStatement(Query $queryObject) { $queryParts = $queryObject->getQueryParts(); $tupleInformaton = null; $tupleType = null; /* * Use triple pattern */ if (true === isset($queryParts['triple_pattern'])) { $tupleInformation = $...
php
{ "resource": "" }
q7442
AbstractTriplePatternStore.getStatements
train
protected function getStatements(Query $queryObject) { $queryParts = $queryObject->getQueryParts(); $statementArray = []; // if only triples, but no quads if (true === isset($queryParts['triple_pattern']) && false === isset($queryParts['quad_pattern'])) { fo...
php
{ "resource": "" }
q7443
ValidatorFactory.create
train
public function create( $type, array $properties = [ ] ) { // If type is already an instance of validator, and no properties provided, we just return it as is if ( $type instanceof ValidatorInterface && ! $properties ) { return $type; } // If an instance of validator is given alongside some properties, we ...
php
{ "resource": "" }
q7444
ControllerFinder.parseNamespace
train
private function parseNamespace($filePath): string { preg_match('/namespace(.*);/', file_get_contents($filePath), $result); return isset($result[1]) ? $result[1] . "\\" : ''; }
php
{ "resource": "" }
q7445
Integration.getServiceProvider
train
public static function getServiceProvider() { if (is_callable('_elgg_services')) { return _elgg_services(); } global $CONFIG; if (!isset($CONFIG)) { $path = self::getRootPath() . '/engine/settings.php'; if (!is_file($path)) { $path = self::getRootPath() . '/elgg-config/settings.php'; } requi...
php
{ "resource": "" }
q7446
Integration.getElggVersion
train
public static function getElggVersion() { if (isset(self::$version)) { return self::$version; } if (is_callable('elgg_get_version')) { return elgg_get_version(true); } else { $path = self::getRootPath() . '/version.php'; if (!include($path)) { return false; } self::$version = $release; ...
php
{ "resource": "" }
q7447
MultiotpXmlParser.Parse
train
function Parse() { //Create the parser resource $this->parser = xml_parser_create(); //Set the handlers xml_set_object($this->parser, $this); xml_set_element_handler($this->parser, 'StartElement', 'EndElement'); xml_set_character_data_handler($this->parser, '...
php
{ "resource": "" }
q7448
MultiotpXmlParser.HandleError
train
function HandleError($code, $line, $col, $byte_index = 0) { $sample_size = 80; $sample_start = $byte_index - ($sample_size / 2); if ($sample_start < 0) { $sample_start = 0; } trigger_error('XML Parsing Error at '.$line.':'.$col. (($byte_index != 0)?' (byte ...
php
{ "resource": "" }
q7449
MultiotpXmlParser.StartElement
train
function StartElement($parser, $name, $attrs = array()) { //Make the name of the tag lower case $name = strtolower($name); //Check to see if tag is root-level if (count($this->stack) == 0) { //If so, set the document as the current tag $this-...
php
{ "resource": "" }
q7450
MultiotpXMLTag.AddChild
train
function AddChild($name, $attrs, $parents, $cleanTagName = true) { //If the tag is a reserved name, output an error if(in_array($name, array('tagChildren', 'tagAttrs', 'tagParents', 'tagData', 'tagName'))) { trigger_error('You have used a reserved name as the name of an XML t...
php
{ "resource": "" }
q7451
MultiotpXMLTag.GetXML
train
function GetXML() { //Start a new line, indent by the number indicated in $this->parents, add a <, and add the name of the tag $out = "\n".str_repeat("\t", $this->tagParents).'<'.$this->tagName; //For each attribute, add attr="value" foreach($this->tagAttrs as $attr => $value) ...
php
{ "resource": "" }
q7452
MultiotpXMLTag.DeleteChildren
train
function DeleteChildren() { //Loop through all child tags for($x = 0; $x < count($this->tagChildren); $x ++) { //Do this recursively $this->tagChildren[$x]->DeleteChildren(); //Delete the name and value $this->tagChildren[$x] = nul...
php
{ "resource": "" }
q7453
Redirect.isTypeJavaScript
train
public function isTypeJavaScript() { $redirectType = $this->coreConfig->getConfigByPath(SgCoreInterface::PATH_REDIRECT_TYPE); return $redirectType->getValue() === SgCoreInterface::VALUE_REDIRECT_JS; }
php
{ "resource": "" }
q7454
LocalFileController.view
train
public function view($id) { $file = LocalFile::getByIdentifier($id); $response = response($file->getContents(), 200)->withHeaders([ 'Content-Type' => $file->getFile()->getMimeType(), 'Cache-Control' => 'max-age=86400, public', 'Expires' => Carbon::now()->a...
php
{ "resource": "" }
q7455
LocalFileController.download
train
public function download($id) { $file = LocalFile::getByIdentifier($id); return response()->download($file->getAbsolutePath(), $file->getDownloadName()); }
php
{ "resource": "" }
q7456
QueryFactoryImpl.createInstanceByQueryString
train
public function createInstanceByQueryString($query) { switch ($this->rdfHelpers->getQueryType($query)) { case 'askQuery': return new AskQueryImpl($query, $this->rdfHelpers); case 'constructQuery': return new ConstructQueryImpl($query, $this->rdfHelper...
php
{ "resource": "" }
q7457
Model.toFullArray
train
public function toFullArray(): array { //convert the obj to array in order to conver to json $result = get_object_vars($this); foreach ($result as $key => $value) { if (preg_match('#^_#', $key) === 1) { unset($result[$key]); } } retur...
php
{ "resource": "" }
q7458
TwigExtension.getApp
train
public function getApp(): App { if (!is_null($this->getTemplateEngine()->getApp())) { return $this->getTemplateEngine()->getApp(); } else { throw new RuntimeException('Template engine is not initialized with application'); } }
php
{ "resource": "" }
q7459
TwigExtension.filterDateFormat
train
public function filterDateFormat($datetime, string $pattern = 'dd/MM/yyyy', string $locale = null): string { if (empty($locale)) { $locale = $this->getApp()->getProfile()->getLocale(); } return b_date_format($datetime, $pattern, $locale); }
php
{ "resource": "" }
q7460
TwigExtension.functionPath
train
public function functionPath(string $name, array $parameters = []): string { return $this->getApp()->getService('routing')->generate($name, $parameters); }
php
{ "resource": "" }
q7461
TwigExtension.functionPreload
train
public function functionPreload(string $link, array $parameters = []): string { $push = !(!empty($parameters['nopush']) && $parameters['nopush'] == true); if (!$push || !in_array(md5($link), $this->h2pushCache)) { $header = sprintf('Link: <%s>; rel=preload', $link); // as ...
php
{ "resource": "" }
q7462
BaseAsset.run
train
private function run($type) { //getting the defined array of assets //this method will define in the children classes $this->init(); //making the base path of public dir $this->getTarget(); //duplication check if ($type == 'del') { re...
php
{ "resource": "" }
q7463
BaseAsset.getTarget
train
private function getTarget() { $this->name = str_replace('Asset', '', class_basename(static::class)); $name = $this->name; if ( ! empty($this->cacheFolder)) { $name = $this->cacheFolder; } $cacheName = trim(config('asset.public_cache_folder'), '/'); ...
php
{ "resource": "" }
q7464
Fix.getDefaultMethod
train
private function getDefaultMethod($price, $cost = null) { $method = $this->rateMethodFactory->create(); $method->setData('carrier', $this->getCarrierCode()); $method->setData('carrier_title', 'Shopgate'); $method->setData('method', $this->method); $method->setData('method_tit...
php
{ "resource": "" }
q7465
FitTransformer.fill
train
public function fill($image) { $fill = $this->getConfig('fill'); $r = $fill[0]; $g = $fill[1]; $b = $fill[2]; $a = isset($fill[3]) ? $fill[3] : 127; imagefill($image, 0, 0, imagecolorallocatealpha($image, $r, $g, $b, $a)); return $image; }
php
{ "resource": "" }
q7466
DateTimeHelper.getWeekNumberToApply
train
public static function getWeekNumberToApply(DateTime $date, DateTime $startDate, $weekCount, $weekOffset = 1) { // Check the week arguments. if ($weekCount <= 0 || $weekOffset <= 0 || $weekCount < $weekOffset) { return -1; } // Calculate. $result = intval($date->dif...
php
{ "resource": "" }
q7467
DateTimeHelper.translateWeekday
train
public static function translateWeekday($date, $locale = "en") { // Initialize. $template = __DIR__ . "/../Resources/translations/messages.%locale%.yml"; $filename = str_replace("%locale%", $locale, $template); // Check if the filename exists. if (false === file_exists($filenam...
php
{ "resource": "" }
q7468
FilteredBacktraceReporter.getBacktrace
train
public function getBacktrace($exception = null) { $backtrace = parent::getBacktrace($exception); foreach ($backtrace as $index => $backtraceCall) { $functionName = $this->buildFunctionName($backtraceCall); foreach ($this->filteredFunctions as $pattern) { if (...
php
{ "resource": "" }
q7469
DateTimeAgo.get
train
public function get(DateTime $date, DateTime $reference_date = null ) { if (is_null($reference_date)) { $reference_date = new DateTime(); } $diff = $reference_date->diff($date); return $this->getText($diff, $date); }
php
{ "resource": "" }
q7470
DateTimeAgo.getText
train
public function getText(DateInterval $diff, $date) { if ($this->now($diff)) { return $this->text_translator->now(); } if ($this->minutes($diff)) { return $this->text_translator->minutes($this->minutes($diff)); } if ($this->hours($diff...
php
{ "resource": "" }
q7471
DateTimeAgo.daily
train
public function daily($diff) { if (($diff->y == 0) && ($diff->m == 0) && (($diff->d == 0) || (($diff->d == 1) && ($diff->h == 0) && ($diff->i == 0)))) { return true; } return false; }
php
{ "resource": "" }
q7472
DateTimeAgo.hourly
train
public function hourly($diff) { if ($this->daily($diff) && ($diff->d == 0) && (($diff->h == 0) || (($diff->h == 1) && ($diff->i == 0)))) { return true; } return false; }
php
{ "resource": "" }
q7473
DateTimeAgo.days
train
public function days(DateInterval $diff) { if ($diff->days <= $this->max_days_count) { return $diff->days; } return false; }
php
{ "resource": "" }
q7474
DateTimeAgo.weeks
train
public function weeks(DateInterval $diff) { if ($diff->days < 30) { return (int) floor($diff->days / 7); } return false; }
php
{ "resource": "" }
q7475
DateTimeAgo.months
train
public function months(DateInterval $diff) { if ($diff->days >= 365) { return FALSE; } $x = (int) floor($diff->days / 30.417); if ($x === 0) { return 1; } else { return $x; } }
php
{ "resource": "" }
q7476
CookieMonster.addClassOption
train
protected function addClassOption($name, $value) { $value = trim($value); if (substr($value, 0, 1) == '.' || substr($value, 0, 1) == '#') { $value = substr($value, 1); } if ($value != '') { $this->addOption('class', $name, $value); } }
php
{ "resource": "" }
q7477
CookieMonster.addContentOption
train
protected function addContentOption($name, $value) { $value = trim($value); if (!empty($value) && is_string($value)) { $this->addOption('content', $name, $value); } }
php
{ "resource": "" }
q7478
CookieMonster.addCookieBoolOption
train
protected function addCookieBoolOption($name, $value) { if ($value === true || $value === false) { $this->addOption('cookie', $name, $value); } }
php
{ "resource": "" }
q7479
CookieMonster.addCookieIntOption
train
protected function addCookieIntOption($name, $value) { $value = trim($value); if ($value !== null && $value !== '' && is_numeric($value)) { $this->addOption('cookie', $name, (int)$value); } }
php
{ "resource": "" }
q7480
CookieMonster.addCookieOption
train
protected function addCookieOption($name, $value) { if (is_string($value)) { $value = preg_replace("~^;? ?$name=~", '', trim($value)); if ($value !== '') { $this->addOption('cookie', $name, $value); } } }
php
{ "resource": "" }
q7481
CookieMonster.addParamsOption
train
protected function addParamsOption($name, $value) { if (is_array($value) && count($value)) { $this->addOption('content', $name, $value); } }
php
{ "resource": "" }
q7482
CookieMonster.addStyle
train
protected function addStyle($what, $value) { if (is_array($value) && count($value)) { $type = 'inner'; switch ($what) { case 0: $type = 'outer'; break; case 2: $type = 'button'; ...
php
{ "resource": "" }
q7483
CookieMonster.checkContent
train
protected function checkContent() { if (is_array($this->content) && count($this->content)) { foreach ($this->content as $name => $value) { switch ($name) { case 'category': case 'mainMessage': case 'buttonMessage': ...
php
{ "resource": "" }
q7484
CookieMonster.checkCookie
train
protected function checkCookie() { if (is_array($this->cookie) && count($this->cookie)) { foreach ($this->cookie as $name => $value) { switch ($name) { case 'domain': case 'path': $this->addCookieOption($name, $value...
php
{ "resource": "" }
q7485
CookieMonster.initCookie
train
protected function initCookie() { $cookieOptions = Json::encode( array_merge( $this->cookieOptions, [ 'classOuter' => str_replace(' ', '.', $this->classOptions['classOuter']), ...
php
{ "resource": "" }
q7486
CookieMonster.prepareViewParams
train
protected function prepareViewParams() { $outerStyle = []; $innerStyle = []; $buttonStyle = []; foreach ($this->outerStyle as $name => $value) { $outerStyle[] = $name . ':' . $value; } foreach ($this->innerStyle as $name => $value) { $innerS...
php
{ "resource": "" }
q7487
CookieMonster.replaceStyle
train
protected function replaceStyle($what, $value) { if (is_array($value) && count($value)) { $type = 'inner'; switch ($what) { case 0: $type = 'outer'; break; case 2: $type = 'button'; ...
php
{ "resource": "" }
q7488
CookieMonster.setDefaults
train
protected function setDefaults() { if (!isset($this->contentOptions['category']) || (isset($this->contentOptions['category']) && empty($this->contentOptions['category']))) { $this->contentOptions['category'] = 'app'; } if (!isset($this->c...
php
{ "resource": "" }
q7489
CookieMonster.setHtmlOptions
train
protected function setHtmlOptions($what, $value) { if (is_array($value) && count($value)) { $type = 'inner'; switch ($what) { case 0: $type = 'outer'; break; case 2: $type = 'button'; ...
php
{ "resource": "" }
q7490
CookieMonster.setMode
train
protected function setMode() { $this->outerStyle = [ 'display' => 'none', 'z-index' => 10000, 'position' => 'fixed', 'background-color' => '#fff', 'font-size' => '12px', 'color' => '#000' ...
php
{ "resource": "" }
q7491
CookieMonster.setCookieView
train
protected function setCookieView($value) { $value = trim($value); if (!empty($value)) { $this->cookieView = $value; } }
php
{ "resource": "" }
q7492
CMySQLDescriptor.buildFieldReplacement
train
public function buildFieldReplacement(array $field_descriptor, $alias = false) { if ($alias === false) { $alias = $field_descriptor['name']; } switch ($field_descriptor['data_type']) { case 'int': $retval = "%d$alias\$d"; break; ...
php
{ "resource": "" }
q7493
CMySQLDescriptor.buildFieldValue
train
public function buildFieldValue($field_descriptor, $value) { if ($value === null) { $retval = 'NULL'; } elseif ($value === false) { $retval = 'false'; } elseif ($value === true) { $retval = 'true'; } else { if (!is_array($value)) { ...
php
{ "resource": "" }
q7494
PandaSigner.signParams
train
public function signParams($method, $path, array $params = array()) { $params = $this->completeParams($params); // generate the signature $params['signature'] = $this->signature($method, $path, $params); return $params; }
php
{ "resource": "" }
q7495
PandaSigner.signature
train
public function signature($method, $path, array $params = array()) { $params = $this->completeParams($params); ksort($params); if (isset($params['file'])) { unset($params['file']); } $canonicalQueryString = str_replace( array('+', '%5B', '%5D'), ...
php
{ "resource": "" }
q7496
PandaSigner.getInstance
train
public static function getInstance($cloudId, Account $account) { $signer = new PandaSigner(); $signer->setCloudId($cloudId); $signer->setAccount($account); return $signer; }
php
{ "resource": "" }
q7497
BatchResult.getItems
train
public function getItems() { $batch = $this->getBatch(); $items = array(); foreach ($batch as $b) { $items[] = $b; } return $items; }
php
{ "resource": "" }
q7498
BatchResult.export
train
public function export(array $params = array()) { $result = array( 'type' => 'list', 'count' => $this->getCount(), 'limit' => elgg_extract('limit', $this->options, elgg_get_config('default_limit')), 'offset' => elgg_extract('offset', $this->options, 0), 'items' => array(), ); $batch = $this->getBa...
php
{ "resource": "" }
q7499
BatchResult.prepareBatchOptions
train
protected function prepareBatchOptions(array $options = array()) { if (!in_array($this->getter, array( 'elgg_get_entities', 'elgg_get_entities_from_metadata', 'elgg_get_entities_from_relationship', ))) { return $options; } $sort = elgg_extract('sort', $options); unset($options['sort']); ...
php
{ "resource": "" }