Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Routing\Generator; Chris@0: Chris@0: /** Chris@0: * ConfigurableRequirementsInterface must be implemented by URL generators that Chris@0: * can be configured whether an exception should be generated when the parameters Chris@0: * do not match the requirements. It is also possible to disable the requirements Chris@0: * check for URL generation completely. Chris@0: * Chris@0: * The possible configurations and use-cases: Chris@0: * - setStrictRequirements(true): Throw an exception for mismatching requirements. This Chris@0: * is mostly useful in development environment. Chris@0: * - setStrictRequirements(false): Don't throw an exception but return null as URL for Chris@0: * mismatching requirements and log the problem. Useful when you cannot control all Chris@0: * params because they come from third party libs but don't want to have a 404 in Chris@0: * production environment. It should log the mismatch so one can review it. Chris@0: * - setStrictRequirements(null): Return the URL with the given parameters without Chris@0: * checking the requirements at all. When generating a URL you should either trust Chris@0: * your params or you validated them beforehand because otherwise it would break your Chris@0: * link anyway. So in production environment you should know that params always pass Chris@0: * the requirements. Thus this option allows to disable the check on URL generation for Chris@0: * performance reasons (saving a preg_match for each requirement every time a URL is Chris@0: * generated). Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: * @author Tobias Schultze Chris@0: */ Chris@0: interface ConfigurableRequirementsInterface Chris@0: { Chris@0: /** Chris@0: * Enables or disables the exception on incorrect parameters. Chris@0: * Passing null will deactivate the requirements check completely. Chris@0: * Chris@0: * @param bool|null $enabled Chris@0: */ Chris@0: public function setStrictRequirements($enabled); Chris@0: Chris@0: /** Chris@0: * Returns whether to throw an exception on incorrect parameters. Chris@0: * Null means the requirements check is deactivated completely. Chris@0: * Chris@0: * @return bool|null Chris@0: */ Chris@0: public function isStrictRequirements(); Chris@0: }