Skip to content

Commit

Permalink
Merge pull request #309 from aadmathijssen/fix/add-handling-for-undef…
Browse files Browse the repository at this point in the history
…ined-rulesets

Add handling for undefined rulesets
  • Loading branch information
florianeckerstorfer committed Jun 20, 2022
2 parents 8665e11 + e99ba2c commit c8c58a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/RuleProvider/DefaultRuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Cocur\Slugify\RuleProvider;

use OutOfBoundsException;

/**
* DefaultRuleProvider
*
Expand Down Expand Up @@ -10309,6 +10311,9 @@ class DefaultRuleProvider implements RuleProviderInterface
*/
public function getRules($ruleset)
{
if (!array_key_exists($ruleset, $this->rules)) {
throw new OutOfBoundsException(sprintf('ruleset \'%s\' does not exist', $ruleset));
}
return $this->rules[$ruleset];
}
}

0 comments on commit c8c58a2

Please sign in to comment.