public function open()
    {
        if (is_file($this->filename)) {
            $fileData = file_get_contents($this->filename);
            if (false === $fileData) {
                throw new IOException('Unable to get the contents of the json file!');
            }
        } else {
            $fileData = null;
            if (!$this->createIfNotExists) {
                throw new FileNotFoundException("The file doesn't exist!");
            }
        }

        if (0 === strlen($fileData)) {
            $this->contents = [];
        } else {
            $this->contents = json_decode($fileData, true);

            if (null === $this->contents) {
                throw new RuntimeException('The format of the JSON file is invalid!');
            }
        }
    }