private function compileRules($rules)
    {
        if (!is_array($rules) || empty($rules)) {
            throw new BadRuleSetException('Rules must be an array of Fixer');
        }

        $this->_rules = [];
        foreach ($rules as $rule) {
            if (is_object($rule)) {
                $fixer = $rule;
                $className = get_class($rule);
            } else {
                $className = class_exists($rule) ? $rule : (class_exists(
                    'JoliTypo\\Fixer\\'.$rule
                ) ? 'JoliTypo\\Fixer\\'.$rule : false);
                if (!$className) {
                    throw new BadRuleSetException(sprintf('Fixer %s not found', $rule));
                }

                $fixer = new $className($this->getLocale());
            }

            if (!$fixer instanceof FixerInterface) {
                throw new BadRuleSetException(sprintf('%s must implement FixerInterface', $className));
            }

            $this->_rules[$className] = $fixer;
        }

        if (empty($this->_rules)) {
            throw new BadRuleSetException("No rules configured, can't fix the content!");
        }
    }