_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q236200
User.authenticate
train
public function authenticate(IdentityProvider $identityProvider) { try { // Authenticate the user. $identityProvider->authenticate(); // Success! $this->isAuthenticated = true; // Set the data obtained from the identity provider. $this-...
php
{ "resource": "" }
q236201
Quip.parse
train
public function parse() { $input = $this->queryString; // Parse string if it's not already parsed into an array if (is_string($this->queryString)) { $input = []; parse_str($this->queryString, $input); } $this->query = new Query($input); $thi...
php
{ "resource": "" }
q236202
Quip.parseEmbeds
train
protected function parseEmbeds() { if ($this->query->has('embeds')) { $embeds = explode(',', $this->query->getRaw('embeds')); foreach ($embeds as $embed) { $this->query->addEmbed($this->parseEmbed($embed)); } } }
php
{ "resource": "" }
q236203
Quip.parseIncludes
train
protected function parseIncludes() { if ($this->query->has('includes')) { $this->query->setIncludes( explode(',', $this->query->getRaw('includes')) ); } }
php
{ "resource": "" }
q236204
Quip.parseExcludes
train
protected function parseExcludes() { if ($this->query->has('excludes')) { $this->query->setExcludes( explode(',', $this->query->getRaw('excludes')) ); } }
php
{ "resource": "" }
q236205
Quip.parseSorts
train
protected function parseSorts() { if ($this->query->has('sort')) { $sorts = explode(',', $this->query->getRaw('sort')); foreach($sorts as $sort) { $this->query->addSort($this->parseSort($sort)); } } }
php
{ "resource": "" }
q236206
Quip.parseSort
train
protected function parseSort($sort) { $type = substr($sort, 0, 1); $key = substr($sort, 1); switch ($type) { case '+': $type = Sort::TYPE_ASC; break; case '-': $type = Sort::TYPE_DESC; break; default: throw new NoSuchSortException(); ...
php
{ "resource": "" }
q236207
MarkdownParser.doAutoLinks
train
protected function doAutoLinks($text) { if(!$this->features['auto_mailto']) { return preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', array(&$this, '_doAutoLinks_url_callback'), $text); } return parent::doAutoLinks($text); }
php
{ "resource": "" }
q236208
SharingIcon.getDataAttributes
train
public function getDataAttributes() { $attributes = [ 'data-toggle' => 'popover', 'data-container' => 'body', 'data-placement' => $this->getPlacement() ]; if (($parent = $this->getParent()) && $parent->ShowTitles) { $attributes['data-t...
php
{ "resource": "" }
q236209
SharingIcon.getPlacement
train
public function getPlacement() { if (($parent = $this->getParent()) && $parent->Placement) { return $parent->Placement; } return $this->config()->default_placement; }
php
{ "resource": "" }
q236210
SharingIcon.getPlacementOptions
train
public function getPlacementOptions() { return [ self::PLACEMENT_AUTO => _t(__CLASS__ . '.AUTO', 'Auto'), self::PLACEMENT_TOP => _t(__CLASS__ . '.TOP', 'Top'), self::PLACEMENT_LEFT => _t(__CLASS__ . '.LEFT', 'Left'), self::PLACEMENT_RIGHT => _t(__CLASS__ . '.R...
php
{ "resource": "" }
q236211
SharingIcon.getButton
train
public function getButton() { if ($class = $this->config()->button_class) { // Create Button: $button = $class::create(); // Extend Button: $this->extend('updateButton', $button); // ...
php
{ "resource": "" }
q236212
StateListAwareTrait._getState
train
protected function _getState($key) { $sKey = (string) $key; return array_key_exists($sKey, $this->states) ? $this->states[$sKey] : null; }
php
{ "resource": "" }
q236213
StateListAwareTrait._addState
train
protected function _addState($state) { if (!is_string($state) && !($state instanceof Stringable)) { throw $this->_createInvalidArgumentException( $this->__('Argument is not a valid state.'), null, null, $state ); ...
php
{ "resource": "" }
q236214
Connection.instance
train
public static function instance($connectionStringOrConnectionName=null) { $config = Config::instance(); // Is it a connection string or name? if (strpos($connectionStringOrConnectionName, '://') === false) { $connectionString = $connectionStringOrConnectionName ? $config->getConnection($connectionStringO...
php
{ "resource": "" }
q236215
Connection.loadAdapterClass
train
private static function loadAdapterClass($adapter) { $class = ucwords($adapter) . 'Adapter'; $fqclass = 'ActiveRecord\\' . $class; $source = __DIR__ . "/Adapters/$class.php"; if (!file_exists($source)) throw new DatabaseException("$fqclass not found!"); require_once($source); return $fqclass; }
php
{ "resource": "" }
q236216
Connection.parseConnectionUrl
train
public static function parseConnectionUrl($connectionUrl) { // Parse Url for parts $url = @parse_url($connectionUrl); // No host?! if (!isset($url['host'])) { throw new DatabaseException('Database host must be specified in the connection string. If you want to specify an absolute filename, use e.g. sqlite...
php
{ "resource": "" }
q236217
Connection.columns
train
public function columns($table) { $columns = array(); $sth = $this->queryColumnInfo($table); while (($row = $sth->fetch())) { $c = $this->createColumn($row); $columns[$c->name] = $c; } return $columns; }
php
{ "resource": "" }
q236218
Connection.query
train
public function query($sql, &$values=array()) { if ($this->logging) { if ($values) { $this->logger->addInfo($sql, $values); } else { $this->logger->addInfo($sql); } } $this->lastQuery = $sql; try { if (!($sth = $this->connection->prepare($sql))) throw new DatabaseException($this); ...
php
{ "resource": "" }
q236219
Connection.queryAndFetchOne
train
public function queryAndFetchOne($sql, &$values=array()) { $sth = $this->query($sql, $values); $row = $sth->fetch(PDO::FETCH_NUM); return $row[0]; }
php
{ "resource": "" }
q236220
Connection.queryAndFetch
train
public function queryAndFetch($sql, Closure $handler) { $sth = $this->query($sql); while (($row = $sth->fetch(PDO::FETCH_ASSOC))) $handler($row); }
php
{ "resource": "" }
q236221
Connection.tables
train
public function tables() { $tables = array(); $sth = $this->queryForTables(); while (($row = $sth->fetch(PDO::FETCH_NUM))) $tables[] = $row[0]; return $tables; }
php
{ "resource": "" }
q236222
Connection.quoteName
train
public function quoteName($string) { return $string[0] === static::$QUOTE_CHARACTER || $string[strlen($string) - 1] === static::$QUOTE_CHARACTER ? $string : static::$QUOTE_CHARACTER . $string . static::$QUOTE_CHARACTER; }
php
{ "resource": "" }
q236223
Connection.stringToDateTime
train
public function stringToDateTime($string) { $date = date_create($string); $errors = \DateTime::getLastErrors(); if ($errors['warning_count'] > 0 || $errors['error_count'] > 0) return null; return new DateTime($date->format(static::$dateTimeFormat)); }
php
{ "resource": "" }
q236224
Container.cleanup
train
public function cleanup(): void { foreach ($this->getStore() as $key => $value) { $this->remove($key); } }
php
{ "resource": "" }
q236225
Controller.getDefaultTemplateEngine
train
protected function getDefaultTemplateEngine() { $smarty = new Smarty(); $smarty->debugging = false; $smarty->caching = false; $smarty->left_delimiter = '{|'; $smarty->right_delimiter = '|}'; $smarty->setTemplateDir($this->resourcePath); ...
php
{ "resource": "" }
q236226
Controller.getTemplateEngine
train
public function getTemplateEngine() { if (null == $this->templateEngine) { $this->setTemplateEngine($this->getDefaultTemplateEngine()); } return $this->templateEngine; }
php
{ "resource": "" }
q236227
CodeExtractor.getCodeFromDocComment
train
public function getCodeFromDocComment(string $docComment): string { $startExampleKeyword = strpos($docComment, Constants::EXAMPLE_KEYWORD); $startCodeKeyword = strpos($docComment, Constants::CODE_KEYWORD); if ($startExampleKeyword !== false) { $matches = $this->getCodeWithExampl...
php
{ "resource": "" }
q236228
CodeExtractor.getCodeFromDocumentation
train
public function getCodeFromDocumentation(string $fileContent): array { $start = strpos($fileContent, Constants::MARKDOWN_PHP_CODE_KEYWORD); $code = substr($fileContent, $start); $regularExpression = '!' . Constants::MARKDOWN_PHP_CODE_KEYWORD . self::DOCUMENTATION_REGEX . '!'; if (!p...
php
{ "resource": "" }
q236229
Boolean.render
train
public function render() { $html = parent::render(); if (is_null($this->value)) { $html = str_replace('%value%', '', $html); } else if ($this->value) { $content = static::getAssetContent('true'); $html = str_replace('%value%', $content, $html); } else { $content = st...
php
{ "resource": "" }
q236230
TinyMceInsertDateTime.editTinyMcePluginLoaderConfig
train
public function editTinyMcePluginLoaderConfig ($arrTinyConfig) { $arrTinyConfig["insertdatetime_formats"] = '["' . $this->transformFormat($GLOBALS['TL_CONFIG']['dateFormat']) . '", "' . $this->transformFormat($GLOBALS['TL_CONFIG']['timeFormat']) . '"],'; return $arrTinyConfig; }
php
{ "resource": "" }
q236231
TinyMceInsertDateTime.transformFormat
train
private function transformFormat($strFormat) { $arrFormatTokens = str_split($strFormat); foreach ($arrFormatTokens as $i => $token) { if (ctype_alpha($token)) { $arrFormatTokens[$i] = $this->arrMapping[$token]; } } return implode('', $arrFormatTokens); }
php
{ "resource": "" }
q236232
Package.load
train
public static function load($package, $path = null) { if (is_array($package)) { foreach ($package as $pkg => $path) { if (is_numeric($pkg)) { $pkg = $path; $path = null; } static::load($pkg, $path); } return false; } if (static::loaded($package)) { return; } // ...
php
{ "resource": "" }
q236233
Package.exists
train
public static function exists($package) { if (array_key_exists($package, static::$packages)) { return static::$packages[$package]; } else { $paths = \Config::get('package_paths', array()); empty($paths) and $paths = array(PKGPATH); foreach ($paths as $path) { if (is_dir($path.$package)) ...
php
{ "resource": "" }
q236234
Singleton.forceInstance
train
static function forceInstance(Singleton $object, $class = null) { if($class == null) $class = get_class($object); if(!isset(self::$instances[$class])) { self::$instances[$class] = $object; } else { throw new \Exception(sprintf('Object of class %s was previously instanciated', $class)); } }
php
{ "resource": "" }
q236235
BConfigCategory.registerGroup
train
public function registerGroup($name,$alias,$fields){ $grp=new BConfigCategoryGroup(); $grp->alias=$alias; $grp->name=$name; foreach($fields as $fld){ $grp->fields[$fld->alias]=$fld; } $this->groups[$alias]=$grp; return $grp; }
php
{ "resource": "" }
q236236
Config.get
train
public function get($name, $default = null) { $parts = explode('.', $name); $partsSize = count($parts); if ($partsSize < 1) { throw new Exception('Invalid config::get format !'); } $this->loadData($parts[0]); if ($partsSize == 1) { return $t...
php
{ "resource": "" }
q236237
DefaultConnectionPool.connect
train
private function connect(array &$connections) { $exceptions = []; while (count($connections) > 0) { /** @var Connection $connection */ $connection = array_pop($connections); try { if ($connection->open()) { return $connection; ...
php
{ "resource": "" }
q236238
HasLayouts.debug
train
public function debug($layoutId = null, $data = array()) { $layoutId = $layoutId ?: 'default'; $renderer = new \JLayoutFile($layoutId); $renderer->setIncludePaths($this->getLayoutPaths()); return $renderer->debug(array_merge($this->getLayoutData(), $data)); }
php
{ "resource": "" }
q236239
ApiController.readContent
train
private function readContent(): bool { $rawContent = $this->getRequest()->getRawContent(); if ($rawContent === '') { $this->content = null; return true; } $this->content = json_decode($rawContent, true); if (json_last_error() !== JSON_ERROR_NONE) { ...
php
{ "resource": "" }
q236240
Text.concat
train
public static function concat(iterable $pieces, ?string $delimiter = null): self { $delimiter = is_null($delimiter) ? Text::EMPTY_TEXT : $delimiter; $temp = TextVector::make($pieces) ->concat($delimiter); return self::make($temp); }
php
{ "resource": "" }
q236241
Text.toCamelCase
train
public function toCamelCase(): self { return $this->split('/[_\s\W]+/') ->reduce(function (Text $carry, Text $piece) { return $carry->append($piece->toUpperFirst()->stringify()); }, self::make()) ->toLowerFirst(); }
php
{ "resource": "" }
q236242
Text.toSnakeCase
train
public function toSnakeCase(string $separator = '_'): self { return $this->toCamelCase() ->replace('/[A-Z]/', function ($piece) use ($separator) { return sprintf('%s%s', $separator, strtolower($piece)); }); }
php
{ "resource": "" }
q236243
Text.explode
train
public function explode(string $delimiter, int $limit = PHP_INT_MAX): TextVector { $pieces = explode($delimiter, $this->text, $limit); return TextVector::make($pieces); }
php
{ "resource": "" }
q236244
GeshiHelper.highlight
train
public function highlight($htmlString) { $tags = implode('|', $this->validContainers); $pattern = '#(<(' . $tags . ')[^>]'.$this->langAttribute . '=["\']+([^\'".]*)["\']+>)(.*?)(</\2\s*>|$)#s'; /* matches[0] = whole string matches[1] = open tag including lang attribute ...
php
{ "resource": "" }
q236245
GeshiHelper.highlightText
train
public function highlightText($text, $language, $withStylesheet = false) { $this->_getGeshi(); $this->_geshi->set_source($text); $this->_geshi->set_language($language); return !$withStylesheet ? $this->_geshi->parse_code() : $this->_includeStylesheet() . $this...
php
{ "resource": "" }
q236246
GeshiHelper._getGeshi
train
protected function _getGeshi() { if (!$this->_geshi) { $this->_geshi = new GeSHi(); } $this->_configureInstance($this->_geshi); return $this->_geshi; }
php
{ "resource": "" }
q236247
GeshiHelper._processCodeBlock
train
protected function _processCodeBlock($matches) { list($block, $openTag, $tagName, $lang, $code, $closeTag) = $matches; unset($matches); // check language $lang = $this->validLang($lang); $code = html_entity_decode($code, ENT_QUOTES); // decode text in code block as GeSHi wil...
php
{ "resource": "" }
q236248
GeshiHelper.validLang
train
public function validLang($lang) { if (in_array($lang, $this->validLanguages)) { return $lang; } if ($this->defaultLanguage) { return $this->defaultLanguage; } return false; }
php
{ "resource": "" }
q236249
GeshiHelper._configureInstance
train
protected function _configureInstance($geshi) { if (empty($this->features)) { if (empty($this->configPath)) { $this->configPath = ROOT . DS . 'config' . DS; } if (file_exists($this->configPath . 'geshi.php')) { include $this->configPath . '...
php
{ "resource": "" }
q236250
Title.render
train
public function render() { if (!empty(self::$titleList->toArray())) { return '<title>' . implode('', self::$titleList->toArray()) . '</title>' . PHP_EOL; } else { return false; } }
php
{ "resource": "" }
q236251
MW_Common_Criteria_Expression_Compare_Lucene._createTerm
train
protected function _createTerm( $name, $type, $value ) { switch( $this->getOperator() ) { case '==': $escaped = $this->_escape( $this->getOperator(), SORT_STRING, $value ); $term = new Zend_Search_Lucene_Index_Term( $this->_empty( $escaped ), $name ); return new Zend_Search_Lucene_Search_Query_Ter...
php
{ "resource": "" }
q236252
MW_Common_Criteria_Expression_Compare_Lucene._createListTerm
train
protected function _createListTerm( $name, $type ) { $sign = null; switch( $this->getOperator() ) { case '!=': $sign = false; case '==': $multiterm = new Zend_Search_Lucene_Search_Query_MultiTerm(); foreach( $this->getValue() as $value ) { $escaped = $this->_escape( $this->getOpera...
php
{ "resource": "" }
q236253
JCategories.getInstance
train
public static function getInstance($extension, $options = array()) { $hash = md5($extension . serialize($options)); if (isset(self::$instances[$hash])) { return self::$instances[$hash]; } $parts = explode('.', $extension); $component = 'com_' . strtolower($parts[0]); $section = count($parts) > 1 ? $...
php
{ "resource": "" }
q236254
JCategories.get
train
public function get($id = 'root', $forceload = false) { if ($id !== 'root') { $id = (int) $id; if ($id == 0) { $id = 'root'; } } // If this $id has not been processed yet, execute the _load method if ((!isset($this->_nodes[$id]) && !isset($this->_checkedCategories[$id])) || $forceload) { ...
php
{ "resource": "" }
q236255
JCategoryNode.setParent
train
public function setParent($parent) { if ($parent instanceof JCategoryNode || is_null($parent)) { if (!is_null($this->_parent)) { $key = array_search($this, $this->_parent->_children); unset($this->_parent->_children[$key]); } if (!is_null($parent)) { $parent->_children[] = & $this; }...
php
{ "resource": "" }
q236256
JCategoryNode.removeChild
train
public function removeChild($id) { $key = array_search($this, $this->_parent->_children); unset($this->_parent->_children[$key]); }
php
{ "resource": "" }
q236257
JCategoryNode.&
train
public function &getChildren($recursive = false) { if (!$this->_allChildrenloaded) { $temp = $this->_constructor->get($this->id, true); if ($temp) { $this->_children = $temp->getChildren(); $this->_leftSibling = $temp->getSibling(false); $this->_rightSibling = $temp->getSibling(true); $th...
php
{ "resource": "" }
q236258
JCategoryNode.setSibling
train
public function setSibling($sibling, $right = true) { if ($right) { $this->_rightSibling = $sibling; } else { $this->_leftSibling = $sibling; } }
php
{ "resource": "" }
q236259
JCategoryNode.getSibling
train
public function getSibling($right = true) { if (!$this->_allChildrenloaded) { $temp = $this->_constructor->get($this->id, true); $this->_children = $temp->getChildren(); $this->_leftSibling = $temp->getSibling(false); $this->_rightSibling = $temp->getSibling(true); $this->setAllLoaded(); } if (...
php
{ "resource": "" }
q236260
JCategoryNode.getParams
train
public function getParams() { if (!($this->params instanceof Registry)) { $temp = new Registry; $temp->loadString($this->params); $this->params = $temp; } return $this->params; }
php
{ "resource": "" }
q236261
JCategoryNode.getMetadata
train
public function getMetadata() { if (!($this->metadata instanceof Registry)) { $temp = new Registry; $temp->loadString($this->metadata); $this->metadata = $temp; } return $this->metadata; }
php
{ "resource": "" }
q236262
JCategoryNode.getAuthor
train
public function getAuthor($modified_user = false) { if ($modified_user) { return JFactory::getUser($this->modified_user_id); } return JFactory::getUser($this->created_user_id); }
php
{ "resource": "" }
q236263
JCategoryNode.setAllLoaded
train
public function setAllLoaded() { $this->_allChildrenloaded = true; foreach ($this->_children as $child) { $child->setAllLoaded(); } }
php
{ "resource": "" }
q236264
JCategoryNode.getNumItems
train
public function getNumItems($recursive = false) { if ($recursive) { $count = $this->numitems; foreach ($this->getChildren() as $child) { $count = $count + $child->getNumItems(true); } return $count; } return $this->numitems; }
php
{ "resource": "" }
q236265
Install.fromZip
train
public function fromZip($zip) { $this->data = null; $this->error = null; $this->renamed = false; $this->tempname = null; $this->module_id = null; $this->destination = null; if (!$this->setModuleId($zip)) { return $this->error; } i...
php
{ "resource": "" }
q236266
Install.fromUrl
train
public function fromUrl(array $sources) { $total = count($sources); $finish_message = $this->translation->text('New modules: %inserted, updated: %updated'); $vars = array('@url' => $this->url->get('', array('download_errors' => true))); $errors_message = $this->translation->text('New...
php
{ "resource": "" }
q236267
Install.backup
train
protected function backup() { if (empty($this->tempname)) { return true; } $module = $this->data; $module += array( 'directory' => $this->tempname, 'module_id' => $this->module_id ); $result = $this->getBackupModule()->backup('mo...
php
{ "resource": "" }
q236268
Install.extract
train
protected function extract() { $this->destination = GC_DIR_MODULE . "/{$this->module_id}"; if (file_exists($this->destination)) { $this->tempname = gplcart_file_unique($this->destination . '~'); if (!rename($this->destination, $this->tempname)) { $this->err...
php
{ "resource": "" }
q236269
Install.rollback
train
protected function rollback() { if (!$this->isUpdate() || ($this->isUpdate() && $this->renamed)) { gplcart_file_delete_recursive($this->destination); } if (isset($this->tempname)) { rename($this->tempname, $this->destination); } }
php
{ "resource": "" }
q236270
Install.validate
train
protected function validate() { $this->data = $this->module->getInfo($this->module_id); if (empty($this->data)) { $this->error = $this->translation->text('Failed to read module @id', array('@id' => $this->module_id)); return false; } try { $this-...
php
{ "resource": "" }
q236271
Install.getFilesFromZip
train
public function getFilesFromZip($file) { try { $files = $this->zip->set($file)->getList(); } catch (Exception $e) { return array(); } return count($files) < 2 ? array() : $files; }
php
{ "resource": "" }
q236272
Install.setModuleId
train
protected function setModuleId($file) { $module_id = $this->getModuleIdFromZip($file); try { $this->module_model->checkModuleId($module_id); } catch (Exception $ex) { $this->error = $ex->getMessage(); return false; } // Do not deal with e...
php
{ "resource": "" }
q236273
Install.isEnabledModule
train
protected function isEnabledModule($module_id) { $sql = 'SELECT module_id FROM module WHERE module_id=? AND status > 0'; $result = $this->db->fetchColumn($sql, array($module_id)); return !empty($result); }
php
{ "resource": "" }
q236274
Install.getModuleIdFromZip
train
public function getModuleIdFromZip($file) { $list = $this->getFilesFromZip($file); if (empty($list)) { return false; } $folder = reset($list); if (strrchr($folder, '/') !== '/') { return false; } $nested = 0; foreach ($list ...
php
{ "resource": "" }
q236275
Connection.checkResultCount
train
private function checkResultCount(array $result, $query) { if (count($result) === 0) { throw new RowNotFoundException('Row not found for query: ' . $query); } if (count($result) > 1) { throw new MultipleRowFoundException('Multiple row found for query: ' . $query); ...
php
{ "resource": "" }
q236276
AnnouncementUtils.getSimpleAnnouncement
train
public static function getSimpleAnnouncement( $announcementPathFile=Null ) { // If you modify this default path, make sure you use the right kind of slash if ( ! $announcementPathFile) { $announcementPathFile = '/data/ssp-announcement.php'; } if ( ! file_exists(...
php
{ "resource": "" }
q236277
ConfigBuilder.build
train
public function build() { $config = new Config(); $event = new GetConfigEvent($config); $this->eventDispatcher->dispatch(GuiEvents::GET_CONFIG, $event); return $config; }
php
{ "resource": "" }
q236278
DateTime.monthInRoman
train
public function monthInRoman($number) { $number = intval($number); $romanNumbers = array( 1 => 'I', 2 => 'II', 3 => 'III', 4 => 'IV', 5 => 'V', 6 => 'VI', 7 => 'VII', ...
php
{ "resource": "" }
q236279
DateTime.humanTimeDiff
train
public function humanTimeDiff($time, $chunk = false) { if (!is_integer($time)) { $time = strtotime($time); } if ($chunk) { $different = time() - $time; $seconds = $different; $minutes = round($different / 60); $hours = round($diffe...
php
{ "resource": "" }
q236280
DateTime.dateArray
train
public function dateArray($begin, $end, $format = 'Y-m-d') { $begin = new \DateTime($begin); $end = new \DateTime($end); $end = $end->modify('+1 day'); $interval = new \DateInterval('P1D'); $daterange = new \DatePeriod($begin, $interval, $end); $dateArray = array();...
php
{ "resource": "" }
q236281
DateTime.monthArray
train
public function monthArray($begin, $end, $year = '') { if (empty($year)) { $year = date('Y'); } $dateArray = array(); for ($i = $begin; $i <= $end; ++$i) { $dateArray[] = $i; } return $dateArray; }
php
{ "resource": "" }
q236282
DateTime.yearArray
train
public function yearArray($begin, $end) { $dateArray = array(); for ($i = $begin; $i <= $end; ++$i) { $dateArray[] = $i; } return $dateArray; }
php
{ "resource": "" }
q236283
SimpleUpcasterChain.upcast
train
public function upcast(SerializedEvent $event, UpcastingContext $context) { $result = []; $events = [$event]; foreach ($this->upcasters as $upcaster) { $result = []; foreach ($events as $event) { if ($upcaster->supports($event)) { ...
php
{ "resource": "" }
q236284
ModelManager.getRepository
train
public function getRepository($className) { if (isset($this->repositories[$className])) { return $this->repositories[$className]; } $metadata = $this->getClassMetadata($className); $customRepositoryClassName = $metadata->getCustomRepositoryClassName(); if ($cust...
php
{ "resource": "" }
q236285
ModelManager.hydrate
train
public function hydrate($model, array $fields = array()) { if (is_array($model)) { return $this->getRepository($this->resolveModelClassName(reset($model)))->hydrate($model, $fields); } $row = $this->getRepository($this->resolveModelClassName($model))->hydrate(array($model), $fie...
php
{ "resource": "" }
q236286
ModelManager.resolveModelClassName
train
public function resolveModelClassName($model) { foreach ($this->metadataFactory->getAllMetadata() as $metadata) { /** @var Mapping\ClassMetadata $metadata */ foreach ($metadata->getFieldMappings() as $mapping) { if (is_a($model, $mapping->getName())) { ...
php
{ "resource": "" }
q236287
ModelManager.contains
train
public function contains($model) { $class = $this->getClassMetadata(get_class($model)); foreach ($class->getFieldManagerNames() as $manager) { if (!$this->pool->getManager($manager)->contains($model->{'get' . ucfirst($manager)}())) { return false; } }...
php
{ "resource": "" }
q236288
ModelManager.getIdentifierRepository
train
protected function getIdentifierRepository($className) { $class = $this->getClassMetadata($className); return $this->pool->getManager($class->getManagerIdentifier())->getRepository($class->getFieldMapping($class->getManagerIdentifier())->getName()); }
php
{ "resource": "" }
q236289
TwigExtension.evaluateRule
train
public function evaluateRule($rule, $limit = null) { return $this->rulesEngineProvider->evaluate($rule)->getQueryResults($limit); }
php
{ "resource": "" }
q236290
TwigExtension.evaluateQueryRule
train
public function evaluateQueryRule(QueryValue $query, $params = []) { if(($rule = $query->getRule()) instanceof Rule) { $environment = $this->rulesEngineProvider->evaluate($rule); $this->rulesEngineProvider->setQueryParams($query->getId(), $params); return $en...
php
{ "resource": "" }
q236291
Cookie.exists
train
public static function exists($name) { if (isset($_COOKIE[$name]) && !empty($_COOKIE[$name])) { return true; } else { return false; } }
php
{ "resource": "" }
q236292
Cookie.create
train
public static function create($name, $value, $lifetime, $path = '/') { $expire = self::lifetime($lifetime); return setcookie($name, $value, $expire, $path); }
php
{ "resource": "" }
q236293
Process.process
train
public function process(TemplateInterface $template) { // Create a new intervention image object $image = $this->imageManager->make($this->image); $image = $template->process($image); // Encode the image if it hasn't // been encoded in the template. if (!$image->isE...
php
{ "resource": "" }
q236294
Application.setRequest
train
public function setRequest(Request $request) { $this->request = $request; $this->getContainer()->register('request', $request); return $this; }
php
{ "resource": "" }
q236295
Application.getContainer
train
public function getContainer() { if (is_null(self::$container)) { self::$container = $this->checkContainer(); } return self::$container; }
php
{ "resource": "" }
q236296
Application.getResponse
train
public function getResponse() { if (is_null($this->response)) { $this->response = $this->getRunner()->run(); } return $this->response; }
php
{ "resource": "" }
q236297
Application.getRunner
train
public function getRunner() { if (null === $this->runner) { $runner = $this->getContainer() ->get('middleware.runner') ->setRequest($this->getRequest()) ; $this->setRunner($runner); } return $this->runner; }
php
{ "resource": "" }
q236298
Application.getConfigPath
train
public function getConfigPath() { if (null == $this->configPath) { $this->configPath = getcwd().'/Configuration'; Configuration::addPath($this->configPath); } return $this->configPath; }
php
{ "resource": "" }
q236299
Application.checkContainer
train
protected function checkContainer() { $container = self::$defaultContainer; if ( null != $this->configPath && file_exists($this->configPath.'/services.php') ) { $definitions = include $this->configPath.'/services.php'; $container = ( ...
php
{ "resource": "" }