Skip to content

Commit

Permalink
Return shortcode instead of echo.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonagnew committed Jul 28, 2015
1 parent de17b91 commit 1b53168
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Herbert/Framework/Shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,17 @@ public function add($name, $callable, $arguments = [])
@header($key . ': ' . $value);
}

echo $response->getBody();

return;
return $response->getBody();
}

if (is_null($response) || is_string($response))
{
echo $response;

return;
return $response;
}

if (is_array($response) || $response instanceof Jsonable || $response instanceof JsonSerializable)
{
echo (new JsonResponse($response))->getBody();

return;
return (new JsonResponse($response))->getBody();
}

throw new Exception('Unknown response type!');
Expand Down

0 comments on commit 1b53168

Please sign in to comment.