File tree Expand file tree Collapse file tree
CodeIgniter/Framework/libraries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -461,6 +461,58 @@ public function errorsAsArray()
461461 return $ this ->_error_array ;
462462 }
463463
464+ // --------------------------------------------------------------------
465+
466+ /**
467+ * Get Validation Rules From Configurations
468+ *
469+ * @return array
470+ */
471+ public function configurationRules ()
472+ {
473+ return $ this ->_config_rules ;
474+ }
475+
476+ // --------------------------------------------------------------------
477+
478+ /**
479+ * Get All Validated Fields Except Specified Fields
480+ *
481+ * @param mixed $request
482+ * @return array
483+ */
484+ public function useExcept (array $ except )
485+ {
486+
487+ $ fields = $ this ->validation_data ;
488+
489+ foreach ($ except as $ key ) {
490+ unset($ fields [$ key ]);
491+ }
492+
493+ return $ fields ;
494+ }
495+
496+ // --------------------------------------------------------------------
497+
498+ /**
499+ * Get Only Specified Fields From The Validated Fields
500+ *
501+ * @param array $only
502+ * @return array
503+ */
504+ public function useOnly (array $ only )
505+ {
506+
507+ $ only = !is_array ($ only ) ? [$ only ] : $ only ;
508+
509+ $ fields = $ this ->validation_data ;
510+
511+ return array_intersect_key ($ fields , array_flip ($ only ));
512+
513+ }
514+
515+ // --------------------------------------------------------------------
464516
465517 /**
466518 * Error String
You can’t perform that action at this time.
0 commit comments