Skip to content

Commit cb79d91

Browse files
committed
minor symfony#13210 simplify hasScheme method (tjomamokrenko)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes symfony#13210). Discussion ---------- simplify hasScheme method ... and correct the mistake in docblock Commits ------- ad0d93b simplify hasScheme method
2 parents 2ecf45c + ad0d93b commit cb79d91

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Symfony/Component/Routing/Route.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,23 @@ public function setSchemes($schemes)
251251
return $this;
252252
}
253253

254+
/**
255+
* Checks if a scheme requirement has been set.
256+
*
257+
* @param string $scheme
258+
*
259+
* @return bool true if the scheme requirement exists, otherwise false
260+
*/
261+
public function hasScheme($scheme)
262+
{
263+
return in_array(strtolower($scheme), $this->schemes, true);
264+
}
265+
254266
/**
255267
* Returns the uppercased HTTP methods this route is restricted to.
256268
* So an empty array means that any method is allowed.
257269
*
258-
* @return array The schemes
270+
* @return array The methods
259271
*/
260272
public function getMethods()
261273
{

0 commit comments

Comments
 (0)