Example #1
0
 function initial()
 {
     if ($initial = parent::initial()) {
         return $initial;
     }
     foreach ($this->checks as $check) {
         if ($initial = $check->initial()) {
             return $initial;
         }
     }
 }
Example #2
0
 /**
  * When multiple checks are present, the first one to return a non-null
  * initial value is applied.
  */
 function initial()
 {
     $initial = parent::initial();
     if ($initial === null) {
         $initial = [];
         foreach ($this->props as $prop => $checks) {
             if ($checks === true) {
                 goto next_prop;
             }
             foreach ($checks as $c) {
                 $pInitial = $c->initial();
                 if ($pInitial !== null) {
                     $initial[$prop] = $pInitial;
                     goto next_prop;
                 }
             }
             $initial[$prop] = null;
             next_prop:
         }
     }
     return $initial;
 }