{@inheritDoc}
Loads a YAML/YML string as an array

@throws ParseException If If there is an error parsing the YAML string
357244
public function parseString($config)
    {
        try {
            $data = YamlParser::parse($config, YamlParser::PARSE_CONSTANT);
        } catch (Exception $exception) {
            throw new ParseException(
                [
                    'message'   => 'Error parsing YAML string',
                    'exception' => $exception,
                ]
            );
        }

        return (array)$this->parse($data);
    }
1110034
public function load(string $file)
    {
        $this->data = Yaml::parse(file_get_contents($file));
        $this->filename = basename($file);
    }
631420
private JsonArray loadJSONArray(File jsonFile) throws JsonParseException {

        logger.entering(jsonFile);

        String jsonTxt;

        try {
            jsonTxt = FileUtils.readFileToString(jsonFile, "UTF-8");
        } catch (IOException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new ReporterException(e);
        }

        StringBuilder completeJSONTxt = new StringBuilder("[");
        completeJSONTxt.append(StringUtils.removeEnd(jsonTxt, ",\n"));
        completeJSONTxt.append("]");
        JsonArray testObjects = (new JsonParser()).parse(completeJSONTxt.toString()).getAsJsonArray();

        logger.exiting(testObjects);

        return testObjects;
    }
444140
private function _parse($configFile, $exception = true) {
        if ((empty($configFile) || !file_exists($configFile))) {
            if ($exception)
                throw new \Exception("Empty yaml config file or file does not exist: ".$configFile);
            else
                return array();
        }

        $configArr = array();
        $yaml = new \Symfony\Component\Yaml\Parser();

        try {
            $configArr = $yaml->parse(file_get_contents($configFile));
        } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
            $GLOBALS['logger']->info("Unable to parse the file [ %s ]: %s", $configFile, $e->getMessage());
            if ($exception)
                throw new \Exception("Not a valid yaml file: ".$configFile);
        }

        return $configArr;
    }
800771
public function parseString($value) {
    if (is_string($value)) {
      return $value;
    }

    $exportValue = var_export($value, true);
    throw new ParseException("'$exportValue' can not be parsed as a string");
  }
1226278
public function save( $array, $file )
    {
        try
        {
            ob_start( );

            $this->dump( $array );

            $data = ob_get_clean( );

            file_put_contents( $file, $this->filter( self::ON_YAML_SAVE_FILTER, $data, $array, $file ) );
        }
        catch ( \Exception $e )
        {
            throw new YamlException( $e->getMessage( ), $e->getCode( ), $e );
        }
    }
718814
def parse_yaml(self, node):
        '''

        '''
        self.group_id = y['groupId']
        self._members = []
        if 'members' in y:
            for m in y.get('members'):
                self._members.append(TargetComponent().parse_yaml(m))
        return self
881111
def parse_yaml(self, y):
        '''

        '''
        self.id = y['id']
        self._config_data = []
        if 'configurationData' in y:
            for d in y.get('configurationData'):
                self._config_data.append(ConfigurationData().parse_yaml(d))
        return self
649597
public function load() : array
    {
        if (!$this->exists()){
            throw new ConfigFileNotFoundException($this);
        }
        if (!$this->canRead()){
            throw new ConfigFileNotReadableException($this);
        }
    
        $contents = NULL;
        try{
            $contents = $this->getContents();
        }
        catch( FileSystemExceptionInterface $e ){
            throw new ConfigFileInputException($this, $e);
        }
        
        $data = Yaml::parse($contents);
        
        return $data;
    }
956326
def parse_yaml(self, y):
        '''

        '''
        self._targets = []
        if 'targets' in y:
            for t in y['targets']:
                if 'waitTime' in t['condition']:
                    new_target = WaitTime()
                elif 'preceding' in t['condition']:
                    new_target = Preceding()
                else:
                    new_target = Condition()
                new_target.parse_yaml(t)
                self._targets.append(new_target)
        return self
1089712
@Override
    public boolean loadValuesFrom(String filename) {
        String yamlStr = textIn(filename);
        Object y = yaml.load(yamlStr);
        if (y instanceof Map) {
            getCurrentValues().putAll((Map) y);
        } else {
            getCurrentValues().put("elements", y);
        }
        return true;
    }
650719
def parse_yaml(self, y):
        '''

        '''
        super(WaitTime, self).parse_yaml(y)
        self.wait_time = int(y['condition']['waitTime']['waitTime'])
        return self
952729
public function parse(string $string)
    {
        $content = json_decode($string);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new ParseException("Failed to parse as JSON: " . json_last_error_msg());
        }

        return $content;
    }
355679
public static Map<String, Object> parseYamlString(String yaml) throws IOException {
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
        };
        return mapper.readValue(yaml, typeRef);
    }
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;
	}
676655
def load_yaml(filename):
    
    with open(filename) as f:
        ydoc = yaml.safe_load(f.read())
    return (ydoc, serialize_tojson(ydoc))
330044
def load(self, ymlfile=None):
        """"""
        if ymlfile is not None:
            self.ymlfile = ymlfile

        try:
            # If yaml should be 'cleaned' of document references
            if self._clean:
                self.data = self.process(self.ymlfile)
            else:
                with open(self.ymlfile, 'rb') as stream:
                    for data in yaml.load_all(stream):
                        self.data.append(data)

            self.loaded = True
        except ScannerError, e:
            msg = "YAML formattting error - '" + self.ymlfile + ": '" + str(e) + "'"
            raise util.YAMLError(msg)