Generates a table cell

@param array $aElements
@param array $features
@return string
770063
private function setTableCell($aElements, $features = null)
    {
        $sReturn = null;
        foreach ($aElements as $key => $value) {
            $value = str_replace(['& ', '\"', "\'"], ['&amp; ', '"', "'"], $value);
            if ((isset($features['grouping_cell'])) && ($features['grouping_cell'] == $key)) {
                // just skip
            } else {
                $sReturn .= '<td ';
                if (isset($features['column_formatting'][$key])) {
                    switch ($features['column_formatting'][$key]) {
                        case '@':
                            $sReturn .= 'style="text-align:left;">' . $value;
                            break;
                        case 'right':
                            $sReturn .= 'style="text-align:right;">' . $value;
                            break;
                        default:
                            $sReturn .= '???';
                            break;
                    }
                } else {
                    if (is_numeric($value)) {
                        $sReturn .= $this->setTableCellNumeric($key, $value, $features);
                    } else {
                        $outputet = false;
                        if ((strpos($value, '-') !== false) && (strlen($value) == 10)) {
                            if (preg_match("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $value, $regs)) {
                                $outputet = true;
                                $sReturn  .= 'style="text-align:right;width: 10px;">'
                                    . $regs[3] . '.' . $regs[2] . '.' . $regs[1];
                            }
                        }
                        if (!$outputet) {
                            $sReturn .= 'style="text-align:left;">' . $value;
                        }
                    }
                }
                $sReturn .= '</td>';
            }
        }
        return $sReturn;
    }
623095
public function getHtmlTable(array $rows): string
  {
    $this->prepare();

    $ret = $this->getHtmlPrefix();

    $ret .= Html::generateTag('table', $this->attributes);

    // Generate HTML code for the column classes.
    $ret .= '<colgroup>';
    foreach ($this->columns as $column)
    {
      // If required disable sorting of this column.
      if (!$this->sortable) $column->notSortable();

      // Generate column element.
      $ret .= $column->getHtmlCol();
    }
    $ret .= '</colgroup>';

    // Generate HTML code for the table header.
    $ret .= Html::generateTag('thead', ['class' => static::$class]);
    $ret .= $this->getHtmlHeader();
    $ret .= '</thead>';

    // Generate HTML code for the table body.
    $ret .= Html::generateTag('tbody', ['class' => static::$class]);
    $ret .= $this->getHtmlBody($rows);
    $ret .= '</tbody>';

    $ret .= '</table>';

    $ret .= $this->getHtmlPostfix();

    $this->generateResponsiveCss();

    return $ret;
  }
127539
private function findRowsWithFields(NodeElement $table, array $fields)
    {
        $rows = $table->findAll('css', 'tr');
        Assert::notEmpty($rows, 'There are no rows!');

        $fields = $this->replaceColumnNamesWithColumnIndexes($table, $fields);

        $matchedRows = [];
        /** @var NodeElement[] $rows */
        $rows = $table->findAll('css', 'tr');
        foreach ($rows as $row) {
            /** @var NodeElement[] $columns */
            $columns = $row->findAll('css', 'td, th');
            if ($this->hasRowFields($columns, $fields)) {
                $matchedRows[] = $row;
            }
        }

        return $matchedRows;
    }
1314615
public function render(TableStructure $table, int $indent = 8): string
    {
        return str_repeat(' ', $indent)
            . '$this->addForeignKey(\''
            . $this->renderName($table)
            . "', '"
            . $table->renderName()
            . "', "
            . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']")
            . ", '"
            . $this->renderRefTableName($table)
            . "', "
            . (count($this->refColumns) === 1 ? "'{$this->refColumns[0]}'" : "['" . implode("', '", $this->refColumns) . "']")
            . ($this->onDelete ? ", '{$this->onDelete}'" : '')
            . ($this->onUpdate ? ($this->onDelete === null ? ', null' : '') . ", '{$this->onUpdate}'" : '')
            . ');';
    }
387277
public function mergeFeatures(array $features)
    {
        /** @var FeatureInterface $feature */
        foreach ($features as $feature) {
            $this->storeToAll($feature);
            $this->storeToCanonical($feature);
        }
    }
376492
protected static function generatePalette($table, array $paletteFields = array(), array $standardFields = array())
	{
		$palette = '';

		if ($table === 'tl_module') {
			$palette .= '{title_legend},name';
			if (in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			$palette .= ',type';
		}
		else {
			$palette .= '{type_legend},type';
			if ($table === 'tl_content' && in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			if (in_array('columns', $standardFields)) {
				$palette .= ';{rs_columns_legend},rs_columns_large,rs_columns_medium,rs_columns_small';
			}
			if (in_array('text', $standardFields)) {
				$palette .= ';{text_legend},text';
			}
		}

		if (
			isset($paletteFields[0])
			&& $paletteFields[0] !== 'rsce_data'
			&& isset($GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'])
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_group_start'
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_list_start'
		) {
			$palette .= ';{rsce_legend}';
		}

		$palette .= ',' . implode(',', $paletteFields);

		if ($table === 'tl_content' && in_array('image', $standardFields)) {
			$palette .= ';{image_legend},addImage';
		}

		if ($table === 'tl_form_field') {
			$palette .= ';{expert_legend:hide},class';
		}

		$palette .= ';{template_legend:hide},customTpl';

		if ($table !== 'tl_form_field') {

			$palette .= ';{protected_legend:hide},protected;{expert_legend:hide},guests';

			if (in_array('cssID', $standardFields)) {
				$palette .= ',cssID';
			}

		}

		if ($table === 'tl_content') {
			$palette .= ';{invisible_legend:hide},invisible,start,stop';
		}

		return $palette;
	}
217071
public function cell($vars = '', $content = '')
    {
        $html = $this->wrapUp('cell');
        $tag = ($this->head) ? 'th' : 'td';
        $this->cell = '</'.$tag.'>';
        $vars = $this->values($vars);
        if (!empty($this->vars)) {
            $vars = array_merge($this->vars, $vars);
        }

        return $html.$this->page->tag($tag, $vars).$content;
    }
282177
public static function toJson($features)
	{
		if (is_null($features) || count($features) == 0) {
			return null;
		}

		return Collection::make($features)->filter(function ($item) {
			return trim($item) != '';
		})->toJson();
	}
1050652
public function renderSitemap(array $entries)
    {
        $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
        $data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
        foreach ($entries as $entry) {
            $data .= '    <url>' . PHP_EOL;
            $data .= '        <loc>' . $entry->getLoc() . '</loc>' . PHP_EOL;
            if (null !== $entry->getLastMod()) {
                $data .= '        <lastmod>' . $entry->getLastMod() . '</lastmod>' . PHP_EOL;
            }
            if (null !== $entry->getChangeFreq()) {
                $data .= '        <changefreq>' . $entry->getChangeFreq() . '</changefreq>' . PHP_EOL;
            }
            if (null !== $entry->getPriority()) {
                $data .= '        <priority>' . $entry->getPriority() . '</priority>' . PHP_EOL;
            }
            $data .= '    </url>' . PHP_EOL;
        }

        $data .= '</urlset>' . PHP_EOL;

        return $data;
    }
715712
public function renderTable(Table $table)
	{
		//Generate each row
		$rows = $this->buildRows($table);

		$headerRows = $this->buildHeaders($table);

		$footerRows = $this->buildFooters($table);

		return $this->container($table, $rows, $headerRows, $footerRows);
	}
830882
public function withIndexes(array $indexes) : Table
    {
        return new self($this->name, $this->columns, $indexes, $this->foreignKeys);
    }
666959
protected function buildFooters(Table $table)
	{
		//Generate each row
		$rows = array();

		foreach ( $table->getFooterRows() as $row )
		{
			//Build the cells for each row
			$cells = array();

			foreach ( $row as $cell )
			{
				$cells[] = $this->footerCell($cell);
			}

			$rows[] = $this->footerRow($row, $cells);
		}

		return $rows;
	}
126121
protected function buildRows(Table $table)
	{
		//Generate each row
		$rows = array();

		foreach ( $table->getRows() as $row )
		{
			//Build the cells for each row
			$cells = array();

			foreach ( $row as $cell )
			{
				$cells[] = $this->cell($cell);
			}

			$rows[] = $this->row($row, $cells);
		}

		return $rows;
	}
931877
public function generate(): string
    {
        foreach ($this->trArray as $tr) {
            $this->tableArray[] = $tr;
        }
        $table = Tags::table($this->tableArray, $this->tableAttributes);

        $this->tableAattributes = [];
        $this->tableArray = [];
        $this->trArray = [];

        return $table;
    }
1233653
protected function generateDocBlock(array $columns): void
  {
    $this->codeStore->append('/**');
    $this->codeStore->append(' * @todo describe routine', false);
    $this->codeStore->append(' * ', false);

    $padding = $this->getMaxColumnLength($columns);
    $format  = sprintf(' * @param p_%%-%ds @todo describe parameter', $padding);
    foreach ($columns as $column)
    {
      $this->codeStore->append(sprintf($format, $column['column_name']), false);
    }

    $this->codeStore->append(' */', false);
  }
394276
public function inlineCssOnElement(\DOMElement $element, array $properties)
    {
        if (empty($properties)) {
            return $element;
        }

        $cssProperties = array();
        $inlineProperties = array();

        foreach ($this->getInlineStyles($element) as $property) {
            $inlineProperties[$property->getName()] = $property;
        }

        foreach ($properties as $property) {
            if (!isset($inlineProperties[$property->getName()])) {
                $cssProperties[$property->getName()] = $property;
            }
        }

        $rules = array();
        foreach (array_merge($cssProperties, $inlineProperties) as $property) {
            $rules[] = $property->toString();
        }
        $element->setAttribute('style', implode(' ', $rules));

        return $element;
    }
274264
protected function indentArray(array $elements) {
		return self::INDENTATION . \str_replace(PHP_EOL, PHP_EOL . self::INDENTATION, \implode(PHP_EOL, $elements));
	}