public function getRules(int $crud = NULL, string $type = NULL): array
    {
        // first pass to match crud filter
        if ($crud == NULL) {
            $ruleSet = $this->rules;
        } else {
            $ruleSet = [];
            foreach ($this->rules as $rule) {
                if ($rule->crud & $crud) {
                    $ruleSet[] = $rule;
                }
            }

        }

        // first pass to match crud filter
        if ($type == NULL) {
            return $ruleSet;
        } else {
            $filteredRuleSet = [];
            foreach ($ruleSet as $rule) {
                $reflection = new \ReflectionClass($rule);
                $className = $reflection->getShortName();
                if ($className == $type) {
                    $filteredRuleSet[] = $rule;
                }
            }
            return $filteredRuleSet;
        }
    }