Format the table options for a create table statement.

@param array $options
@return string
518901
public function formatTableOptions(array $options) {
        $output = [];

        foreach ($this->formatAttributes($options) as $key => $value) {
            if ($this->hasClause($key)) {
                $option = sprintf($this->getClause($key), $value);

            } else {
                $option = $this->getKeyword($key);

                if ($value !== true) {
                    $option .= ' ' . $value;
                }
            }

            $output[] = $option;
        }

        return implode(' ', $output);
    }
1304193
public function table($content, $options = array())
    {
        if ('text' == $this->getType()) {
            return $content;
        }

        if (false === $options) {
            return $this->config('templates.tableend');
        }

        $tag = 'table';
        if (is_null($content)) {
            $tag = 'tablestart';
        }

        $templater = $this->templater();
        return $templater->format('table', [
        'attrs' => $templater->formatAttributes($this->_mergeAttributes($options, $this->config('attributes.table'))),
        'content' => $content
        ]);
    }
554106
private function getMergedOptions(array $options)
    {
        $options = array_merge(
            $this->getDefaultOptions(),
            $options
        );

        if (isset($options['formats'])) {
            $options['formats'] = self::mergeFormats($this->getDefaultFormats(), $options['formats']);
        } else {
            $options['formats'] = $this->getDefaultFormats();
        }

        if (is_null($options['line_ending'])) {
            $options['line_ending'] = $options['type'] === 'html' ? '<br/>' : "\n";
        }

        if (is_null($options['indentation'])) {
            $options['indentation'] = $options['type'] === 'html' ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '    ';
        }

        // `parts_newline` requires `clause_newline`
        $options['parts_newline'] &= $options['clause_newline'];

        return $options;
    }
810692
public function ls($options = '')
	{
		$rows =
		[
			["option","description","example"],
			["pre","Preformats the value column","pre"],
			["wide","Sets the width of the table to be 100%","wide"],
			["class","Sets the table class attribute","class:fancy"],
			["style","Sets the table style attribute","style:color:blue"]
		];

		$keys   = array_shift($rows);
		$opts   = array_map(function($values) use ($keys) {
			return array_combine($keys, $values);
		}, $rows);

		foreach ($opts as $index => $value)
		{
			$example = $opts[$index]['example'];
			$opts[$index]['example'] = implode(' ', array_map(function($value){ return "<code>$value</code>";}, explode('|', $example)));
		}

		$data   = \App::make(Translator::class)->get('validation');

		return view('sketchpad::help/helpers/list', compact('data', 'opts', 'options'));
	}
799578
public static function createFromOptions(array $options)
    {
        Validate::notNull($options['Name'], 'options[Name]');

        $accessPolicy = new self($options['Name']);
        $accessPolicy->fromArray($options);

        return $accessPolicy;
    }
388249
protected function buildOptionsList(array $options): string
	{
		$output = '';

		foreach($options as $key => $option)
		{
			$output .= ($key + 1) . ') ' . $option . PHP_EOL;
		}

		return $output . '> ';
	}
228105
protected function postOptions(array $options)
    {
        $this->model = $this->app->make(
            Arr::get($options, 'model', SettingModel::class)
        );
        $this->setConnection(Arr::get($options, 'connection', null));
        $this->setTable(Arr::get($options, 'table', 'settings'));
        $this->setKeyColumn(Arr::get($options, 'columns.key', 'key'));
        $this->setValueColumn(Arr::get($options, 'columns.value', 'value'));
    }
813075
static public function formatQueryOptions($options=null)
    {
        if (!isset($options)) {
            return [];
        }
        
        if (is_scalar($options)) {
            $options = ['where' => [$options]];
        } elseif (isset($options['where'])) {
            $options['where'] = (array) $options['where'];
        } else {
            $isWhere = true;
            foreach ($options as $k => $v) {
                if (is_numeric($k)) {
                    unset($options[$k]);
                    $options['where'][] = $v;
                } elseif (in_array($k, ['distinct', 'fields', 'from', 'table', 'order', 'pagesize', 'page', 'result_key'])) {
                    $isWhere = false;
                    break;
                }
            }
            if ($isWhere) {
                $options = ['where' => $options];
            } else {
                $options['where'] = [];
            }
        }
        
        return $options;
    }
280557
public function display(array $options = array())
    {
        if (empty($this->formatter)) {
            throw new FormatterNotSetException();
        }

        return $this->formatter->format($this, $options);
    }
953926
private function generateQueryOptions(array $options = [])
    {
        if (isset($options['query'])) {
            $result = $options['query'] + $this->getDefaultOptions();
        } else {
            $result['query'] = $options + $this->getDefaultOptions();
        }

        return $result;
    }
210440
public function createTable($table, $options)
    {
        $table = $this->buildRealTableName($table);
        $sql = $this->getSchema()->getCreateTableSql($table, $options);
        $ret = $this->query($sql);
        return $ret;
    }
590568
private function buildTableOptions(array $options)
    {
        if (isset($options['table_options'])) {
            return $options['table_options'];
        }

        $tableOptions = [];

        // Collate
        if (! isset($options['collate'])) {
            $options['collate'] = 'utf8_unicode_ci';
        }

        $tableOptions[] = sprintf('COLLATE %s', $options['collate']);

        // Engine
        if (! isset($options['engine'])) {
            $options['engine'] = 'InnoDB';
        }

        $tableOptions[] = sprintf('ENGINE = %s', $options['engine']);

        // Auto increment
        if (isset($options['auto_increment'])) {
            $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']);
        }

        // Comment
        if (isset($options['comment'])) {
            $comment = trim($options['comment'], " '");

            $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($comment));
        }

        // Row format
        if (isset($options['row_format'])) {
            $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']);
        }

        return implode(' ', $tableOptions);
    }
1068829
private function optionsTratament(array $options = array())
    {
        if (!isset($options['orientation']) or empty($options['orientation'])) {
            $options['orientation'] = 'LANDSCAPE';
        }
        if (!isset($options['size']) or empty($options['size'])) {
            $options['size'] = 'A4';
        }
        if (!isset($options['title']) or empty($options['title'])) {
            $options['title'] = 'Export Datagrid Cityware';
        }
        if (!isset($options['subtitle']) or empty($options['subtitle'])) {
            $options['subtitle'] = 'Export Datagrid Cityware';
        }
        if (!isset($options['footer']) or empty($options['footer'])) {
            $options['footer'] = 'Export Datagrid Cityware';
        }
        if (!isset($options['name']) or empty($options['name'])) {
            $options['name'] = date('Y_m_d_H_i_s');
        }
        if (!isset($options['noPagination']) or empty($options['noPagination'])) {
            $options['noPagination'] = 0;
        }

        $options['colors'] = array('title' => '#000000',
            'subtitle' => '#111111',
            'footer' => '#111111',
            'header' => '#AAAAAA',
            'row1' => '#EEEEEE',
            'row2' => '#FFFFFF',
            'sqlexp' => '#BBBBBB',
            'lines' => '#111111',
            'hrow' => '#E4E4F6',
            'text' => '#000000',
            'filters' => '#F9EDD2',
            'filtersBox' => '#DEDEDE');

        return $options;
    }
1060236
private function getFormat(array $options)
    {
        if (isset($options[self::PARAM_FORMAT])) {
            return $options[self::PARAM_FORMAT];
        } else {
            return $this->defaultFormat;
        }
    }
215216
protected function createForm($options = null)
    {
        $optionVars = array('askCheck', 'askOld', 'checkFields', 'forceRules', 'labelWidthFactor', 'reportRules');
        foreach ($optionVars as $name) {
            if ($this->$name !== null) {
                $options[$name] = $this->$name;
            }
        }
        $options['useTableLayout'] = false; // Layout set by this snippet

        return $this->user->getChangePasswordForm($options);
    }
982861
public function createRowset(array $options = array())
    {
        $identifier = $this->getIdentifier()->toArray();
        $identifier['path'] = array('database', 'rowset');

        //Force the table
        $options['table'] = $this;

        //Set the identity column if not set already
        if (!isset($options['identity_column'])) {
            $options['identity_column'] = $this->mapColumns($this->getIdentityColumn(), true);
        }

        return $this->getObject($identifier, $options);
    }
989033
private function create($options = [])
	{
		$this->before_create();

		$statement = 'INSERT INTO ' . static::$table_name . ' (';

		if (isset($options['include_primary_key'])) {
			$statement .= implode(', ', $this->_keys(false, true)) . ') VALUES (';
			$values = $this->_values(false);
		} else {
			$statement .= implode(', ', $this->_keys(true, true)) . ') VALUES (';
			$values = $this->_values();
		}

		$value_set = [];

		foreach ($values as $value) {
			$value_set[] = '?';
		}

		$statement .= implode(', ', $value_set) . ')';

		$result = $this->db->query($statement, $values, 'last_id');

		/* NOTE: PDO's lastInsertId does not work with PostgreSQL unless we supply
		 *       the sequence name. This is a hack to circumvent this.
		 *
		 *       Also: it would be nice to handle this in the DB wrapper, but
		 *       unfortunately we don't have any information about the query or table
		 *       there, so the hack has to stay here for now.
		 */
		if ('pgsql' === $this->db->type()) {
			$result = $this->db->lastInsertId(static::$table_name . '_id_seq');
		}

		$this->stored = true;
		$this->updated = false;
		$this->id = $result;

		$this->after_create();

		return true;
	}