/**
  * @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());
 }
 /**
  * @param $content
  */
 private function sendToFirebase($content)
 {
     $firebase = new FirebaseLib(self::DEFAULT_URL, self::DEFAULT_TOKEN);
     $data = json_decode($content);
     $array = array_combine($data->Results->output1->value->ColumnNames, $data->Results->output1->value->Values[0]);
     $formattedArray = ['result' => $array['Scored Labels'], 'percent' => $array['Scored Probabilities'], 'capColor' => $array['cap-color'], 'capShape' => $array['cap-shape'], 'edible' => $array['edible'], 'gillColor' => $array['gill-color'], 'stalkColor' => $array['stalk-color'], 'odor' => strtolower($array['odor'])];
     $firebase->push(self::DEFAULT_PATH, $formattedArray);
 }
 /**
  * @param $content
  */
 private function sendToFirebase($content)
 {
     $firebase = new FirebaseLib(self::DEFAULT_URL, self::DEFAULT_TOKEN);
     $data = json_decode($content);
     $array = array_combine($data->Results->output1->value->ColumnNames, $data->Results->output1->value->Values[0]);
     $formattedArray = ["city" => $array['city'], "street" => $array['street'], "streetRr" => $array['street_nr'], "cityPopulation" => $array['city_population'], "hasStreetEntrance" => strtolower($array['has_street_entrance']), "hasBusStop" => strtolower($array['has_bus_stop']), "priceSq" => strtolower($array['price_sq']), "hasGasStation" => strtolower($array['has_gas_station']), "distanceAnotherShop100m" => strtolower($array['distance_another_shop_100m']), "distanceAnotherShop500m" => strtolower($array['distance_another_shop_500m']), "hasParking" => strtolower($array['has_parking']), "incomeUSD" => $array['income_USD'], "result" => (int) $array['Scored Labels']];
     $firebase->push(self::DEFAULT_PATH, $formattedArray);
 }
 /**
  * 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];
 }
 /**
  * @param array  $formattedArray
  * @param string $url
  * @param string $token
  * @param string $path
  * @return void
  */
 public function sendToFirebase($formattedArray, $url, $token, $path)
 {
     $firebase = new FirebaseLib($url, $token);
     $firebase->push($path, $formattedArray);
 }