src/helpers/BaseYaml.php
/**
     * Decodes the given Yaml string into a PHP data structure using the [[thamtech\yaml\Parser]] extension.
     *
     * @param  string $yaml the Yaml string to be decoded
     *
     * @param thamtech\yaml\Pasrer|array $parser the parser or configuration array
     *
     * @param int $flags A bit field of Symfony\Component\Yaml\Yaml::PARSE_*
     *     constants to customize the YAML parser behavior.
     *     The default is PARSE_CUSTOM_TAGS.
     *
     * @return mixed the PHP data
     *
     * @throws InvalidArgumentException if there is any decoding error
     */
Decodes the given Yaml string into a PHP data structure using the [[thamtech\yaml\Parser]] extension.
@param  string $yaml the Yaml string to be decoded

@param thamtech\yaml\Pasrer|array $parser the parser or configuration array

@param int $flags A bit field of Symfony\Component\Yaml\Yaml::PARSE_
constants to customize the YAML parser behavior.
The default is PARSE_CUSTOM_TAGS.

@return mixed the PHP data

@throws InvalidArgumentException if there is any decoding error
Decodes the given Yaml string into a PHP data structure using the [[ thamtech \ yaml \ Parser ]] extension . @param string $yaml the Yaml string to be decoded @param thamtech \ yaml \ Pasrer|array $parser the parser or configuration array @param int $flags A bit field of Symfony \ Component \ Yaml \ Yaml :: PARSE_ constants to customize the YAML parser behavior . The default is PARSE_CUSTOM_TAGS . @return mixed the PHP data @throws InvalidArgumentException if there is any decoding error
public static function decode($yaml, $parser = [], $flags = 512)
    {
        static::ensureParserDefined();
        $parser = Instance::ensure($parser, Parser::class);
        if (!is_scalar($yaml)) {
            throw new InvalidArgumentException('Invalid YAML data.');
        } elseif ($yaml === null || $yaml === '') {
            return null;
        }
        try {
            return $parser->parse($yaml, $flags);
        } catch (ParseException $e) {
            throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
        }
    }
public static function decode ( $ yaml , $ parser = [ ] , $ flags = 512 ) { static :: ensureParserDefined ( ) ; $ parser = Instance :: ensure ( $ parser , Parser :: class ) ; if ( ! is_scalar ( $ yaml ) ) { throw new InvalidArgumentException ( 'Invalid YAML data.' ) ; } elseif ( $ yaml === null || $ yaml === '' ) { return null ; } try { return $ parser -> parse ( $ yaml , $ flags ) ; } catch ( ParseException $ e ) { throw new InvalidArgumentException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Decodes the given Yaml string into a PHP data structure using the [[thamtech\yaml\Parser]] extension.
Decodes the given Yaml string into a PHP data structure using the [[ thamtech \ yaml \ Parser ]] extension .