Skip to content

Commit 3624d27

Browse files
committed
formatting and renaming
1 parent 7c523f1 commit 3624d27

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/Illuminate/Http/Concerns/InteractsWithContentTypes.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,7 @@ public function isJson()
4141
*/
4242
public function expectsJson()
4343
{
44-
return ($this->ajax() && ! $this->pjax() && $this->wantsAnyContentType()) || $this->wantsJson();
45-
}
46-
47-
/**
48-
* Determine if the current request is asking for any content type in return.
49-
*
50-
* @return bool
51-
*/
52-
public function wantsAnyContentType()
53-
{
54-
$acceptable = $this->getAcceptableContentTypes();
55-
56-
if (count($acceptable) === 0) {
57-
return true;
58-
}
59-
60-
return isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*');
44+
return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson();
6145
}
6246

6347
/**
@@ -134,6 +118,20 @@ public function prefers($contentTypes)
134118
}
135119
}
136120

121+
/**
122+
* Determine if the current request accepts any content type in return.
123+
*
124+
* @return bool
125+
*/
126+
public function acceptsAnyContentType()
127+
{
128+
$acceptable = $this->getAcceptableContentTypes();
129+
130+
return count($acceptable) === 0 || (
131+
isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*')
132+
);
133+
}
134+
137135
/**
138136
* Determines whether a request accepts JSON.
139137
*

0 commit comments

Comments
 (0)