/** * Little logging system responses. * * @param string $type * * @return bool */ public function pushFlashMsg($type) { if ($this->versionType === 'dev') { return false; } $exceptionObject = new ExceptionWrap(); try { if ($type === 'error') { $this->logger->addWarning(Carbon::now()->toDateTimeString() . ' : ' . $this->errorMessage); } else { $this->logger->addInfo(Carbon::now()->toDateTimeString() . ' : ' . $this->okMessage); } return true; } catch (\Exception $e) { /** * Debug section */ if ($this->versionType === 'dev') { $exceptionObject->push($e); print $e->getTraceAsString() . PHP_EOL; } $exceptionObject->saveToDisk($e); } return true; }
* I want to find some planes. */ print SearchFactory::find('http://api.travelpayouts.com/data/planes.json ', 'Tu')->fetchOne() . PHP_EOL; print SearchFactory::find('http://api.travelpayouts.com/data/planes.json ', 'Boing 7')->fetchOne() . PHP_EOL; print SearchFactory::find('http://api.travelpayouts.com/data/planes.json ', 'An24')->fetchOne() . PHP_EOL; /** * I want to find some airports =) */ print SearchFactory::find('http://api.travelpayouts.com/data/airports.json ', 'Sheremetievo', 1, false)->fetchOne()['name'] . PHP_EOL; print SearchFactory::find('http://api.travelpayouts.com/data/airports.json ', 'Domogedov', 1, false)->fetchOne()['en'] . PHP_EOL; print SearchFactory::find('http://api.travelpayouts.com/data/airports.json ', 'Yugnosahalinsk', 1, false)->fetchOne()['en'] . PHP_EOL; print SearchFactory::find('http://api.travelpayouts.com/data/airports.json ', 'Puklovo', 1, false)->fetchOne()['en'] . PHP_EOL; } catch (\Exception $ex) { $exp->push($ex); try { $exp->saveToDisk($ex); } catch (\Exception $e) { print sprintf('Exception in %s, in %s line with message %s', $e->getFile(), $e->getLine(), $e->getMessage()); } } /** * {"code":"MOW","name":"Moscow", * "coordinates":{"lon":37.617633,"lat":55.755786},"time_zone":"Europe\/Moscow","name_translations": * {"de":"Moskau","en":"Moscow","zh-CN":"\u83ab\u65af\u79d1","tr":"Moscow", * "ru":"\u041c\u043e\u0441\u043a\u0432\u0430","it":"Mosca","es":"Mosc\u00fa","fr":"Moscou", * "th":"\u0e21\u0e2d\u0e2a\u0e42\u0e01"},"country_code":"RU"} */ /** * Oh God, bug. Cyclic recursion. In the process of repair. */ // print SearchFactory::find(