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);
    }
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);
    }
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 ) ; }
Read raw data from path.

If the configuration option `pathRequired` is set to `true`, then an
exception will be raised if the path cannot be validated.

Otherwise a warning will be raised and a string representation of an
empty json object will be sent back to the caller.

@see \Qobo\Utils\Utility::validatePath()
@param string $path Full path to file.
@return string File contents.
Read raw data from path .