protected function loadCredentialJSON(string $file)
    {
        if (!@file_exists($file)) {
            throw new \RuntimeException('The `'.$file.'` file doesn\'t exist');
        }
        if (!is_file($file)) {
            throw new \RuntimeException('`'.$file.'` file not a file');
        }
        if (!is_readable($file)) {
            throw new \RuntimeException('The `'.$file.'` file is not readable');
        }

        $content = file_get_contents($file);
        $data = json_decode($content, true);

        if ($data === null) {
            throw new \RuntimeException('The `'.$file.'` file content is not a valid JSON');
        }

        return $data;
    }
protected function loadCredentialJSON(string $file)
    {
        if (!@file_exists($file)) {
            throw new \RuntimeException('The `'.$file.'` file doesn\'t exist');
        }
        if (!is_file($file)) {
            throw new \RuntimeException('`'.$file.'` file not a file');
        }
        if (!is_readable($file)) {
            throw new \RuntimeException('The `'.$file.'` file is not readable');
        }

        $content = file_get_contents($file);
        $data = json_decode($content, true);

        if ($data === null) {
            throw new \RuntimeException('The `'.$file.'` file content is not a valid JSON');
        }

        return $data;
    }
protected function loadCredentialJSON ( string $ file ) { if ( ! @ file_exists ( $ file ) ) { throw new \ RuntimeException ( 'The `' . $ file . '` file doesn\'t exist' ) ; } if ( ! is_file ( $ file ) ) { throw new \ RuntimeException ( '`' . $ file . '` file not a file' ) ; } if ( ! is_readable ( $ file ) ) { throw new \ RuntimeException ( 'The `' . $ file . '` file is not readable' ) ; } $ content = file_get_contents ( $ file ) ; $ data = json_decode ( $ content , true ) ; if ( $ data === null ) { throw new \ RuntimeException ( 'The `' . $ file . '` file content is not a valid JSON' ) ; } return $ data ; }
Reads a JSON data from a file

@param string $file The file path
@return mixed The data
@throws \RuntimeException If something wrong
Reads a JSON data from a file