public function validationErrors($attributes, $rules = null)
    {

        // Rules container
        $this->rules = $this->setValidationRules();

        // Ruleset
        $ruleSet = isset($rules)? $rules : $this->validate;

        // Errors collector
        $errors = [];

        // Leave only the validable attributes
        $attributes = array_intersect_key($attributes, array_flip(array_keys($ruleSet)));

        // Check for required attributes
        foreach ($ruleSet as $key => $rules) {
            if (in_array('required', $rules) && (!isset($attributes[$key]) || trim($attributes[$key]) === '')) {
                $errors[$key] = 'required';
            }
            $ruleSet[$key] = array_diff($rules, ['required']);
        }

        // Check for format errors
        foreach ($attributes as $key => $value) {
            foreach ($ruleSet[$key] as $name => $rule) {
                if (!preg_match($this->rules[$rule], $value)) {
                    $errors[$key] = $rule;
                }
            }
        }

        // Return errors or false
        return count($errors)? $errors : false;
    }