/**
  * @param $recordId
  *
  * @return Record
  * @throws AnyContentClientException
  */
 public function getRecord($recordId, $contentTypeName = null, DataDimensions $dataDimensions = null)
 {
     if ($contentTypeName == null) {
         $contentTypeName = $this->getCurrentContentTypeName();
     }
     if ($dataDimensions == null) {
         $dataDimensions = $this->getCurrentDataDimensions();
     }
     if (!$this->hasStashedAllRecords($contentTypeName, $dataDimensions, $this->getRecordClassForContentType($contentTypeName))) {
         // try to get the record directly
         if ($this->numberOfSingleRecordFetches < $this->getConfiguration()->getMaxNumberOfSingleRecordFetches()) {
             $this->numberOfSingleRecordFetches++;
             $path = $this->getConfiguration()->getDefaultPath() . $this->getConfiguration()->getUriRecords($contentTypeName) . '/records/' . $recordId;
             $data = $this->firebase->get($path);
             $data = json_decode($data, true);
             $record = $this->getRecordFactory()->createRecordFromJSON($this->getCurrentContentTypeDefinition(), $data);
             if ($record !== null) {
                 return $record;
             }
             throw new AnyContentClientException('Record ' . $recordId . ' not found for content type ' . $this->getCurrentContentTypeName());
         }
     }
     $records = $this->getAllRecords($this->getCurrentContentTypeName());
     if (array_key_exists($recordId, $records)) {
         return $records[$recordId];
     }
     throw new AnyContentClientException('Record ' . $recordId . ' not found for content type ' . $this->getCurrentContentTypeName());
 }
 /**
  * Gets the contents of a file from Firebase using the last checkpoint
  * recorded for the file. The Editor is configured to checkpoint on every
  * change, for ease of compilation.
  *
  * @param File $file
  * @param FirebaseLib $firebase
  * @return mixed
  */
 public function getFirebaseFileContents(File $file, FirebaseLib $firebase)
 {
     $firebaseFilePath = '/' . $file->project_id . '/' . $file->id;
     return json_decode(utf8_encode($firebase->get($firebaseFilePath)))->checkpoint->o[0];
 }