Add Route::hasOption() and Route::hasRequirement() methods.
This commit is contained in:
parent
5aa6788298
commit
b930066168
@ -233,6 +233,18 @@ class Route implements \Serializable
|
||||
return isset($this->options[$name]) ? $this->options[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a an option has been set
|
||||
*
|
||||
* @param string $name An option name
|
||||
*
|
||||
* @return Boolean true if the option is set, false otherwise
|
||||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
return array_key_exists($name, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaults.
|
||||
*
|
||||
@ -377,6 +389,18 @@ class Route implements \Serializable
|
||||
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a requirement is set for the given key.
|
||||
*
|
||||
* @param string $name A variable name
|
||||
*
|
||||
* @return Boolean true if a requirement is specified, false otherwise
|
||||
*/
|
||||
public function hasRequirement($key)
|
||||
{
|
||||
return array_key_exists($key, $this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a requirement for the given key.
|
||||
*
|
||||
|
Reference in New Issue
Block a user