02/01
2014
Wallogit.com
2017 © Pedro Peláez
With Matcher you can match an object to specified rules and get data returned., (*1)
// Add some rules
$matcher->whenProperty('title')->contains('Hi')->provide(['foo' => 'bar']);
// Get an object to match against
$object = Your\Object;
$object->title = 'Hi';
// Check if the object matches the rules
$data = $matcher->match($object); // Will return "array(array('foo' => 'bar'))"
Every rule can match using different logics. For now, these are the implemented logics:, (*2)
// Applied the a Rule object
$rule->equals('foo'); // Default logic
$rule->startsWith('foo');
$rule->endsWith('foo');
$rule->contains('foo');
//Applied to a Container object using the fluent interface
$matcher->whenProperty('title')->equals('foo');
$matcher->whenProperty('title')->startsWith('foo');
$matcher->whenProperty('title')->endsWith('foo');
$matcher->whenProperty('title')->contains('foo');
Documentation will be updated with: * Using tags * Unique fields * Match logic explained * Match against multiple values * Setting default values * Helpful scenarios when you can use this library, (*3)