Ejemplo n.º 1
0
 public function __invoke(array $input)
 {
     $this->stories = new \stories($this->shiftModel, $this->userModel, $this->tokensModel, $this->token);
     if (!empty($input['startTime'] && !empty($input['endTime']))) {
         $startTime = \DateTime::createFromFormat('m-d-Y', $input['startTime']);
         $endTime = \DateTime::createFromFormat('m-d-Y', $input['endTime']);
         $success = $this->stories->getShiftsBetween($startTime, $endTime);
     } else {
         throw new \Exception('improper API usage');
     }
     return (new Payload())->withStatus(Payload::OK)->withOutput(['result' => $success]);
 }