Default HTML formatting implementation for error messages
@param $config Configuration array, vital for HTML output nature
@param $errors Errors array to display; used for recursion.
438434
public function getHTMLFormatted($config, $errors = null) {
        $ret = array();

        $this->generator = new HTMLPurifier_Generator($config, $this->context);
        if ($errors === null) $errors = $this->errors;

        // 'At line' message needs to be removed

        // generation code for new structure goes here. It needs to be recursive.
        foreach ($this->lines as $line => $col_array) {
            if ($line == -1) continue;
            foreach ($col_array as $col => $struct) {
                $this->_renderStruct($ret, $struct, $line, $col);
            }
        }
        if (isset($this->lines[-1])) {
            $this->_renderStruct($ret, $this->lines[-1]);
        }

        if (empty($errors)) {
            return '<p>' . $this->locale->getMessage('ErrorCollector: No errors') . '</p>';
        } else {
            return '<ul><li>' . implode('</li><li>', $ret) . '</li></ul>';
        }

    }
279528
protected function applyCommonConfiguration($config)
    {
        $this->columnName = isset($config['columnName']) ? strval($config['columnName']) : $this->name;

        if (isset($config['visible'])) {
            $this->isVisible = (bool) $config['visible'];
        }
        if (isset($config['readOnly'])) {
            $this->isReadOnly = (bool) $config['readOnly'];
        }
        if (isset($config['defaultValue'])) {
            $this->defaultValue = $config['defaultValue'];
        }
        if (isset($config['accessor'])) {
            $this->accessor = strval($config['accessor']);
        }
        if (isset($config['mutator'])) {
            $this->mutator = strval($config['mutator']);
        }

        if (isset($config['validators'])) {
            $validators = $config['validators'];
            if (!is_array($validators)) {
                throw new UnexpectedValueException($this->translate(
                    'Field validators configuration should be an array.'
                ));
            }
            $this->validators = $validators;
        }

        if (isset($config['filters'])) {
            $filters = $config['filters'];
            if (!is_array($filters)) {
                throw new UnexpectedValueException($this->translate(
                    'Field filters configuration should be an array.'
                ));
            }
            $this->filters = $filters;
        }
    }
599160
private function setError($error)
    {
        $this->errors[] = $error;
        if ($this->do_debug >= 1) {
            echo '<pre>';
            foreach ($this->errors as $error) {
                print_r($error);
            }
            echo '</pre>';
        }
    }
255997
protected function validateInput($input, Configuration $config, array $messages = []): self
    {
        try {
            $config->getValidationRules()->assert($input);
        } catch (NestedValidationException $e) {
            $this->handleValidationException($e, $config, $messages);
        }

        return $this->setValue($config->getKey(), $input, $config->getGroup());
    }
1204542
public function addErrors(array $errors = [])
    {
        foreach ($errors as $attribute => $error) {
            if (is_array($error)) {
                foreach ($error as $e) {
                    $this->addError($attribute, $e);
                }
            } else {
                $this->addError($attribute, $error);
            }
        }
    }
221088
protected function storeErrors(NestedValidationException $e, Configuration $config, array $messages = [])
    {
        $errors = [
            $e->findMessages($this->getRulesNames($config->getValidationRules()))
        ];

        // If default messages are defined
        if (!empty($this->defaultMessages)) {
            $errors[] = $e->findMessages($this->defaultMessages);
        }

        // If global messages are defined
        if (!empty($messages)) {
            $errors[] = $e->findMessages($messages);
        }

        // If individual messages are defined
        if ($config->hasMessages()) {
            $errors[] = $e->findMessages($config->getMessages());
        }

        $this->setErrors($this->mergeMessages($errors), $config->getKey(), $config->getGroup());
    }
89662
protected function isParsedConfigValid(array $config)
    {
        $inConfig = count(array_intersect_key(array_flip($this->required), $config));

        return $inConfig === count($this->required);
    }
1151310
protected function configureDefaults(array $config)
    {
        $defaults = [
            'http_errors' => true,
            'decode_content' => true,
            'verify' => true,
        ];

        // TODO finish defaults config feature

        $this->configs = array_replace($defaults, $config);

        // TODO add cookies settings after session and cookies feature finished
    }
512790
public function setErrors($errors)
    {
        $this->errors = strtolower((string) $errors);

        $message = sprintf("Set errors flag to [%s].", $this->errors);
        $this->log($message, Project::MSG_DEBUG);
    }
486571
protected function listValidationErrors(array $errors, OutputInterface $output)
    {
        if (count($errors) === 1) {
            $this->stdErr->writeln('The following error was found:');
        } else {
            $this->stdErr->writeln(sprintf(
                'The following %d errors were found:',
                count($errors)
            ));
        }

        foreach ($errors as $key => $error) {
            if (is_string($key) && strlen($key)) {
                $output->writeln("$key: $error");
            } else {
                $output->writeln($error);
            }
        }
    }
608175
public function formfield_text($config = array())
    {
        $config = new AnConfig($config);

        $config->append(array(
            'class' => 'input-block-level',
            'maxlength' => 200,
            'name' => '',
            'id' => '',
            'label' => '',
            'placeholder' => '',
            'description' => '',
            'disabled' => false,
            'type' => 'text',
            'pattern' => '',
            'required' => true,
        ));

        return $this->_render('formfield_text', $config);
    }
997705
protected function writeErrorAndDie(array $errors)
    {
        $output = (new ConsoleOutput)->getErrorOutput();

        foreach ($errors as $error) {
            $output->writeln($error);
        }

        die(1);
    }
763892
public function init($config)
    {
        // init init error
        //default
        $this->config['per_page']       = 10;
        $this->config['item_to_show']   = 2;
        $this->config['skip_item']      = true;
        
        $this->config['first_tag_open'] = "<li>";
        $this->config['first_tag_close']= "</li>";
        
        $this->config['last_tag_open']  = "<li>";
        $this->config['last_tag_close'] = "</li>";
        
        $this->config['prev_tag_open']  = "<li>";
        $this->config['prev_tag_close'] = "</li>";
        $this->config['prev_tag_text']  = "Prev";
        
        $this->config['next_tag_open']  = "<li>";
        $this->config['next_tag_close'] = "</li>";
        $this->config['next_tag_text']  = "Next";
        
        $this->config['cur_tag_open']   = "<li class='active'>";
        $this->config['cur_tag_close']  = "</li>";

        $this->config['link_attribute'] = "class=''";
        $this->config['link_attribute_active'] = "class='active'";
        
        $this->config['num_tag_open']   = "<li>";
        $this->config['num_tag_close']  = "</li>";

        $this->config['skip_tag_open']  = "<li>";
        $this->config['skip_tag_close'] = "</li>";
        $this->config['skip_tag_text']  = "<a href='#'>....</a>";
        $this->config['start_page']     = 0;

        //merge options
        foreach ($config as $key => $value) {
            $this->config[$key]=$value;
        }
        if($this->config['item_to_show']<2)
            $this->config['item_to_show']=2;

        $this->total = intval($config['rows']);
        $this->per_page = intval($config['per_page']);
        $this->current_page = intval($config['current_page']) ;
        $this->base_url = urldecode($config['base_url']);
    }
1296045
protected function validateConfiguration($config)
    {
        $requiredFields = $this->getRequiredConfigurationFields();
        $missingFields = [];
        foreach ($requiredFields as $requiredField) {
            if (array_key_exists($requiredField, $config) === false) {
                $missingFields[] = $requiredField;
            }
        }
        if (count($missingFields) > 0) {
            throw new \RuntimeException('Some fields are not configured: ' . implode(', ', $missingFields));
        }
    }
957133
public function setup($config)
    {
        // create fixes, initialize fixesForLevel
        $fixes = $this->makeFixes();
        $this->makeFixesForLevel($fixes);

        // figure out which fixes to use
        $level = $config->get('HTML.TidyLevel');
        $fixes_lookup = $this->getFixesForLevel($level);

        // get custom fix declarations: these need namespace processing
        $add_fixes = $config->get('HTML.TidyAdd');
        $remove_fixes = $config->get('HTML.TidyRemove');

        foreach ($fixes as $name => $fix) {
            // needs to be refactored a little to implement globbing
            if (isset($remove_fixes[$name]) ||
                (!isset($add_fixes[$name]) && !isset($fixes_lookup[$name]))) {
                unset($fixes[$name]);
            }
        }

        // populate this module with necessary fixes
        $this->populate($fixes);
    }
703071
public function addError(...$args) {
        $args = func_get_args();
        if(func_num_args()>2){
            foreach ($args as $error) {
                array_push($this->errors, $error);
            }
        } else {
            if(func_get_args()==1) {
                $this->errors[] = $args[0];
            } else {
                $this->errors[$args[0]] = $args[1];
            }
        }
    }
447630
protected function maybeInvalidConfig(Config $config): ?Error
    {
        $groups = (array) $config->get('groups');

        return empty($groups)
            ? ResultFactory::makeError($this, ['***** Experimental *****', 'Groups is empty.'])
            : null;
    }