Generate api elements.

@param array                                         $config
@param \Symfony\Component\Console\Helper\ProgressBar $bar
494105
public function generateAPI($config, $bar)
    {
        if ($config['options-api'] || $config['options-apiOnly']) {
            $this->crudGenerator->createApi($config);
        }
        $bar->advance();
    }
982815
private function applyConfig(array $config): void
    {
        // override
        if ($this->config != null) {
            $config = Config::merge($config, $this->config->getData());
        }
        $this->config = new Config($config);

        // set/reset logger options
        $loggerOptions = $this->config->get('logger');
        if ($loggerOptions != null) {
            isset($loggerOptions['level']) && $this->logger->setLevel($loggerOptions['level']);
            isset($loggerOptions['directory']) && $this->logger->setDirectory($loggerOptions['directory']);
        }
    }
682940
protected function renderBar($percent, $label = '', $options = [])
    {
        $defaultOptions = [
            'role' => 'progressbar',
            'aria-valuenow' => $percent,
            'aria-valuemin' => 0,
            'aria-valuemax' => 100,
            'style' => "width:{$percent}%",
        ];
        $options = array_merge($defaultOptions, $options);
        Html::addCssClass($options, ['widget' => 'progress-bar']);

        $out = Html::beginTag('div', $options);
        $out .= $label;
        $out .= Html::tag('span', \Yii::t('yii', '{percent}% Complete', ['percent' => $percent]), [
            'class' => 'sr-only'
        ]);
        $out .= Html::endTag('div');

        return $out;
    }
958536
public function renderDragger( $config = [] ) {

		$draggerView = CodeGenUtil::isAbsolutePath( $this->draggerView, true ) ? $this->draggerView : "$this->template/$this->draggerView";

		return $this->render( $draggerView, [ 'widget' => $this ] );
	}
558601
public static function progressBar($width = 0, $htmlOptions = array())
    {
        self::addCssClass('progress', $htmlOptions);
        $color = TbArray::popValue('color', $htmlOptions);
        if (!empty($color)) {
            self::addCssClass('progress-' . $color, $htmlOptions);
        }
        if (TbArray::popValue('striped', $htmlOptions, false)) {
            self::addCssClass('progress-striped', $htmlOptions);
        }
        if (TbArray::popValue('animated', $htmlOptions, false)) {
            self::addCssClass('active', $htmlOptions);
        }
        $barOptions = TbArray::popValue('barOptions', $htmlOptions, array());
        $content = TbArray::popValue('content', $htmlOptions);
        if (!empty($content)) {
            $barOptions['content'] = $content;
        }
        $content = self::bar($width, $barOptions);
        return self::tag('div', $htmlOptions, $content);
    }
454274
protected function renderBar($percent, $label = '', $options = [])
    {
        $options = array_merge($options, [
            'role' => 'progressbar',
            'aria-valuenow' => $percent,
            'aria-valuemin' => 0,
            'aria-valuemax' => 100
        ]);
        Html::addCssClass($options, ['widget' => 'progress-bar']);
        Html::addCssStyle($options, ['width' => $this->app->formatter->asPercent($percent / 100)], true);

        return Html::tag('div', $label, $options);
    }
676500
private function startProgressBars(BufferedOutputInterface $output)
    {
        // Start and display the progress bars.
        foreach ($this->processes as $processInfo) {
            $processInfo['progressBar']->start();
            $output->write("\n");

            // Set the current index. For simplicity we overwrite the value each time.
            $this->currentIndex = $processInfo['index'];
        }
    }
633617
protected function applyRules(array $config) : void
    {
        $this->stdout("Init rules: " . count($config) . "\n", Console::FG_YELLOW);
        foreach ($config as $item) {
            if ($rule = $this->applyRule($item)) {
                $this->stdout("\t- success: " . $rule->name . "\n", Console::FG_GREEN);
            } else {
                $this->stdout("\t- error config rule: " . Json::encode($item) . "\n", Console::FG_RED);
            }
        }
    }
1010632
public function load(array $config, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $this->configureStorage($config, $container);
        $this->configureMetadataDriver($config, $container);
        $this->configureEntityManager($config, $container);
    }
232151
public function command($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'command' => NULL
        ));

        $translator = $this->getObject('translator');
        $command    = $config->command;

        if ($command->allowed === false)
        {
            $command->attribs->title = $translator->translate('You are not allowed to perform this action');
            $command->attribs->class->append(array('k-is-disabled', 'k-is-unauthorized'));
        }

         //Add a toolbar class	
        $command->attribs->class->append(array('toolbar'));

        //Create the href
        $command->attribs->append(array('href' => '#'));
        if(!empty($command->href)) {
            $command->attribs['href'] = $this->getTemplate()->route($command->href);
        }

        //Create the id
        $command->attribs->id = 'toolbar-'.$command->id;

        $command->attribs->class->append(array('k-button', 'k-button--default', 'k-button-'.$command->id));

        if ($command->id === 'new' || $command->id === 'apply') {
            $command->attribs->class->append(array('k-button--success'));
        }

        $attribs = clone $command->attribs;
        $attribs->class = implode(" ", KObjectConfig::unbox($attribs->class));

        $html = '<a '.$this->buildAttributes($attribs).'>';

        $html .= '<span class="'.$command->icon.'" aria-hidden="true"></span> ';
        $html .= '<span class="k-button__text">';
        $html .= $translator->translate($command->label);
        $html .= '</span>';
        $html .= '</a>';

        return $html;
    }
498941
public function progress_bar(array $items) {
        foreach ($items as &$item) {
            $text = $item['text'];
            unset($item['text']);
            if (array_key_exists('link', $item)) {
                $link = $item['link'];
                unset($item['link']);
                $item = html_writer::link($link, $text, $item);
            } else {
                $item = html_writer::tag('span', $text, $item);
            }
        }
        return html_writer::tag('div', join(get_separator(), $items), array('class' => 'backup_progress clearfix'));
    }
1032380
protected function processConfig(array $config)
    {
        // set defaults as an array if not provided
        if (!isset($config['defaults'])) {
            $config['defaults'] = [];
        }
        
        // Use the passed in command factory or a custom factory if provided
        $this->commandFactory = isset($config['command_factory'])
            ? $config['command_factory']
            : self::defaultCommandFactory($this->description);

        // Add event listeners based on the configuration option
        $emitter = $this->getEmitter();

        if (!isset($config['validate']) ||
            $config['validate'] === true
        ) {
            $emitter->attach(new ValidateInput($this->description));
        }

        $this->serializer = isset($config['serializer'])
            ? $config['serializer']
            : new Serializer($this->description);

        if (!isset($config['process']) ||
            $config['process'] === true
        ) {
            $emitter->attach(
                new ProcessResponse(
                    $this->description,
                    isset($config['response_locations'])
                        ? $config['response_locations']
                        : []
                )
            );
        }
    }
175079
protected function createJsonResponse(array $data, array $config)
    {
        if (! \is_null($uses = $config['uses'] ?? null)) {
            $data = $data[$uses] ?? [];
        }

        if ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        $data = \array_map([$this, 'transformToArray'], $data);

        return function () use ($data, $config) {
            return \json_encode($data, $config['encoding'] ?? 0);
        };
    }
406330
public function settings(Array $config = []) : Paginator
    {
        foreach( $config as $key => $value )
        {
            $this->$key = $value;
        }        

        $this->class = array_merge($this->config['class'], $this->class ?? []);
        $this->style = array_merge($this->config['style'], $this->style ?? []);

        if( isset($config['url']) && $this->type !== 'ajax' )
        {
            $this->url = Base::suffix(URL::site($config['url']));
        }
        elseif( $this->type === 'ajax' )
        {
            $this->url = 'javascript:;';
        }
        else
        {
            $this->url = CURRENT_CFURL;
        }

        return $this;
    }
996978
public function getToolbar($toolbar, $config = array())
    {
        if (is_string($toolbar)) {
            if (strpos($toolbar, '.') === false) {
                $identifier = clone $this->getIdentifier();
                $identifier->path = array('controller', 'toolbar');
                $identifier->name = $toolbar;
                register_default(array(
                    'identifier' => $identifier, 
                    'prefix' => $this
                ));
                $toolbar = $identifier;
            }
        }

        return parent::getToolbar($toolbar, $config);
    }
1189755
public function render(array $config = [])
    {
        $settings = AdminBar::$plugin->getSettings();
        $config['editEmbedded'] = $this->_editEmbedded;
        $entry = ($config['entry'] = $config['entry'] ?? null);
        $config['url'] = $config['url'] ?? '#';
        $config['id'] = $this->_editId;
        $config['enabled'] = AdminBar::$plugin->bar->canEmbed() ? true : false;

        // add config file settings to config
        $config['displayEditDate'] = $settings->displayEditDate;
        $config['displayEditAuthor'] = $settings->displayEditAuthor;
        $config['displayRevisionNote'] = $settings->displayRevisionNote;

        // figure out if $entry is a custom URL string, otherwise assume it's an Entry
        $config['type'] = $config['entry'] ? 'entry' : 'string';

        // get recent revision information
        $revision = $config['type'] == 'entry' ? Craft::$app->entryRevisions->getVersionsByEntryId($entry->id, $entry->siteId, 1, true) : null;
        if ($revision ?? false) {
            $revisionAuthor = Craft::$app->users->getUserById($revision[0]->creatorId);
            $config['revisionAuthor'] = $revisionAuthor;
            $config['revisionNote'] = $revision[0]->revisionNotes;
        } else {
            $config['revisionAuthor'] = null;
            $config['revisionNote'] = null;
        }

        // set title based on override, entry, or url provided
        if (!isset($config['title'])) {
            if ($config['type'] == 'entry') {
                $config['title'] = $config['entry']->title;
            } else {
                $config['title'] = $config['url'];
            }
        }

        $oldMode = Craft::$app->view->getTemplateMode();
        Craft::$app->view->setTemplateMode(View::TEMPLATE_MODE_CP);
        $html = Craft::$app->view->renderTemplate('admin-bar/editLinks', $config);
        Craft::$app->view->setTemplateMode($oldMode);

        print($html);

        $this->_editId += 1;
        $this->_editEmbedded = true;

        return '';
    }
1261602
public function progressBar($useProgressBar = true)
    {
        if ($useProgressBar) {
            $this->progressbar = true;
        } else {
            $this->progressbar = false;
        }

        // If they set this true after saying they want tiny, they actually want small.
        if ($useProgressBar && $this->getSize() == static::SIZE_TINY) {
            $this->size(static::SIZE_SMALL);
        }
        // If they set this true after saying they want invisible, they're being silly and I refuse to handle it.

        return $this;
    }