public static function loadJsonFromFile($filePath)
    {
        if (!file_exists($filePath)) {
            throw new \RuntimeException("File '{$filePath}' doesn't exist");
        }

        $content = json_decode(file_get_contents($filePath));

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonDecodeException(sprintf(
                'Cannot decode JSON from file "%s" (error: %s)',
                $filePath,
                static::lastJsonErrorMessage()
            ));
        }

        return $content;
    }
public static function loadJsonFromFile($filePath)
    {
        if (!file_exists($filePath)) {
            throw new \RuntimeException("File '{$filePath}' doesn't exist");
        }

        $content = json_decode(file_get_contents($filePath));

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonDecodeException(sprintf(
                'Cannot decode JSON from file "%s" (error: %s)',
                $filePath,
                static::lastJsonErrorMessage()
            ));
        }

        return $content;
    }
public static function loadJsonFromFile ( $ filePath ) { if ( ! file_exists ( $ filePath ) ) { throw new \ RuntimeException ( "File '{$filePath}' doesn't exist" ) ; } $ content = json_decode ( file_get_contents ( $ filePath ) ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new JsonDecodeException ( sprintf ( 'Cannot decode JSON from file "%s" (error: %s)' , $ filePath , static :: lastJsonErrorMessage ( ) ) ) ; } return $ content ; }
Returns the JSON-decoded content of a file.

@param $filePath

@return mixed

@throws \RuntimeException
@throws JsonDecodeException
Returns the JSON - decoded content of a file .