kahlan\cli\Kahlan::_console PHP Метод

_console() защищенный Метод

The default 'console' filter.
protected _console ( )
    protected function _console()
    {
        return Filter::on($this, 'console', [], function ($chain) {
            $collection = $this->reporters();
            $reporters = $this->commandLine()->get('reporter');
            if (!$reporters) {
                return;
            }
            foreach ($reporters as $reporter) {
                $parts = explode(":", $reporter);
                $name = $parts[0];
                $output = isset($parts[1]) ? $parts[1] : null;
                $args = $this->commandLine()->get('dot');
                $args = $args ?: [];
                if (!$name === null || $name === 'none') {
                    continue;
                }
                $params = $args + ['start' => $this->_start, 'colors' => !$this->commandLine()->get('no-colors'), 'header' => !$this->commandLine()->get('no-header')];
                if (isset($output) && strlen($output) > 0) {
                    if (file_exists($output) && !is_writable($output)) {
                        fwrite(STDERR, "Error: please check that file '{$output}' is writable\n");
                    } else {
                        $file = @fopen($output, 'w');
                        if (!$file) {
                            fwrite(STDERR, "Error: can't create file '{$output}' for write\n");
                        } else {
                            $params['output'] = $file;
                        }
                    }
                }
                $class = 'Kahlan\\Reporter\\' . str_replace(' ', '', ucwords(str_replace(['_', '-'], ' ', trim($name))));
                if (!class_exists($class)) {
                    fwrite(STDERR, "Error: unexisting reporter `'{$name}'` can't find class `{$class}`.\n");
                    exit(-1);
                }
                $collection->add($name, new $class($params));
            }
        });
    }