diff --git a/src/APnutI.php b/src/APnutI.php index 64efd6c..77665d9 100644 --- a/src/APnutI.php +++ b/src/APnutI.php @@ -521,27 +521,21 @@ class APnutI return []; } $polls = []; - $this->logger->debug('Parsing ' . count($response) . 'results'); + $this->logger->debug('Parsing ' . count($response) . ' results'); foreach ($response as $post) { if (!empty($post['raw'])) { - foreach ($post['raw'] as $raw) { - if (!empty($raw[Poll::$notice_type])) { + foreach ($post['raw'] as $raw_type => $raw) { + if ($raw_type === Poll::$notice_type) { try { - $this->logger->debug('Parsing poll from raw'); - $polls[] = new Poll($raw, $this); + $this->logger->debug('Parsing poll from raw', $raw); + /*$data = ['raw' => [ + Poll::$notice_type => $raw + ]];*/ + $polls[] = new Poll($post, $this); } catch (NotSupportedPollException) { $this->logger->warning('Parsing poll from raw failed. Loading from poll id'); $polls[] = $this->getPoll($raw[Poll::$notice_type]['poll_id']); } - // if (empty($raw[Poll::$notice_type]['prompt'])) { - // $polls[] = $this->getPoll($raw[Poll::$notice_type]['poll_id']); - // } else { - // /*$poll_parsing_data = [ - // 'type' => Poll::$notice_type, - // 'value' => $raw[Poll::$notice_type] - // ];*/ - // $polls[] = new Poll($raw, $this); - // } } } }