Parse given Yaml resource and build array

@throws SymfonyYamlException
@return array
496991
private function parseResource()
    {
        if ($this->isArray($this->resource)) {
            return StdObjectWrapper::toArray($this->resource);
        } elseif ($this->isString($this->resource)) {
            return Yaml::parse($this->resource);
        } elseif ($this->isInstanceOf($this->resource, ConfigObject::class)) {
            return $this->resource->toArray();
        }

        throw new SymfonyYamlException(SymfonyYamlException::UNABLE_TO_PARSE, [gettype($this->resource)]);
    }
513224
public function getYamlParser()
    {
        if ($this->yamlParser === null) {
            $this->yamlParser = new \Symfony\Component\Yaml\Parser();
            $this->triggerEvent('onYamlParserRegistered', array(&$this->yamlParser));
        }

        return $this->yamlParser;
    }
579780
public function parse($path)
    {
        try {
            $data = YamlParser::parse(file_get_contents($path), YamlParser::PARSE_CONSTANT);
        } catch (Exception $exception) {
            throw new ParseException(
                array(
                    'message'   => 'Error parsing YAML file',
                    'exception' => $exception,
                )
            );
        }

        return $data;
    }
735198
public function parse($path)
	{
		try
		{
			$data = SymfonyYaml::parse(file_get_contents($path));
		}
		catch (Exception $exception)
		{
			throw new ParseException(
				array(
					'message'   => 'Error parsing YAML',
					'exception' => $exception,
				)
			);
		}

		return $data;
	}
800173
public function findAll()
    {
        if (null !== $this->yamls) {
            return $this->yamls;
        }

        $yamls = array();

        foreach ($this->kernel->getBundles() as $name => $bundle) {
            foreach ($this->find($bundle) as $yaml) {
                $yamls[$yaml] = $yaml;
            }
        }

        return $this->yamls = $yamls;
    }
1090920
public function parse() : array
    {
        $buffer = $this->routing_rule;
        
        $section_list_set = [];
        $current_list = [];
        do
        {
            $pos = strpos(substr($buffer,1),'/');
            $section = $pos !== false ? substr($buffer, 1, $pos) : substr($buffer, 1);
            $buffer = $pos !== false ? substr($buffer, $pos + 1) : '';
            
            $length = strlen($section);
            if ($length === 0){
                $current_list[] = new class implements EmptyRoutingPathInterface {};
                if (!empty($buffer)){
                    throw new RoutingRuleParseException($this->routing_rule, "Empty routing section is allowed only for last element");
                }
                break;
            }
            $first = $section[0];
            $last = $section[$length - 1];
            if ($first === '[' && $last === ']'){
                // push current list
                $section_list_set[] = $current_list + ['()'];
                // add optional part to current list
                $inside = substr($section, 1, $length - 2);
                if ($inside[0] === ':') {
                    $current_list[] = self::parseVariablePattern($inside);
                }
                else {
                    $current_list[] = $inside;
                }
            }
            else if ($first === ':') {
                $current_list[] = self::parseVariablePattern($section);
            }
            else {
                $current_list[] = $section;
            }
        }
        while(!empty($buffer));
        
        $section_list_set[] = $current_list;
        return $section_list_set;
    }
881433
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\StatusInterface::TYPE_INITIAL && $value['type'] != \Mothership\StateMachine\StatusInterface::TYPE_EXCEPTION) {
                    $state                  = [
                        'name'             => $key,
                        'type'             => $value['type'],
                        'transitions_from' => $value['transitions_from'],
                        'transitions_to'   => $value['transitions_to'],
                    ];
                    $yaml_fixed['states'][] = $state;
                } else {
                    $state                  = [
                        'name' => $key,
                        'type' => $value['type'],
                    ];
                    $yaml_fixed['states'][] = $state;
                }
            }
            
            $yaml_fixed['yaml'] = $this->configuration;

            return $yaml_fixed;
        } catch (\Symfony\Component\Yaml\Exception\ParseException $ex) {
            throw $ex;
        }
    }
1049385
public function getMetadata()
    {
        $schema = array();
        foreach ($this->from as $path) {
            if (is_dir($path)) {
                $files = glob($path . '/*.yml');
                foreach ($files as $file) {
                    $schema = array_merge($schema, (array) Yaml::parse(file_get_contents($file)));
                }
            } else {
                $schema = array_merge($schema, (array) Yaml::parse(file_get_contents($path)));
            }
        }

        $metadatas = array();
        foreach ($schema as $className => $mappingInformation) {
            $metadatas[] = $this->convertToClassMetadataInfo($className, $mappingInformation);
        }

        return $metadatas;
    }
805095
public function toArray(): array
    {
        return array_filter([
            'language' => $this->language,
            'store_searchable_metadata' => ($this->storeSearchableMetadata ? null : false),
            'synonyms' => array_map(function (Synonym $synonym) {
                return $synonym->toArray();
            }, $this->synonyms),
            'shards' => $this->shards,
            'replicas' => $this->replicas,
        ], function ($element) {
            return
            !(
                is_null($element) ||
                (is_array($element) && empty($element))
            );
        });
    }
763361
public function loadYaml($yaml)
    {
        $data = Yaml::parse($yaml);

        $this->keyStore = array_replace_recursive($this->keyStore, $data);
        $this->rebuildPathStore();

        return $this;
    }
1115615
public function toString()
    {
        $result = false;

        if ($encoder = $this->getEncoder())
        {
            $data   = $this->toArray();
            $result = call_user_func($encoder, $data);
        }
        else throw new RuntimeException("No Yaml encoder specified");

        return $result;
    }
1136406
public static function parsePreferences() {
        foreach (new GlobIterator(root().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'*.yaml') as $file) {
            $filechunks = explode(DIRECTORY_SEPARATOR,(string)$file);
            $chunk = array_pop($filechunks);
            if ($chunk == 'local.yaml' || $chunk == 'global.yaml')
                self::parse($file);
            else self::parse($file, strtoupper(explode('.', basename($file))[0]));
        }
    }
1149298
public static function parse($yaml)
    {
        $options = null;
        if (function_exists('yaml_parse')) {
            $options = yaml_parse($yaml);
        } else {
            $options = spyc_load($yaml);
        }

        if ($options === null) {
            throw new YamlParseException('There was an error parsing your YAML front matter');
        }

        return $options;
    }
1368280
def parse_yaml(self, y):
        '''

        '''
        self.component_id = y['componentId']
        self.instance_name = y['instanceName']
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
1121253
def parse_yaml(self, y):
        ''''''
        self._reset()
        self.id = y['id']
        self.path_uri = y['pathUri']
        if 'activeConfigurationSet' in y:
            self.active_configuration_set = y['activeConfigurationSet']
        else:
            self.active_configuration_set = ''
        self.instance_name = y['instanceName']
        self.compositeType = comp_type.from_string(y['compositeType'])
        required = y['isRequired']
        if required == True or required == 'true' or required == '1':
            self.is_required = True
        else:
            self.is_required = False
        if RTS_EXT_NS_YAML + 'comment' in y:
            self.comment = y[RTS_EXT_NS_YAML + 'comment']
        self.visible = False
        if RTS_EXT_NS_YAML + 'visible' in y:
            visible = y.get(RTS_EXT_NS_YAML + 'visible')
            if visible == True or visible == 'true' or visible == 'True':
                self.visible = True

        # Get the children
        if 'dataPorts' in y:
            for p in y.get('dataPorts'):
                self._data_ports.append(DataPort().parse_yaml(p))
        if 'servicePorts' in y:
            for p in y.get('servicePorts'):
                self._service_ports.append(ServicePort().parse_yaml(p))
        if 'configurationSets' in y:
            for p in y.get('configurationSets'):
                self._config_sets.append(ConfigurationSet().parse_yaml(p))
        if 'executionContexts' in y:
            for p in y.get('executionContexts'):
                self._exec_contexts.append(ExecutionContext().parse_yaml(p))
        if 'participants' in y:
            for p in y.get('participants'):
                self._participants.append(Participant().parse_yaml(p))

        # Extended profile children
        if RTS_EXT_NS_YAML + 'location' in y:
            l = y[RTS_EXT_NS_YAML + 'location']
            self._location = Location().parse_yaml(l)
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value

        return self
905275
public function loadFile(string $file) : array
    {
        if (!file_exists($file)) {
            throw new LoaderException("Requested YAML file '{$file}' doesn't exist");
        }

        if (!$this->forceSymfony && $this->hasExtension) {
            $data = yaml_parse_file($file);
        } else {
            $data = Yaml::parse(file_get_contents($file));
        }

        if (!is_array($data)) {
            throw new LoaderException("Requested YAML file '{$file}' does not parse to an array");
        }

        return $data;
    }
619509
public function load($filename)
    {
        if (!class_exists('Symfony\\Component\\Yaml\\Yaml')) {
            throw new \RuntimeException('Unable to read yaml as the Symfony Yaml Component is not installed.');
        }
        $config = Yaml::parse(file_get_contents($filename));

        return $config ?: [];
    }