Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 * multipleResult flag off, use $this->setMultipleResult(true) and call this function again
 * {"item":"Donna MC Christensen, St. Croix ","note":"[5141:  Biographical information under Donna Marie Christian
 * Christensen. ]","line":57672}{"item":"Donna MC Christensen, St. Croix ","note":"[5141:
 * Biographical information under Donna Marie Christian Christensen. ]","line":57672}{"item":"Donna Christian-Green,
 * St. Croix ","note":"[5125:  Biographical information under Donna Marie Christian Christensen. ]","line":56939}%
 */
/**
 * The following example, you can use the factory.
 */
print SearchFactory::find(__DIR__ . '/../src/robotomize/data/cities.json', 'vladvostk', 2, false, true, 1, 'dev')->fetchOne()['name'] . PHP_EOL;
// print Vladivostok
print SearchFactory::find(__DIR__ . '/../src/robotomize/data/cities.json', 'Mosco', 1, true, true, 1, 'dev')->fetchOne() . PHP_EOL;
// print
print SearchFactory::find(__DIR__ . '/../src/robotomize/data/biographical-directory-footnotes.json', 'Lincoln', 1, true, true, 1, 'dev')->fetchFew(10) . PHP_EOL;
// print
$exp = new ExceptionWrap('dev');
try {
    /**
     * 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) {