PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.0
Booktics – Appointment Booking Calendar for Service Businesses v1.0.0
1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 All 27 releases
booktics / base / validation / rule-map.php

rule-map.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.0, at base/validation/rule-map.php

35 lines 676 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Validation;
4
5 use Booktics\Validation\Rules\Required_Rule;
6 use Booktics\Validation\Rules\Rule;
7 use Booktics\Validation\Rules\Unique_Rule;
8
9 /**
10 * Rule map class
11 */
12 class Rule_Map {
13 /**
14 * Store rule map
15 *
16 * @var array
17 */
18 protected static $map = array(
19 'required' => Required_Rule::class,
20 'unique' => Unique_Rule::class,
21 );
22
23 /**
24 * Resolve rules
25 *
26 * @param string $rule
27 * @param array $options
28 *
29 * @return Rule
30 */
31 public static function resolve_rule_map( string $rule, array $options ): Rule {
32 return new static::$map[ $rule ]( ...$options );
33 }
34 }
35