Skip to content

Commit

Permalink
Refactor onHeadFollows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmtriy Abaimov committed Nov 15, 2017
1 parent 98d2770 commit 3691f1c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Command/HeadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ public function __invoke()
*/
public function onHeadFollows(MultiLineResponse $response)
{
$headers = [];
array_map(function ($line) use (&$headers) {
preg_match('/^([^\:]+)\:\s*(.*)$/', $line, $matches);
return array_reduce($response->getLines(), function ($headers, $line) {
preg_match('/^([^\:]+)\:\s*(.*)$/s', $line, $matches);
if (!empty($matches)) {
$headers[$matches[1]] = trim($matches[2]);
}
}, $response->getLines());

return $headers;
return $headers;
});
}

public function onNoNewsGroupCurrentSelected(Response $response)
Expand Down

0 comments on commit 3691f1c

Please sign in to comment.