src/Viserio/Component/Parser/Parser.php
public function parse(string $payload): array
    {
        if ($payload === '') {
            return [];
        }

        $format = $this->getFormat($payload);

        if ($format !== 'php' && \is_file($payload)) {
            $payload = \file_get_contents($payload);

            if ($payload === false) {
                throw new RuntimeException(\sprintf('A error occurred during reading [%s]', $payload));
            }
        }

        return $this->getParser($format)->parse($payload);
    }
public function parse(string $payload): array
    {
        if ($payload === '') {
            return [];
        }

        $format = $this->getFormat($payload);

        if ($format !== 'php' && \is_file($payload)) {
            $payload = \file_get_contents($payload);

            if ($payload === false) {
                throw new RuntimeException(\sprintf('A error occurred during reading [%s]', $payload));
            }
        }

        return $this->getParser($format)->parse($payload);
    }
Parse given file path or content string.

@param string $payload

@throws \Viserio\Component\Contract\Parser\Exception\ParseException
@throws \RuntimeException                                           if an error occurred during reading

@return array