private function determineNextToken(Result $result) { if (!$this->config['output_token']) { return null; } if ($this->config['more_results'] && !$result->search($this->config['more_results'])) { return null; } $nextToken = is_scalar($this->config['output_token']) ? [$this->config['input_token'] => $this->config['output_token']] : array_combine($this->config['input_token'], $this->config['output_token']); return array_filter(array_map(function ($outputToken) use($result) { return $result->search($outputToken); }, $nextToken)); }