_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q18400
ViewableData_Debugger.forTemplate
train
public function forTemplate($field = null) { // debugging info for a specific field $class = get_class($this->object); if ($field) { return "<b>Debugging Information for {$class}->{$field}</b><br/>" . ($this->object->hasMethod($field) ? "Has method '$field'<br/>" : null) . ($this...
php
{ "resource": "" }
q18401
TimeField.getTimeFormat
train
public function getTimeFormat() { if ($this->getHTML5()) { // Browsers expect ISO 8601 times, localisation is handled on the client $this->setTimeFormat(DBTime::ISO_TIME); } if ($this->timeFormat) {
php
{ "resource": "" }
q18402
TimeField.getInternalFormatter
train
protected function getInternalFormatter() { $formatter = IntlDateFormatter::create( i18n::config()->uninherited('default_locale'), IntlDateFormatter::NONE, IntlDateFormatter::MEDIUM, date_default_timezone_get() // Default to server timezone ); ...
php
{ "resource": "" }
q18403
TimeField.withTimezone
train
protected function withTimezone($timezone, $callback) { $currentTimezone = date_default_timezone_get(); try { if ($timezone) { date_default_timezone_set($timezone); } return $callback();
php
{ "resource": "" }
q18404
EmailField.validate
train
public function validate($validator) { $this->value = trim($this->value); $pattern = '^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$'; // Escape delimiter characters. $safePattern = str_rep...
php
{ "resource": "" }
q18405
DevelopmentAdmin.generatesecuretoken
train
public function generatesecuretoken() { $generator = Injector::inst()->create('SilverStripe\\Security\\RandomGenerator'); $token = $generator->randomToken('sha1'); $body = <<<TXT Generated new token. Please add the following
php
{ "resource": "" }
q18406
GridFieldDataColumns.getDisplayFields
train
public function getDisplayFields($gridField) { if (!$this->displayFields) {
php
{ "resource": "" }
q18407
GridFieldDataColumns.castValue
train
protected function castValue($gridField, $fieldName, $value) { // If a fieldCasting is specified, we assume the result is safe if (array_key_exists($fieldName, $this->fieldCasting)) { $value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]); } elseif (is_objec...
php
{ "resource": "" }
q18408
GridFieldDataColumns.escapeValue
train
protected function escapeValue($gridField, $value) { if (!$escape = $gridField->FieldEscape) { return $value; } foreach ($escape as $search => $replace) {
php
{ "resource": "" }
q18409
Extension.withOwner
train
public function withOwner($owner, callable $callback, $args = []) { try { $this->setOwner($owner);
php
{ "resource": "" }
q18410
LoginForm.setAuthenticatorClass
train
public function setAuthenticatorClass($class) { $this->authenticatorClass = $class; /** @var FieldList|null $fields */ $fields = $this->Fields(); if (!$fields) { return $this; }
php
{ "resource": "" }
q18411
RateLimiter.hit
train
public function hit() { if (!$this->getCache()->has($this->getIdentifier())) { $ttl = $this->getDecay() * 60; $expiry = DBDatetime::now()->getTimestamp() + $ttl; $this->getCache()->set($this->getIdentifier() . '-timer', $expiry, $ttl); } else { $expiry...
php
{ "resource": "" }
q18412
BulkLoader.getImportSpec
train
public function getImportSpec() { $singleton = DataObject::singleton($this->objectClass); // get database columns (fieldlabels include fieldname as a key) // using $$includerelations flag as false, so that it only contain $db fields $fields = (array)$singleton->fieldLabels(false); ...
php
{ "resource": "" }
q18413
DataQuery.removeFilterOn
train
public function removeFilterOn($fieldExpression) { $matched = false; // If given a parameterised condition extract only the condition if (is_array($fieldExpression)) { reset($fieldExpression); $fieldExpression = key($fieldExpression); } $where = $thi...
php
{ "resource": "" }
q18414
DataQuery.initialiseQuery
train
protected function initialiseQuery() { // Join on base table and let lazy loading join subtables $baseClass = DataObject::getSchema()->baseDataClass($this->dataClass()); if (!$baseClass) { throw new InvalidArgumentException("DataQuery::create() Can't find data classes for '{$this...
php
{ "resource": "" }
q18415
DataQuery.ensureSelectContainsOrderbyColumns
train
protected function ensureSelectContainsOrderbyColumns($query, $originalSelect = array()) { if ($orderby = $query->getOrderBy()) { $newOrderby = array(); $i = 0; foreach ($orderby as $k => $dir) { $newOrderby[$k] = $dir; // don't touch func...
php
{ "resource": "" }
q18416
DataQuery.max
train
public function max($field) { $table = DataObject::getSchema()->tableForField($this->dataClass, $field); if (!$table) {
php
{ "resource": "" }
q18417
DataQuery.selectColumnsFromTable
train
protected function selectColumnsFromTable(SQLSelect &$query, $tableClass, $columns = null) { // Add SQL for multi-value fields $schema = DataObject::getSchema(); $databaseFields = $schema->databaseFields($tableClass, false); $compositeFields = $schema->compositeFields($tableClass, fa...
php
{ "resource": "" }
q18418
DataQuery.sort
train
public function sort($sort = null, $direction = null, $clear = true) { if ($clear) { $this->query->setOrderBy($sort, $direction); } else {
php
{ "resource": "" }
q18419
DataQuery.innerJoin
train
public function innerJoin($table, $onClause, $alias = null, $order = 20, $parameters = array()) { if ($table) {
php
{ "resource": "" }
q18420
DataQuery.leftJoin
train
public function leftJoin($table, $onClause, $alias = null, $order = 20, $parameters = array()) { if ($table) {
php
{ "resource": "" }
q18421
DataQuery.joinHasManyRelation
train
protected function joinHasManyRelation( $localClass, $localField, $foreignClass, $localPrefix = null, $foreignPrefix = null, $type = 'has_many' ) { if (!$foreignClass || $foreignClass === DataObject::class) { throw new InvalidArgumentException("Cou...
php
{ "resource": "" }
q18422
DataQuery.joinHasOneRelation
train
protected function joinHasOneRelation( $localClass, $localField, $foreignClass, $localPrefix = null, $foreignPrefix = null ) { if (!$foreignClass) { throw new InvalidArgumentException("Could not find a has_one relationship {$localField} on {$localClass}");...
php
{ "resource": "" }
q18423
DataQuery.joinManyManyRelationship
train
protected function joinManyManyRelationship( $relationClass, $parentClass, $componentClass, $parentField, $componentField, $relationClassOrTable, $parentPrefix = null, $componentPrefix = null ) { $schema = DataObject::getSchema(); if (...
php
{ "resource": "" }
q18424
DataQuery.subtract
train
public function subtract(DataQuery $subtractQuery, $field = 'ID') { $fieldExpression = $subtractQuery->expressionForField($field); $subSelect = $subtractQuery->getFinalisedQuery(); $subSelect->setSelect(array()); $subSelect->selectField($fieldExpression, $field);
php
{ "resource": "" }
q18425
DataQuery.selectFromTable
train
public function selectFromTable($table, $fields) { $fieldExpressions = array_map(function ($item) use ($table) { return Convert::symbol2sql("{$table}.{$item}");
php
{ "resource": "" }
q18426
DataQuery.addSelectFromTable
train
public function addSelectFromTable($table, $fields) { $fieldExpressions = array_map(function ($item) use ($table) { return Convert::symbol2sql("{$table}.{$item}");
php
{ "resource": "" }
q18427
DataQuery.column
train
public function column($field = 'ID') { $fieldExpression = $this->expressionForField($field); $query = $this->getFinalisedQuery(array($field)); $originalSelect = $query->getSelect(); $query->setSelect(array());
php
{ "resource": "" }
q18428
DataQuery.getQueryParam
train
public function getQueryParam($key) { if (isset($this->queryParams[$key])) {
php
{ "resource": "" }
q18429
Controller.doInit
train
public function doInit() { //extension hook $this->extend('onBeforeInit'); // Safety call $this->baseInitCalled = false; $this->init(); if (!$this->baseInitCalled) {
php
{ "resource": "" }
q18430
Controller.beforeHandleRequest
train
protected function beforeHandleRequest(HTTPRequest $request) { //Set up the internal dependencies (request, response) $this->setRequest($request); //Push the current controller to protect against weird session issues
php
{ "resource": "" }
q18431
Controller.removeAction
train
public function removeAction($fullURL, $action = null) { if (!$action) { $action = $this->getAction(); //default to current action } $returnURL = $fullURL; if (($pos = strpos($fullURL, $action))
php
{ "resource": "" }
q18432
Controller.definingClassForAction
train
protected function definingClassForAction($action) { $definingClass = parent::definingClassForAction($action); if ($definingClass) { return $definingClass; } $class = static::class; while ($class != 'SilverStripe\\Control\\RequestHandler') { $template...
php
{ "resource": "" }
q18433
Controller.hasActionTemplate
train
public function hasActionTemplate($action) { if (isset($this->templates[$action])) { return true; } $parentClass = static::class; $templates = array(); while ($parentClass != __CLASS__) { $templates[] = strtok($parentClass, '_')
php
{ "resource": "" }
q18434
Controller.can
train
public function can($perm, $member = null) { if (!$member) { $member = Security::getCurrentUser(); } if (is_array($perm)) { $perm = array_map(array($this, 'can'), $perm, array_fill(0, count($perm), $member)); return min($perm); }
php
{ "resource": "" }
q18435
ValidationResult.combineAnd
train
public function combineAnd(ValidationResult $other) { $this->isValid = $this->isValid && $other->isValid();
php
{ "resource": "" }
q18436
ErrorControlChainMiddleware.safeReloadWithTokens
train
protected function safeReloadWithTokens(HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain) { // Safe reload requires manual boot $this->getApplication()->getKernel()->boot(false); // Ensure session is started $request->getSession()->init($request); ...
php
{ "resource": "" }
q18437
OptionsetField.getOptionClass
train
protected function getOptionClass($value, $odd) { $oddClass = $odd ? 'odd'
php
{ "resource": "" }
q18438
FormRequestHandler.Link
train
public function Link($action = null) { // Forms without parent controller have no link; // E.g. Submission handled via graphql $controller = $this->form->getController(); if (empty($controller)) { return null; } // Respect FormObjectLink() method ...
php
{ "resource": "" }
q18439
FormRequestHandler.getAjaxErrorResponse
train
protected function getAjaxErrorResponse(ValidationResult $result) { // Ajax form submissions accept json encoded errors by default $acceptType = $this->getRequest()->getHeader('Accept'); if (strpos($acceptType, 'application/json') !== false) { // Send validation errors back as JS...
php
{ "resource": "" }
q18440
FormRequestHandler.buttonClicked
train
public function buttonClicked() { $actions = $this->getAllActions(); foreach ($actions as $action) { if ($this->buttonClickedFunc === $action->actionName())
php
{ "resource": "" }
q18441
FormRequestHandler.getAllActions
train
protected function getAllActions() { $fields = $this->form->Fields()->dataFields(); $actions = $this->form->Actions()->dataFields(); $fieldsAndActions = array_merge($fields, $actions); $actions =
php
{ "resource": "" }
q18442
GridState_Data.getData
train
public function getData($name, $default = null) { if (!isset($this->data[$name])) { $this->data[$name] = $default; } else { if (is_array($this->data[$name])) {
php
{ "resource": "" }
q18443
HTTPStreamResponse.isSeekable
train
protected function isSeekable() { $stream = $this->getStream(); if (!$stream) {
php
{ "resource": "" }
q18444
HTTPStreamResponse.consumeStream
train
protected function consumeStream($callback) { // Load from stream $stream = $this->getStream(); if (!$stream) { return null; } // Check if stream must be rewound if ($this->consumed) { if (!$this->isSeekable()) { throw new BadM...
php
{ "resource": "" }
q18445
UploadReceiver.constructUploadReceiver
train
protected function constructUploadReceiver() { // Set Upload instance $this->setUpload(Upload::create()); // filter out '' since this would be a regex problem on JS end $this->getValidator()->setAllowedExtensions( array_filter(File::config()->allowed_extensions) ...
php
{ "resource": "" }
q18446
Map_Iterator.extractValue
train
protected function extractValue($item, $key) { if (is_object($item)) { if (method_exists($item, 'hasMethod') && $item->hasMethod($key)) { return $item->{$key}(); }
php
{ "resource": "" }
q18447
Map_Iterator.key
train
public function key() { if (($this->endItemIdx !== null) && isset($this->lastItems[$this->endItemIdx])) { return $this->lastItems[$this->endItemIdx][0]; } else
php
{ "resource": "" }
q18448
HTMLEditorConfig.get
train
public static function get($identifier = null) { if (!$identifier) { return static::get_active(); } // Create new instance if unconfigured if (!isset(self::$configs[$identifier])) { self::$configs[$identifier] = static::create();
php
{ "resource": "" }
q18449
HTMLEditorConfig.set_config
train
public static function set_config($identifier, HTMLEditorConfig $config = null) { if ($config) { self::$configs[$identifier] =
php
{ "resource": "" }
q18450
HTMLEditorConfig.get_available_configs_map
train
public static function get_available_configs_map() { $configs = array(); foreach (self::$configs as $identifier => $config) { $configs[$identifier]
php
{ "resource": "" }
q18451
TabSet.FieldHolder
train
public function FieldHolder($properties = array()) { $obj = $properties ? $this->customise($properties) : $this;
php
{ "resource": "" }
q18452
TabSet.push
train
public function push(FormField $field) { if ($field instanceof Tab ||
php
{ "resource": "" }
q18453
TabSet.unshift
train
public function unshift(FormField $field) { if ($field instanceof Tab ||
php
{ "resource": "" }
q18454
TabSet.insertBefore
train
public function insertBefore($insertBefore, $field, $appendIfMissing = true) { if ($field instanceof Tab || $field instanceof TabSet) {
php
{ "resource": "" }
q18455
TabSet.insertAfter
train
public function insertAfter($insertAfter, $field, $appendIfMissing = true) { if ($field instanceof Tab || $field instanceof TabSet) {
php
{ "resource": "" }
q18456
ModuleManifest.addModule
train
public function addModule($path) { $module = new Module($path, $this->base); $name = $module->getName(); // Save if not already added if (empty($this->modules[$name])) { $this->modules[$name] = $module;
php
{ "resource": "" }
q18457
ModuleManifest.activateConfig
train
public function activateConfig() { $modules = $this->getModules(); // Work in reverse priority, so the higher priority modules get later execution /** @var Module $module
php
{ "resource": "" }
q18458
ModuleManifest.getModule
train
public function getModule($name) { // Optimised find if (isset($this->modules[$name])) { return $this->modules[$name]; } // Fall back to lookup by shortname if (!strstr($name, '/')) { foreach ($this->modules as $module) {
php
{ "resource": "" }
q18459
ModuleManifest.sort
train
public function sort() { $order = static::config()->uninherited('module_priority'); $project = static::config()->get('project'); /* @var PrioritySorter $sorter */ $sorter = Injector::inst()->createWithArgs( PrioritySorter::class . '.modulesorter', [ ...
php
{ "resource": "" }
q18460
ModuleManifest.getModuleByPath
train
public function getModuleByPath($path) { // Ensure path exists $path = realpath($path); if (!$path) { return null; } /** @var Module $rootModule */ $rootModule = null; // Find based on loaded modules $modules = ModuleLoader::inst()->getMa...
php
{ "resource": "" }
q18461
IntlLocales.scriptDirection
train
public function scriptDirection($locale = null) { $dirs = static::config()->get('text_direction'); if (!$locale) { $locale = i18n::get_locale(); } if (isset($dirs[$locale])) { return $dirs[$locale];
php
{ "resource": "" }
q18462
IntlLocales.getLocales
train
public function getLocales() { // Cache by locale $locale = i18n::get_locale(); if (!empty(static::$cache_locales[$locale])) { return static::$cache_locales[$locale]; } // Localise all locales $locales = $this->config()->get('locales'); $localised...
php
{ "resource": "" }
q18463
IntlLocales.getLanguages
train
public function getLanguages() { // Cache by locale $locale = i18n::get_locale(); if (!empty(static::$cache_languages[$locale])) { return static::$cache_languages[$locale]; } // Localise all languages $languages = $this->config()->get('languages'); ...
php
{ "resource": "" }
q18464
IntlLocales.getCountries
train
public function getCountries() { // Cache by locale $locale = i18n::get_locale(); if (!empty(static::$cache_countries[$locale])) { return static::$cache_countries[$locale]; } // Localise all countries $countries = $this->config()->get('countries');
php
{ "resource": "" }
q18465
ConfigLoader.nest
train
public function nest() { // Nest config $manifest = clone $this->getManifest(); // Create new blank loader with new stack (top level nesting) $newLoader = new static;
php
{ "resource": "" }
q18466
YamlWriter.getPluralForm
train
protected function getPluralForm($value) { // Strip non-plural keys away if (is_array($value)) { $forms = i18n::config()->uninherited('plurals'); $forms = array_combine($forms, $forms); return array_intersect_key($value, $forms);
php
{ "resource": "" }
q18467
YamlWriter.getYaml
train
public function getYaml($messages, $locale) { $entities = $this->denormaliseMessages($messages); $content = $this->getDumper()->dump([
php
{ "resource": "" }
q18468
YamlWriter.getClassKey
train
protected function getClassKey($entity) { $parts = explode('.', $entity); $class = array_shift($parts); // Ensure the `.ss` suffix gets added to the top level class rather than the key if (count($parts) > 1 && reset($parts) === 'ss') {
php
{ "resource": "" }
q18469
Injector.unnest
train
public static function unnest() { // Unnest unless we would be left at 0 manifests $loader = InjectorLoader::inst(); if ($loader->countManifests() <= 1) { user_error( "Unable to unnest root Injector, please make sure
php
{ "resource": "" }
q18470
Injector.load
train
public function load($config = array()) { foreach ($config as $specId => $spec) { if (is_string($spec)) { $spec = array('class' => $spec); } $file = isset($spec['src']) ? $spec['src'] : null; // class is whatever's explicitly set, ...
php
{ "resource": "" }
q18471
Injector.updateSpec
train
public function updateSpec($id, $property, $value, $append = true) { if (isset($this->specs[$id]['properties'][$property])) { // by ref so we're updating the actual value $current = &$this->specs[$id]['properties'][$property]; if (is_array($current) && $append) { ...
php
{ "resource": "" }
q18472
Injector.convertServiceProperty
train
public function convertServiceProperty($value) { if (is_array($value)) { $newVal = array(); foreach ($value as $k => $v) { $newVal[$k] = $this->convertServiceProperty($v); } return $newVal; } // Evaluate service references ...
php
{ "resource": "" }
q18473
Injector.instantiate
train
protected function instantiate($spec, $id = null, $type = null) { if (is_string($spec)) { $spec = array('class' => $spec); } $class = $spec['class']; // create the object, using any constructor bindings $constructorParams = array(); if (isset($spec['const...
php
{ "resource": "" }
q18474
Injector.setObjectProperty
train
protected function setObjectProperty($object, $name, $value) { if (ClassInfo::hasMethod($object, 'set' . $name)) { $object->{'set' .
php
{ "resource": "" }
q18475
Injector.getServiceName
train
public function getServiceName($name) { // Lazy load in spec (disable inheritance to check exact service name) if ($this->getServiceSpec($name, false)) { return $name; } // okay, check whether we've got a compound name - don't worry about 0 index, cause that's an
php
{ "resource": "" }
q18476
Injector.registerService
train
public function registerService($service, $replace = null) { $registerAt = get_class($service); if ($replace !== null) { $registerAt = $replace; } $this->specs[$registerAt] =
php
{ "resource": "" }
q18477
Injector.unregisterObjects
train
public function unregisterObjects($types) { if (!is_array($types)) { $types = [ $types ]; } // Filter all objects foreach ($this->serviceCache as $key => $object) { foreach ($types as $filterClass) { // Prevent destructive flushing
php
{ "resource": "" }
q18478
Injector.get
train
public function get($name, $asSingleton = true, $constructorArgs = []) { $object = $this->getNamedService($name, $asSingleton, $constructorArgs); if (!$object) {
php
{ "resource": "" }
q18479
Injector.getServiceNamedSpec
train
protected function getServiceNamedSpec($name, $constructorArgs = []) { $spec = $this->getServiceSpec($name); if ($spec) { // Resolve to exact service name (in case inherited) $name = $this->getServiceName($name); } else {
php
{ "resource": "" }
q18480
Injector.getServiceSpec
train
public function getServiceSpec($name, $inherit = true) { if (isset($this->specs[$name])) { return $this->specs[$name]; } // Lazy load $config = $this->configLocator->locateConfigFor($name); if ($config) { $this->load([$name => $config]); i...
php
{ "resource": "" }
q18481
DBYear.getDefaultOptions
train
private function getDefaultOptions($start = null, $end = null) { if (!$start) { $start = (int)date('Y'); } if (!$end) { $end = 1900;
php
{ "resource": "" }
q18482
ExactMatchFilter.oneFilter
train
protected function oneFilter(DataQuery $query, $inclusive) { $this->model = $query->applyRelation($this->relation); $field = $this->getDbName(); $value = $this->getValue(); // Null comparison check if ($value === null) { $where = DB::get_conn()->nullCheckClause($...
php
{ "resource": "" }
q18483
ExactMatchFilter.manyFilter
train
protected function manyFilter(DataQuery $query, $inclusive) { $this->model = $query->applyRelation($this->relation); $caseSensitive = $this->getCaseSensitive(); // Check values for null $field = $this->getDbName(); $values = $this->getValue(); if (empty($values)) { ...
php
{ "resource": "" }
q18484
HTTPCacheControlMiddleware.getVary
train
public function getVary() { // Explicitly set vary if (isset($this->vary)) { return $this->vary;
php
{ "resource": "" }
q18485
HTTPCacheControlMiddleware.addVary
train
public function addVary($vary) { $combied = $this->combineVary($this->getVary(), $vary);
php
{ "resource": "" }
q18486
HTTPCacheControlMiddleware.registerModificationDate
train
public function registerModificationDate($date) { $timestamp = is_numeric($date) ? $date : strtotime($date); if ($timestamp > $this->modificationDate) {
php
{ "resource": "" }
q18487
HTTPCacheControlMiddleware.setState
train
protected function setState($state) { if (!array_key_exists($state, $this->stateDirectives)) {
php
{ "resource": "" }
q18488
HTTPCacheControlMiddleware.applyChangeLevel
train
protected function applyChangeLevel($level, $force) { $forcingLevel = $level + ($force ? self::LEVEL_FORCED : 0); if ($forcingLevel < $this->getForcingLevel()) {
php
{ "resource": "" }
q18489
HTTPCacheControlMiddleware.setStateDirectivesFromArray
train
public function setStateDirectivesFromArray($states, $directives) { foreach ($directives as
php
{ "resource": "" }
q18490
HTTPCacheControlMiddleware.hasStateDirective
train
public function hasStateDirective($state, $directive) { $directive = strtolower($directive);
php
{ "resource": "" }
q18491
HTTPCacheControlMiddleware.getStateDirective
train
public function getStateDirective($state, $directive) { $directive = strtolower($directive); if (isset($this->stateDirectives[$state][$directive])) {
php
{ "resource": "" }
q18492
HTTPCacheControlMiddleware.applyToResponse
train
public function applyToResponse($response) { $headers = $this->generateHeadersFor($response); foreach ($headers as $name
php
{ "resource": "" }
q18493
HTTPCacheControlMiddleware.generateCacheHeader
train
protected function generateCacheHeader() { $cacheControl = []; foreach ($this->getDirectives() as $directive => $value) { if ($value === true) { $cacheControl[] = $directive;
php
{ "resource": "" }
q18494
HTTPCacheControlMiddleware.generateHeadersFor
train
public function generateHeadersFor(HTTPResponse $response) { return array_filter([ 'Last-Modified' => $this->generateLastModifiedHeader(), 'Vary' => $this->generateVaryHeader($response),
php
{ "resource": "" }
q18495
HTTPCacheControlMiddleware.generateVaryHeader
train
protected function generateVaryHeader(HTTPResponse $response) { // split the current vary header into it's parts and merge it with the config settings // to create a list of unique vary values $vary = $this->getVary(); if ($response->getHeader('Vary')) {
php
{ "resource": "" }
q18496
HTTPCacheControlMiddleware.generateExpiresHeader
train
protected function generateExpiresHeader() { $maxAge = $this->getDirective('max-age'); if ($maxAge === false) { return null; } // Add now to max-age to generate expires
php
{ "resource": "" }
q18497
HTTPCacheControlMiddleware.augmentState
train
protected function augmentState(HTTPRequest $request, HTTPResponse $response) { // Errors disable cache (unless some errors are cached intentionally by usercode) if ($response->isError() || $response->isRedirect()) { // Even if publicCache(true) is specified, errors will be uncacheable ...
php
{ "resource": "" }
q18498
SimpleResourceURLGenerator.resolveModuleResource
train
protected function resolveModuleResource(ModuleResource $resource) { // Load from module resource $relativePath = $resource->getRelativePath(); $exists = $resource->exists(); $absolutePath = $resource->getPath(); // Rewrite to _resources with public directory if (Dir...
php
{ "resource": "" }
q18499
ConfirmedPasswordField.setValue
train
public function setValue($value, $data = null) { // If $data is a DataObject, don't use the value, since it's a hashed value if ($data && $data instanceof DataObject) { $value = ''; } //store this for later $oldValue = $this->value; if (is_array($value))...
php
{ "resource": "" }