Пример #1
0
 private function getMultiple($max = 7, $outputFormat = 'json')
 {
     $output = [];
     $n = 0;
     $int = new \DateInterval('P1D');
     while (true) {
         $this->doCalc();
         if (is_null($this->output['east'])) {
             break;
         }
         $output[] = $this->output;
         $n++;
         if (!is_null($max) && $n >= $max) {
             break;
         }
         $this->date->add($int);
     }
     if (is_null($this->output['west'])) {
         \lib\Cache::tillDow();
     } else {
         \lib\Cache::permanent();
     }
     if (is_null($outputFormat)) {
         return $output;
     } else {
         switch ($outputFormat) {
             case 'json':
             default:
                 header('Content-Type: application/json');
                 echo json_encode($output);
         }
     }
 }