/** * @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); }
/** * @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); }