@param $default
@param $details

@return array
972991
protected function filterDocMDLayoutTable($default, $details)
    {
        $md = [];
        /** @var $data */
        /** @var $definition */
        /** @var $source */
        extract($details);

        $md[] = "| Method & Endpoint | Parameters | Description |";
        $md[] = "|-------------------|------------|-------------|";
        $groups = $data['groups'];
        foreach ($groups as $groupName => $group) {
            $items = $group['items'];
            foreach ($items as $apiName => $item) {
                /** @var $method string the function name */
                /** @var $endpoint */
                /** @var $parameters */
                /** @var $defaults */
                /** @var $description */
                extract($item);

                $parameters = array_map(function ($item) {
                    return "`{$item}`";
                }, $parameters);

                if (!empty($defaults)) {
                    foreach ($parameters as $index => &$param) {
                        $defaultParam = str_replace('`', '', $param);
                        if (isset($defaults[$defaultParam])) {
                            $param = "{$param} \[default: `{$defaults[$defaultParam]}`\]";
                        }
                    }
                }

                $method = "`{$method}`";

                $row = [];
                $row[] = implode('<br/>', [$method, $endpoint]);
                $params = implode("<br/>", $parameters) ?: '\[none\]';
                $row[] = $params;
                $row[] = $description;
                $row[] = '';

                $md[] = trim(implode(' | ', $row), ' ');
            }
        }

        return $md;
    }
303506
public function listComponentDetails()
    {
        if ($this->detailsCache !== null) {
            return $this->detailsCache;
        }

        $details = [];
        foreach ($this->listComponents() as $componentAlias => $componentClass) {
            $details[$componentAlias] = $this->makeComponent($componentClass)->componentDetails();
        }

        return $this->detailsCache = $details;
    }
197430
protected function getFieldNameForDisplay($details)
    {
        $tableUniqueId = $details['TABLE_SCHEMA'] . '.' . $details['TABLE_NAME'];
        if ($details['COLUMN_COMMENT'] != '') {
            return $details['COLUMN_COMMENT'];
        } elseif (isset($this->advCache['tableStructureLocales'][$tableUniqueId][$details['COLUMN_NAME']])) {
            return $this->advCache['tableStructureLocales'][$tableUniqueId][$details['COLUMN_NAME']];
        }
        return $details['COLUMN_NAME'];
    }
12766
private function get_detail_setting( $setting, $data ) {
		$data['key'] = $setting;
		$type        = $this->app->utility->array_get( $data, 'type', '' );
		$default     = $this->app->utility->array_get( $data, 'default', '' );
		if ( is_callable( $default ) ) {
			$default = $default( $this->app );
		}
		$default = $this->get_expression( $default, $type );
		if ( ! empty( $data['translate'] ) ) {
			$default = $this->app->translate( $default );
		}
		$data['info'] = [];
		if ( '' !== $default ) {
			$data['info'][] = $this->app->translate( 'default' ) . ' = ' . $default;
		}
		if ( isset( $data['min'] ) ) {
			$data['info'][] = $this->app->translate( 'min' ) . ' = ' . $this->get_expression( $data['min'], $type );
		}
		if ( isset( $data['max'] ) ) {
			$data['info'][] = $this->app->translate( 'max' ) . ' = ' . $this->get_expression( $data['max'], $type );
		}
		$data['name']        = $this->get_filter_prefix() . $data['key'];
		$data['saved']       = $this->app->get_option( $data['name'] );
		$data['placeholder'] = $default;
		$value               = $this->apply_filters( $data['key'], $default );
		$data['value']       = $value;
		$data['used']        = $this->get_expression( $value, $type );

		return $data;
	}
1188638
public function getCustomParam($key, $default = null)
    {
        return array_key_exists($key, $this->customParams) ? $this->customParams[$key] : $default;
    }
1349250
public function getParam($key, $default = null)
        {
            $key = (string) $key;
            if (isset($this->_params[$key])) {
                return $this->_params[$key];
            }

            return $default;
        }
112598
private function processDetails(& $details, & $parent_rows, $options, $parent_keys = [], $parent_types = [], $parent_maps = [], $parent_settings = []) {
		$result = [
			'success' => false,
			'error' => [],
			'max_records' => []
		];
		foreach ($details as $k => $v) {
			// acl
			if (!empty($v['acl']) && !\Can::systemFeaturesExist($v['acl'])) continue;
			// initialize model
			$details[$k]['model_object'] = $model = \Factory::model($k, false);
			$pk = $v['pk'] ?? $model->pk;
			// generate keys from parent array
			$keys = [];
			$key_level = count($v['map']);
			if ($key_level == 1) {
				$k1 = key($v['map']);
				$v1 = $v['map'][$k1];
				$column = $v1;
			} else {
				$column = "concat_ws('::', " . implode(', ', $v['map']) . ")";
			}
			// special array for keys
			$parent_keys2 = $parent_keys;
			$parent_keys2[] = $k;
			$parent_types2 = $parent_types;
			$parent_types2[] = $v['type'];
			$parent_maps2 = $parent_maps;
			$parent_maps2[] = $v['map'];
			// create empty arrays
			$result_keys = [];
			$this->getAllChildKeys($parent_rows, $parent_maps2, $parent_keys2, $parent_types2, $result_keys, $keys);
			foreach ($result_keys as $k0 => $v0) {
				array_key_set($parent_rows, $v0, []);
			}
			// building query
			$query = $model->queryBuilder([
				'initiator' => 'collection',
				'skip_acl' => $this->options['skip_acl']
			])->select()->columns(['a.*']);
			// process column overrides
			$query->columnOverrides($model->columns);
			// where
			$query->where('AND', [$column, 'IN', $keys]);
			if (!empty($v['where'])) {
				$query->whereMultiple('AND', $v['where']);
			}
			// sql extensions
			if (!empty($v['sql']['where'])) {
				$query->whereMultiple('AND', $v['sql']['where']);
			}
			// if we need to count # of records
			if (!empty($parent_settings['max_records_model_name'])) {
				$counter_query = clone $query;
				$counter_query->columns(['counter' => 'COUNT(*)'], ['empty_existing' => true]);
				$temp = $counter_query->query();
				if (!empty($temp['rows'][0]['counter'])) {
					if ($temp['rows'][0]['counter'] >= $parent_settings['max_records']) {
						$result['max_records'][$parent_settings['max_records_model_name']] = $temp['rows'][0]['counter'];
						$result['success'] = true;
						return $result;
					}
				}
			}
			// orderby
			$orderby = $options['orderby'] ?? (!empty($model->orderby) ? $model->orderby : null);
			if (!empty($orderby)) {
				$query->orderby($orderby);
			}
			// for update
			if (!empty($options['for_update'])) {
				$query->forUpdate();
			}
			$query_result = $query->query(null);
			if (!$query_result['success']) {
				$this->primary_model->db_object->rollback();
				$result['error'] = array_merge($result['error'], $query_result['error']);
				return $result;
			}
			// process max records
			if (!empty($v['max_records'])) {
				$result['max_records'][$k] = $query_result['num_rows'];
				$v['max_records_model_name'] = $k;
			}
			if (!empty($parent_settings['max_records_model_name'])) {
				$result['max_records'][$parent_settings['max_records_model_name']] = $query_result['num_rows'];
				$v['max_records_model_name'] = $parent_settings['max_records_model_name'];
				$v['max_records'] = $parent_settings['max_records'];
			}
			// if we got rows
			if (!empty($query_result['rows'])) {
				$reverse_map = array_reverse($parent_maps2, true);
				foreach ($query_result['rows'] as $k2 => $v2) {
					$master_key = [];
					// entry itself
					if ($v['type'] == '1M') {
						$temp = [];
						foreach ($pk as $v0) {
							$temp[] = $v2[$v0];
						}
						$master_key[] = implode('::', $temp);
					}
					$previous = $v2;
					foreach ($reverse_map as $k3 => $v3) {
						$temp = [];
						if (empty($v['__relation_pk'])) {
							foreach ($v3 as $k4 => $v4) {
								$previous[$k4] = $previous[$v4];
								$temp[] = $previous[$v4];
							}
						} else {
							foreach ($v['__relation_pk'] as $k4 => $v4) {
								$temp[] = $previous[$v4];
							}
						}
						array_unshift($master_key, $parent_keys2[$k3]);
						if (($parent_types2[$k3 - 1] ?? '') != '11') {
							array_unshift($master_key, implode('::', $temp));
						}
					}
					array_key_set($parent_rows, $master_key, $v2);
				}
				// if we have more details
				if (!empty($v['details'])) {
					$detail_result = $this->processDetails($v['details'], $parent_rows, $options, $parent_keys2, $parent_types2, $parent_maps2, $v);
					if (!$detail_result['success']) {
						$result['error'] = array_merge($result['error'], $detail_result['error']);
						return $result;
					} else {
						if (!empty($detail_result['max_records'])) {
							foreach ($detail_result['max_records'] as $k19 => $v19) {
								$result['max_records'][$k19]+= $v19;
							}
						}
					}
				}
			}
		}
		$result['success'] = true;
		return $result;
	}
506154
public function getAcceptableCharsets(?string $default = null): array
	{
		if(!isset($this->acceptableCharsets))
		{
			$this->acceptableCharsets = $this->parseAcceptHeader($this->get('accept-charset'));
		}

		return $this->acceptableCharsets ?: (array) $default;
	}
466373
public function getValues(string $name, array $default = []): array
    {
        $key = strtolower($name);
        if (!array_key_exists($key, $this->headers)) {
            return $default;
        }

        return $this->headers[$key]->getValuesAsArray();
    }
1312697
public function get_details($completion) {
        $details = array();
        $details['type'] = get_string('unenrolment', 'completion');
        $details['criteria'] = get_string('unenrolment', 'completion');
        $details['requirement'] = get_string('unenrolingfromcourse', 'completion');
        $details['status'] = '';
        return $details;
    }
406561
public function resetButton($details = array())
    {
        $details['mergeClass'] = ! empty($details['mergeClass']) ? $details['mergeClass'] . ' resetButton' : 'resetButton';
        return $this->generateButton($this->buttons['reset'], $details);
    }
745324
public function getParameterDefaults()
  {
      $defaults = [];
      foreach ($this->parameters as $name => $info) {
        $defaults[$name] = isset($info['default']) ? $info['default'] : null;
      }
      return $defaults;
  }
719509
public function getMultiple($keys, $default = null) : array
    {
        if (!is_array($keys) && !is_object($keys)) {
            throw new \TypeError('Arg keys type[' . Utils::getType($keys) . '] is not array|object.');
        }
        return $this->cacheStore->getMultiple($keys, $default);
    }
1205839
public function getMultiple($keys, $default = null): array
    {
        if (!is_iterable($keys)) {
            throw new CacheException('Argument $keys is not iterable.');
        }
        if (!count($keys)) {
            return [];
        }
        $keys = array_unique($keys);
        $this->validateKeys($keys);
        $args = array_map(function ($key) {
            return self::PREFIX_KEY_VALUE . $key;
        }, $keys);
        $values = $this->client->mget(...$args);
        $values = array_map(function ($value) use ($default) {
            return is_null($value) ? $default : $this->unpack($value);
        }, $values);
        return array_combine($keys, $values);
    }
578945
public function detailsExtractSections(Model $Model, $results, $sections = array(), $schema = false, $format = true) {
		if (empty($results)) {
			return $results;
		}

		$details = array();
		$sections = (array) $sections;
		$DetailModel = ClassRegistry::init($this->settings[$Model->alias]['alias']);

		foreach ($results as $result) {
			if (isset($result[$DetailModel->alias])) {
				$result = $result[$DetailModel->alias];
			}

			list($section, $field) = explode('.', $result['field']);
			if (!empty($sections) && !in_array($section, $sections)) {
				continue;
			}

			if (!$schema) {
				$details[$section][$field] = $result['value'];
				continue;
			}

			unset($result['id'], $result['field']);
			$defaults = array('type' => 'string', 'length' => 1);
			if (!empty($Model->detailSchema[$section][$field])) {
				$defaults = array_merge($defaults, $Model->detailSchema[$section][$field]);
			}
			$details[$section][$field] = array_merge($defaults, $result);
		}

		return $details;
	}
1297122
public static function get_core_events_list($detail = true) {
        global $CFG;

        // Disable developer debugging as deprecated events will fire warnings.
        // Setup backup variables to restore the following settings back to what they were when we are finished.
        $debuglevel          = $CFG->debug;
        $debugdisplay        = $CFG->debugdisplay;
        $debugdeveloper      = $CFG->debugdeveloper;
        $CFG->debug          = 0;
        $CFG->debugdisplay   = false;
        $CFG->debugdeveloper = false;

        $eventinformation = array();
        $directory = $CFG->libdir . '/classes/event';
        $files = self::get_file_list($directory);

        // Remove exceptional events that will cause problems being displayed.
        if (isset($files['unknown_logged'])) {
            unset($files['unknown_logged']);
        }
        foreach ($files as $file => $location) {
            $functionname = '\\core\\event\\' . $file;
            // Check to see if this is actually a valid event.
            if (method_exists($functionname, 'get_static_info')) {
                if ($detail) {
                    $ref = new \ReflectionClass($functionname);
                    if (!$ref->isAbstract() && $file != 'manager') {
                        $eventinformation = self::format_data($eventinformation, $functionname);
                    }
                } else {
                    $eventinformation[$functionname] = $file;
                }
            }
        }
        // Now enable developer debugging as event information has been retrieved.
        $CFG->debug          = $debuglevel;
        $CFG->debugdisplay   = $debugdisplay;
        $CFG->debugdeveloper = $debugdeveloper;
        return $eventinformation;
    }
635204
protected function getVars($content, $details = [])
    {
        // Build defaults
        $defaults = [
            'id' => '',
            'title' => Translate::t('map.title', [], 'mapfield'),
            'default' => '',
            'description' => '',
            'can_upload' => current_user_can('upload_files'),
            'url' => $this->getMarkerAssets(),
            'options' => $this->getMapsOptions(),
            'types' => $this->getMapsTypes(),

            // texts
            't_delete_item' => Translate::t('map.delete_selection', [], 'mapfield'),
            't_item_globals' => Translate::t('map.globals', [], 'mapfield'),
            't_item_configs' => Translate::t('map.configurations', [], 'mapfield'),
            't_item_customs' => Translate::t('map.customizations', [], 'mapfield'),
            't_item_preview' => Translate::t('map.preview', [], 'mapfield'),

            't_address' => Translate::t('map.address.title', [], 'mapfield'),
            't_address_description' => Translate::t('map.address.description', [], 'mapfield'),

            't_marker' => Translate::t('map.marker.title', [], 'mapfield'),
            't_marker_add' => Translate::t('map.marker.add', [], 'mapfield'),
            't_marker_cannot_upload' => Translate::t('map.marker.cannot_upload', [], 'mapfield'),

            't_width' => Translate::t('map.width.title', [], 'mapfield'),
            't_width_description' => Translate::t('map.width.description', [], 'mapfield'),

            't_height' => Translate::t('map.height.title', [], 'mapfield'),
            't_height_description' => Translate::t('map.height.description', [], 'mapfield'),

            't_zoom' => Translate::t('map.zoom.title', [], 'mapfield'),
            't_zoom_description' => Translate::t('map.zoom.description', [], 'mapfield'),

            't_type' => Translate::t('map.type.title', [], 'mapfield'),
            't_type_description' => Translate::t('map.type.description', [], 'mapfield'),

            't_options' => Translate::t('map.options.title', [], 'mapfield'),
            't_options_select' => Translate::t('map.options.select', [], 'mapfield'),
            't_options_description' => Translate::t('map.options.description', [], 'mapfield'),

            't_json' => Translate::t('map.json.title', [], 'mapfield'),
            't_json_yes' => Translate::t('map.json.yes', [], 'mapfield'),
            't_json_no' => Translate::t('map.json.no', [], 'mapfield'),
            't_json_description' => Translate::t('map.json.description', [], 'mapfield'),

            't_update' => Translate::t('map.update', [], 'mapfield'),
        ];

        // Build defaults data
        $vars = array_merge($defaults, $content);

        // Retrieve field value
        $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);

        // Update vars
        $this->getModel()->setVars($vars);
    }