src/Nfilin/Libs/InputData.php
static protected function parseRule($rule)
    {
        switch (gettype($rule)) {
            case 'string':
                $type = $rule;
                $target = null;
                $types = [];
                break;
            case 'array':
                $type = isset($rule['type']) ? $rule['type'] : [];
                $target = isset($rule['target']) ? $rule['target'] : [];
                $types = isset($rule['types']) ? $rule['types'] : [];
                break;
            case 'object':
                $type = isset($rule->type) ? $rule->type : null;
                $target = isset($rule->target) ? $rule->target : null;
                $types = isset($rule->types) ? $rule->types : [];
                break;
            default:
                $type = null;
                $target = null;
                $types = [];
        }
        return compact('type', 'target', 'types');
    }
static protected function parseRule($rule)
    {
        switch (gettype($rule)) {
            case 'string':
                $type = $rule;
                $target = null;
                $types = [];
                break;
            case 'array':
                $type = isset($rule['type']) ? $rule['type'] : [];
                $target = isset($rule['target']) ? $rule['target'] : [];
                $types = isset($rule['types']) ? $rule['types'] : [];
                break;
            case 'object':
                $type = isset($rule->type) ? $rule->type : null;
                $target = isset($rule->target) ? $rule->target : null;
                $types = isset($rule->types) ? $rule->types : [];
                break;
            default:
                $type = null;
                $target = null;
                $types = [];
        }
        return compact('type', 'target', 'types');
    }
static protected function parseRule ( $ rule ) { switch ( gettype ( $ rule ) ) { case 'string' : $ type = $ rule ; $ target = null ; $ types = [ ] ; break ; case 'array' : $ type = isset ( $ rule [ 'type' ] ) ? $ rule [ 'type' ] : [ ] ; $ target = isset ( $ rule [ 'target' ] ) ? $ rule [ 'target' ] : [ ] ; $ types = isset ( $ rule [ 'types' ] ) ? $ rule [ 'types' ] : [ ] ; break ; case 'object' : $ type = isset ( $ rule -> type ) ? $ rule -> type : null ; $ target = isset ( $ rule -> target ) ? $ rule -> target : null ; $ types = isset ( $ rule -> types ) ? $ rule -> types : [ ] ; break ; default : $ type = null ; $ target = null ; $ types = [ ] ; } return compact ( 'type' , 'target' , 'types' ) ; }
Standartise `type`,`target` and `types`
@param array|object|string $rule
@return array
Standartise type target and types