protected function getDataFromPath(string $path): string
    {
        $isPathRequired = $this->getConfig('pathRequired');

        try {
            Utility::validatePath($path);
        } catch (InvalidArgumentException $e) {
            if ($isPathRequired) {
                throw $e;
            }
            $this->warnings[] = $e->getMessage();

            return (string)json_encode($this->getEmptyResult());
        }

        return (string)file_get_contents($path);
    }