8000 Add Route::hasOption() and Route::hasRequirement() methods. · symfony/symfony@b930066 · GitHub
[go: up one dir, main page]

Skip to content

Commit b930066

Browse files
committed
Add Route::hasOption() and Route::hasRequirement() methods.
1 parent 5aa6788 commit b930066

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Symfony/Component/Routing/Route.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ public function getOption($name)
233233
return isset($this->options[$name]) ? $this->options[$name] : null;
234234
}
235235

236+
/**
237+
* Checks if a an option has been set
238+
*
239+
* @param string $name An option name
240+
*
241+
* @return Boolean true if the option is set, false otherwise
242+
*/
243+
public function hasOption($name)
244+
{
245+
return array_key_exists($name, $this->options);
246+
}
247+
236248
/**
237249
* Returns the defaults.
238250
*
@@ -377,6 +389,18 @@ public function getRequirement($key)
377389
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
378390
}
379391

392+
/**
393+
* Checks if a requirement is set for the given key.
394+
*
395+
* @param string $name A variable name
396+
*
397+
* @return Boolean true if a requirement is specified, false otherwise
398+
*/
399+
public function hasRequirement($key)
400+
{
401+
return array_key_exists($key, $this->requirements);
402+
}
403+
380404
/**
381405
* Sets a requirement for the given key.
382406
*

0 commit comments

Comments
 (0)
0