public static function parse(string $input, bool $resultAsObject = false)
    {
        try {
            $data = self::doParse($input, $resultAsObject);
        } catch (SyntaxErrorException $e) {
            $exception = new ParseException($e->getMessage(), -1, null, null, $e);

            if ($token = $e->getToken()) {
                $exception->setParsedLine($token->getLine());
            }

            throw $exception;
        }

        return $data;
    }
public static function parse(string $input, bool $resultAsObject = false)
    {
        try {
            $data = self::doParse($input, $resultAsObject);
        } catch (SyntaxErrorException $e) {
            $exception = new ParseException($e->getMessage(), -1, null, null, $e);

            if ($token = $e->getToken()) {
                $exception->setParsedLine($token->getLine());
            }

            throw $exception;
        }

        return $data;
    }
public static function parse ( string $ input , bool $ resultAsObject = false ) { try { $ data = self :: doParse ( $ input , $ resultAsObject ) ; } catch ( SyntaxErrorException $ e ) { $ exception = new ParseException ( $ e -> getMessage ( ) , - 1 , null , null , $ e ) ; if ( $ token = $ e -> getToken ( ) ) { $ exception -> setParsedLine ( $ token -> getLine ( ) ) ; } throw $ exception ; } return $ data ; }
Parses TOML into a PHP array.

Usage:
<code>
$array = Toml::parse('key = "[1,2,3]"');
print_r($array);
</code>

@param string $input A string containing TOML
@param bool $resultAsObject (optional) Returns the result as an object

@return mixed The TOML converted to a PHP value

@throws ParseException If the TOML is not valid
Parses TOML into a PHP array .