Skip to content

Commit

Permalink
Add Route::hasOption() and Route::hasRequirement() methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Nov 23, 2012
1 parent 5aa6788 commit b930066
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Symfony/Component/Routing/Route.php
Expand Up @@ -233,6 +233,18 @@ public function getOption($name)
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.
*
Expand Down Expand Up @@ -377,6 +389,18 @@ public function getRequirement($key)
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.
*
Expand Down

0 comments on commit b930066

Please sign in to comment.