Get json contents from the cache, setting as needed.

@param string $file

@return Json
765525
public function json($file = null) : Json
    {
        if ($file === null) {
            $file = 'module.json';
        }

        return Arr::get($this->moduleJson, $file, function () use ($file) {
            return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->app['files']);
        });
    }
44835
public function loadFile($file)
    {
        if (is_array($file)) {
            return collect($file)->mapWithKeys(function ($subFile, $key) {
                return [$key => $this->loadFile($subFile)];
            })->toArray();
        }

        return $this->parser->parseFile($file);
    }
1329562
public function read($file)
    {
        $fp = fopen($file, 'r+');

        $contents = '';

        while ($part = fread($fp, 1024)) {
            $contents .= $part;
        }

        if (null !== $fp) {
            fclose($fp);
        }

        return $contents;
    }
32697
public function load($file)
    {
        $dir = $this->getDir();

        if (!$this->filesystem->exists($dir . $file)) {
            throw new NotFoundException('File not found.');
        }

        return file_get_contents($dir . $file);
    }
680967
protected function processJSONForeignKeys($file)
    {
        $json = File::get($file);
        $fields = json_decode($json);

        if (! property_exists($fields, 'foreign_keys')) {
            return '';
        }

        $foreignKeysString = '';
        foreach ($fields->foreign_keys as $foreign_key) {
            $foreignKeysString .= $foreign_key->column . '#' . $foreign_key->references . '#' . $foreign_key->on;

            if (property_exists($foreign_key, 'onDelete')) {
                $foreignKeysString .= '#' . $foreign_key->onDelete;
            }

            if (property_exists($foreign_key, 'onUpdate')) {
                $foreignKeysString .= '#' . $foreign_key->onUpdate;
            }

            $foreignKeysString .= ',';
        }

        $foreignKeysString = rtrim($foreignKeysString, ',');

        return $foreignKeysString;
    }
227246
function file_get_contents($file)
		{
			$fd = fopen($file, 'rb');
			$content = fread($fd, filesize($file));
			fclose($fd);
			$this->file_loaded_size+= strlen($content);
			return $content;				
		}
119285
public static function getFileContents(string $file) : string
    {
        if (!is_readable($file)) {
            throw new RuntimeException(sprintf(
                'File "%s" does not exist or is not readable',
                $file
            ));
        }

        $contents = file_get_contents($file);
        if ($contents === false) {
            throw new RuntimeException(sprintf(
                'Could not read from existing and readable file "%s"',
                $file
            ));
        }

        return $contents;
    }
315164
function &read($file) {
		if (!$this->dir || !is_file($dst=$this->dir.$file)) {
			if (!isset($this->data[$file]))
				$this->data[$file]=[];
			return $this->data[$file];
		}
		if ($this->lazy && isset($this->data[$file]))
			return $this->data[$file];
		$fw=\Base::instance();
		$raw=$fw->read($dst);
		switch ($this->format) {
			case self::FORMAT_JSON:
				$data=json_decode($raw,TRUE);
				break;
			case self::FORMAT_Serialized:
				$data=$fw->unserialize($raw);
				break;
		}
		$this->data[$file] = $data;
		return $this->data[$file];
	}
301891
protected function extractCacheContent($file) {
		if ($this->_cacheContent !== null) {
			return $this->_cacheContent;
		}

		$this->_cacheContent = (string)file_get_contents($file);

		return $this->_cacheContent;
	}
1182980
public function getContents($file)
    {
        $file = $this->basePath.'/'.ltrim($file, '/\\');

        if(!file_exists($file))
            throw new \Exedra\Exception\NotFoundException("File [$file] not found");

        return file_get_contents($file);
    }
613733
private function decode($file)
	{
		$json = @\file_get_contents($file);
		if ($json === false) {
			$this->error = $this->error ?: \error_get_last()['message'];

			return null;
		}

		try {
			return Json::decode($json);
		} catch (JsonException $e) {
			$this->error = $this->error ?: $e->getMessage();

			return null;
		}
	}
907132
protected function extractCacheContent($file) {
		$content = (string)file_get_contents($file);

		$cacheTime = 0;
		$content = preg_replace_callback('/^\<\!--cachetime\:(\d+)--\>/', function ($matches) use (&$cacheTime) {
			$cacheTime = (int)$matches[1];
			return '';
		}, $content);

		if (Configure::read('debug')) {
			$modifiedTime = date('Y-m-d H:i:s', filemtime($file));
			$content = '<!--created:' . $modifiedTime . '-->' . $content . '<!--end-->';
		}

		return [
			'content' => $content,
			'time' => $cacheTime
		];
	}
251673
private function getFileContents($file) {
		$content = file_get_contents($file);

		// Remove UTF-8 BOM
		if (substr($content, 0, 3) === pack("CCC", 0xef, 0xbb, 0xbf))
			$content = substr($content, 3);

		return $content;
	}
1175681
public static function read($file)
    {
        if (!is_readable($file)) {
            return;
        }
        $data = @file_get_contents($file);
        if ($data === false) {
            return;
        }
        $value = @unserialize($data);
        if ($value === false) {
            return;
        }

        return $value;
    }
217010
public function loadFile(string $file) : array
    {
        if (!file_exists($file)) {
            throw new LoaderException("Requested JSON file '{$file}' doesn't exist");
        }

        $contents = file_get_contents($file);
        if ($contents === false) {
            throw new LoaderException("Could ont succesfully load requested JSON file '{$file}'");
        }

        $data = json_decode($contents, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new LoaderException(sprintf("Could not load the JSON file '%s': %s", $file, json_last_error_msg()));
        }

        if (!is_array($data)) {
            throw new LoaderException(sprintf("JSON file '%s' did not parse to an array", $file));
        }

        return $data;
    }
958485
public function loadJson($file, $dir = null)
    {
        if (empty($file)) {
            throw new Exception('loadJson Error: File name not set');
        }

        if (! file_exists($file) && ! file_exists($file = $this->dataDir("/$dir/".strtolower($file).'.json'))) {
            return coollect();
        }

        $decoded = json5_decode($this->loadFile($file), true);

        if (is_null($decoded)) {
            throw new Exception("Error decoding json file: $file");
        }

        return coollect($decoded);
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}