hshn / class-matcher-bundle
Installs: 540
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4
- hshn/class-matcher: ~0.2
- symfony/framework-bundle: ~2.1
Requires (Dev)
- symfony/browser-kit: ~2.1
This package is not auto-updated.
Last update: 2024-12-17 03:30:24 UTC
README
Make easy to define class matcher as a service in Symfony.
Configure
# app/config/config.yml hshn_class_matcher: matchers: matcher1: { equals: FooExtended } # matches FooExtended matcher2: { implemented: FooInterface } # matches class that implements FooInterface matcher3: { extended: Foo } # matches class that extends Foo matcher4: { anything: ~ } # matches anything matcher5: { and: [matcher1, matcher3] } # matches class that matches matcher 'matcher1' and 'matcher3' matcher6: { or: [matcher1, matcher2] } # matches class that matches matcher 'matcher1' or 'matcher2' matcher7: { not: matcher3 } # matches class that do not extends Foo
Usage
<?php $provider = $container->get('hshn_class_matcher.matcher_provider'); $provider->get('matcher1')->matches('Foo'); // true or false