From 3624d2702c783d13bd23b852ce35662bee9a8fea Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 29 Dec 2017 09:59:37 -0600 Subject: [PATCH] formatting and renaming --- .../Concerns/InteractsWithContentTypes.php | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php index 8037bd55ff6f..cc001925543a 100644 --- a/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php +++ b/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php @@ -41,23 +41,7 @@ public function isJson() */ public function expectsJson() { - return ($this->ajax() && ! $this->pjax() && $this->wantsAnyContentType()) || $this->wantsJson(); - } - - /** - * Determine if the current request is asking for any content type in return. - * - * @return bool - */ - public function wantsAnyContentType() - { - $acceptable = $this->getAcceptableContentTypes(); - - if (count($acceptable) === 0) { - return true; - } - - return isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*'); + return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); } /** @@ -134,6 +118,20 @@ public function prefers($contentTypes) } } + /** + * Determine if the current request accepts any content type in return. + * + * @return bool + */ + public function acceptsAnyContentType() + { + $acceptable = $this->getAcceptableContentTypes(); + + return count($acceptable) === 0 || ( + isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*') + ); + } + /** * Determines whether a request accepts JSON. *