/** * Overloads the {@link BedrockNode::get()} method to pipe failures through {@link SilverSmithDefaults} * * @param string The path to the setting * @return BedrockNode */ public function get($setting) { $result = parent::get($setting); if (!$result) { return SilverSmithDefaults::get($setting); } return $result; }
/** * Gets a node from the YAML. Can be in Dot.Separated.Syntax * * @param string The name of the node to get * @return BedrockNode */ public function get($setting) { $current = $this->source; $last_key = null; foreach (explode('.', $setting) as $key) { $last_key = $key; if (!isset($current[$key])) { return false; } if (is_array($current[$key])) { $current = $current[$key]; } else { return is_array($current[$key]) ? BedrockNode::create($key, $current[$key], $setting, $this) : $current[$key]; } } return is_array($current) ? BedrockNode::create($last_key, $current, $setting, $this) : $current; }
/** * Get a setting from the project YAML * * @param string A dot-separated path to the setting */ public static function get($setting) { return self::$settings_list->get($setting); }
/** * Creates a new {@link BedrockNode} for the current position of the iterator * * @param string $key The name of the current node * @param array $source The source data for the entire current node * @param string $path The dot-separated path to this node, e.g. Animals.Mammals.Dogs * @return BedrockNode */ protected function createNode($key, $source = null, $path = null) { $class = BedrockNode::get_node_class($key); if (!$class) { $class = $this->iteratorNodeClass; } return new $class($key, current($this->source), "{$this->path}.{$key}", $this->list); }