Skip to content

Commit

Permalink
rename function name for detect content type
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 9, 2018
1 parent 241c3ec commit fe98850
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/HeroFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Seld\JsonLint\JsonParser;

function detectAjaxMessageContentType(string $message) : string
function detectMessageContentType(string $message) : string
{
return (new JsonParser())->lint($message) === null
? 'application/problem+json'
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/Mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Zend\Text\Table;
use Zend\View\Renderer\PhpRenderer;

use function ErrorHeroModule\detectAjaxMessageContentType;
use function ErrorHeroModule\detectMessageContentType;

class Mvc extends AbstractListenerAggregate
{
Expand Down Expand Up @@ -106,7 +106,7 @@ private function showDefaultViewWhenDisplayErrorSetttingIsDisabled(MvcEvent $e,
->detach($events);

$message = $this->errorHeroModuleConfig['display-settings']['ajax']['message'];
$contentType = detectAjaxMessageContentType($message);
$contentType = detectMessageContentType($message);

$response->getHeaders()->addHeaderLine('Content-type', $contentType);
$response->setContent($message);
Expand Down
4 changes: 2 additions & 2 deletions src/Middleware/Expressive.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Zend\Psr7Bridge\Psr7ServerRequest;
use Zend\View\Model\ViewModel;

use function ErrorHeroModule\detectAjaxMessageContentType;
use function ErrorHeroModule\detectMessageContentType;

class Expressive implements MiddlewareInterface
{
Expand Down Expand Up @@ -90,7 +90,7 @@ public function exceptionError(Throwable $t, ServerRequestInterface $request) :
private function responseByConfigMessage($key) : ResponseInterface
{
$message = $this->errorHeroModuleConfig['display-settings'][$key]['message'];
$contentType = detectAjaxMessageContentType($message);
$contentType = detectMessageContentType($message);

$response = new Response();
$response->getBody()->write($message);
Expand Down

0 comments on commit fe98850

Please sign in to comment.