Read and parse a JSON content file

@param $path
@return bool|mixed
349825
public static function parseJson($path)
    {
        if (true===@file_exists($path)) {
            $ctt = file_get_contents($path);
            if ($ctt!==false) {
                $data = json_decode($ctt, true);
                if ($data && !empty($data)) {
                    return $data;
                }
            }
        }
        return false;
    }
579780
public function parse($path)
    {
        try {
            $data = YamlParser::parse(file_get_contents($path), YamlParser::PARSE_CONSTANT);
        } catch (Exception $exception) {
            throw new ParseException(
                array(
                    'message'   => 'Error parsing YAML file',
                    'exception' => $exception,
                )
            );
        }

        return $data;
    }
700068
public static function read($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }

        return @file_get_contents($path);
    }
907152
public function read($path)
    {
        try {
            $contents = file_get_contents($path);

        } catch (Exception $e) {

            throw (new ModelConfigurationFileException(
                "Could not find or open configuraion file at '{$path}'"
            ))->setPath($path);
        }

        // Determine whether to interpret the contents as PHP code or JSON data
        if ('<?php' == substr($contents, 0, 5)) {

            try {
                $contents = eval('?>' . $contents);

            } catch (Exception $e) {

                throw (new ModelConfigurationFileException(
                    "Could not interpret CMS model configuration PHP data for '{$path}'"
                ))->setPath($path);
            }

            if ( ! is_array($contents)) {
                throw (new ModelConfigurationFileException(
                    "CMS model configuration PHP file did not return an array for '{$path}'"
                ))->setPath($path);
            }

            return $contents;
        }

        // Fall back is to assume the file contains JSON content
        $json = json_decode($contents, true);

        if (null === $json) {
            throw (new ModelConfigurationFileException(
                "Could not interpret CMS model configuration as JSON data for '{$path}'"
            ))->setPath($path);
        }

        return $json;
    }
645878
private function get_file_structure( $path ) {
		ob_start();
		$content    = include $path;
		$has_output = ob_get_clean();
		// did stuff output
		if ( ! empty( $has_output ) ) {
			$content = json_decode( $has_output, ARRAY_A );
		}

		return $content;
	}
729951
public function read($path) {
        $mapping = $this->mapper->get($path);

        if (!$mapping) {
            return false;
        }

        try {
            $file = $this->client->get($mapping['fid']);

            if (!$file) {
                return false;
            }

            return [
                'contents' => stream_get_contents($file)
            ];
        } catch (SeaweedFSException $e) {
            return false;
        }
    }
347851
public function parse($path)
    {
        try {
            $data = YamlParser::parse(file_get_contents($path));
        } catch (Exception $exception) {
            throw new Exception('Error parsing YAML file');
        }
        return $data;
    }
886264
public function readStream($path)
    {
        try {
            $stream = fopen(cloudinary_url($path), 'r');
        } catch (Exception $e) {
            return false;
        }

        return compact('stream', 'path');
    }
45304
public function read($path)
    {
        if ($response = $this->readStream($path)) {
            return ['contents' => stream_get_contents($response['stream']), 'path' => $response['path']];
        }

        return false;
    }
1313327
public function read($path)
    {
        list (, $fileId) = $this->splitPath($path);
        if ($response = $this->service->files->get($fileId, $this->applyDefaultParams([
            'alt' => 'media'
        ], 'files.get'))) {
            return [
                'contents' => (string) $response->getBody()
            ];
        }

        return false;
    }
699427
public function loadFile($path)
    {
        $parser = Parser::parse($path, $this);
        $this->onLoad();
        return !$parser->isErroneous();
    }
1069085
public function read($path)
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->read($path);
    }
1183942
protected function readConfig($path)
    {
        if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
            return array();
        }

        $yaml = new Parser();

        try {
            $config = (array) $yaml->parse(file_get_contents($path));
        } catch (ParseException $e) {
            return array();
        }

        // adjust relative paths
        foreach ($this->paths as $key) {
            if (isset($config[$key])) {
                $config[$key] = $this->normalizePath($config[$key]);
            }
        }

        return $config;
    }
942980
public function read($path)
    {
        $location = $this->applyPathPrefix($path);
        return [
            'contents' => $this->ossClient->getObject($this->bucket, $location)
        ];
    }
295382
protected function readObject($path)
    {
        $object = $this->applyPathPrefix($path);

        $result['Body'] = $this->client->getObject($this->bucket, $object);
        $result = array_merge($result, ['type' => 'file']);
        return $this->normalizeResponse($result, $path);
    }
266134
public function read($path)
    {
        $contents = file_get_contents($this->applyPathPrefix($path));

        return $contents !== false ? compact('contents') : false;
    }
521552
public function parse($path, $tables, $json)
    {
        $this->path     = $path;
        $parser         = new SwaggerParser();
        $this->document = $parser->parseFile($path);

        $this->tables = $tables;
        $this->json   = $json;

        $documentObject = new OpenAPISpec($this->document, $this->tables, $this->json);

        return $documentObject;
    }