Render for column layout.

@param string[] $propertyNames The properties.
@param string[] $args          The rendered arguments.
@param string   $firstSorting  The sorting column.

@return array
342534
private function renderWithColumns($propertyNames, $args, $firstSorting)
    {
        $label = [];
        if (!\is_array($args)) {
            // @codingStandardsIgnoreStart
            @\trigger_error('Warning, column layout without arguments will not be supported.', E_USER_DEPRECATED);
            // @codingStandardsIgnoreEnd
            $label[] = [
                'colspan' => \count($propertyNames),
                'class'   => 'tl_file_list col_all',
                'content' => $args
            ];
        } else {
            foreach ($propertyNames as $propertyName) {
                $class = 'tl_file_list col_' . $propertyName;
                if ($firstSorting === $propertyName) {
                    $class .= ' ordered_by';
                }

                $label[] = [
                    'colspan' => 1,
                    'class'   => $class,
                    'content' => $args[$propertyName] ?: '-'
                ];
            }
        }

        return $label;
    }
697178
public function sort($data, $args)
    {
        $field = $this->translateColumnId($args['order']['0']['column']);
        $data->order($field->name, $args['order']['0']['dir'] !== 'asc');
    }
1174366
public function getFirstChild($sortColumn = 'cDisplayOrder asc', $excludeSystemPages = false)
    {
        if ($excludeSystemPages) {
            $systemPages = ' and cIsSystemPage = 0';
        } else {
            $systemPages = '';
        }

        $db = Database::connection();
        $cID = $db->fetchColumn('select Pages.cID from Pages inner join CollectionVersions on Pages.cID = CollectionVersions.cID where cvIsApproved = 1 and cParentID = ? '.$systemPages." order by {$sortColumn}", array($this->cID));
        if ($cID > 1) {
            return static::getByID($cID, 'ACTIVE');
        }

        return false;
    }
139794
private function sortProperties(array $properties, $order)
    {
        if (is_string($order)) {
            if ($order === 'ASC') {
                ksort($properties);
            } else {
                krsort($properties);
            }
        } elseif (is_array($order)) {
            $properties = array_merge(array_flip($order), $properties);
        }

        return $properties;
    }
1020265
public function get($propertyName, $funcName, array $arguments = [], array &$errorValues = [], array &$errors)
    {
        if (false === \array_key_exists($funcName, $this->functionMap)) {
            throw new \InvalidArgumentException(
                \sprintf('Validator key \'%s\' not found', $funcName)
            );
        }

        $function = $this->functionMap[$funcName];
        $class    = \explode("::", $function);

        try {
            $result = \call_user_func_array([$class[0], $class[1]], $arguments);

            if (false === $result) {
                $funcName = $this->funcNameToUnderscore($funcName);
                if (false === \array_key_exists($funcName, $errors)) {
                    throw new \InvalidArgumentException(
                        \sprintf('Validator key \'%s\' not found in error file', $funcName)
                    );
                }

                if (\strlen($errors[$funcName]) > 0) {
                    $this->validator->setError(
                        $this->buildErrorMessage($errorValues, $errors, $funcName, $propertyName),
                        $funcName
                    );
                }
            }
        } catch (FileUploadException $e) {
            $lowerCaseFuncName = $this->funcNameToUnderscore($e->getMessage());
            $this->validator->setError(
                $this->buildErrorMessage($errorValues, $errors, $e->getMessage(), $propertyName),
                $lowerCaseFuncName
            );

            $result = false;
        }

        return $result;
    }
741519
protected function _first($columns = '*')
    {
        $data = $this->db->get($this->table, $columns, $this->where);

        if (empty($data)) {
            return false;
        }

        return $this->setProperties($data);
    }
1118983
private static Sort getSort(String... columnNames) {
        Sort key = null;
        for (String s : columnNames) {
            if (key == null) {
                key = first(s, Sort.Order.DESCEND);
            } else {
                key.next(s, Sort.Order.DESCEND);
            }
        }
        return key;
    }
703976
@SuppressWarnings("unchecked")
    public List<E> list(final int first, final int max, final String sortProperty, final boolean ascending)
    {
        final String jpaql = "select x from " + entityClass.getName() + " x order by x." + sortProperty +
                (ascending ? " asc" : " desc");
        final Query query = getEntityManager().createQuery(jpaql);
        query.setFirstResult(first).setMaxResults(max);
        return query.getResultList();
    }
38892
public function renderChildrenIntoParentColumns($typoScriptSetup = [], $sortColumns = [])
    {

        // first we have to make a backup copy of the original data array
        // and we have to modify the depth counter to avoid stopping too early

        $currentParentGrid = $this->copyCurrentParentGrid();
        $columns = $this->getUsedColumns($sortColumns);
        $parentGridData = $this->getParentGridData($currentParentGrid['data']);
        $parentGridData['tx_gridelements_view_columns'] = $columns;

        $counter = !empty($this->cObj->data['tx_gridelements_view_children']);
        $parentRecordNumbers = [];
        $this->getTSFE()->cObjectDepthCounter += $counter;

        // each of the children will now be rendered separately and the output will be added to it's particular column
        $rawColumns = [];
        if (!empty($this->cObj->data['tx_gridelements_view_children'])) {
            foreach ($this->cObj->data['tx_gridelements_view_children'] as $child) {
                $rawColumns[$child['tx_gridelements_columns']][] = $child;
                $renderedChild = $child;
                $this->renderChildIntoParentColumn(
                    $columns,
                    $renderedChild,
                    $parentGridData,
                    $parentRecordNumbers,
                    $typoScriptSetup
                );
                $currentParentGrid['data']['tx_gridelements_view_child_' . $child['uid']] = $renderedChild;
                unset($renderedChild);
            }
            $currentParentGrid['data']['tx_gridelements_view_raw_columns'] = $rawColumns;
        }

        // now we can reset the depth counter and the data array so that the element will behave just as usual
        // it will just contain the additional tx_gridelements_view section with the prerendered elements
        // it is important to do this before any stdWrap functions are applied to the grid container
        // since they will depend on the original data
        $this->getTSFE()->cObjectDepthCounter -= $counter;

        $this->cObj->currentRecord = $currentParentGrid['record'];
        $this->cObj->data = $currentParentGrid['data'];
        $this->cObj->parentRecordNumber = $currentParentGrid['parentRecordNumber'];

        if (!empty($sortColumns)) {
            $this->cObj->data['tx_gridelements_view_columns'] = [];
            foreach ($sortColumns as $sortKey) {
                $sortKey = trim($sortKey);
                if (isset($parentGridData['tx_gridelements_view_columns'][$sortKey])) {
                    $this->cObj->data['tx_gridelements_view_columns'][$sortKey] = $parentGridData['tx_gridelements_view_columns'][$sortKey];
                }
            }
        }
        unset($parentGridData);
        unset($currentParentGrid);
    }
774315
public function render($componentName, $propsString, $uuid, $registeredStores = array(), $trace)
    {
        if (strpos($this->serverSocketPath, '://') === false) {
            $this->serverSocketPath = 'unix://'.$this->serverSocketPath;
        }

        if (!$sock = stream_socket_client($this->serverSocketPath, $errno, $errstr)) {
            throw new \RuntimeException($errstr);
        }
        stream_socket_sendto($sock, $this->wrap($componentName, $propsString, $uuid, $registeredStores, $trace)."\0");

        $contents = '';

        while (!feof($sock)) {
            $contents .= fread($sock, 8192);
        }
        fclose($sock);

        $result = json_decode($contents, true);
        if ($result['hasErrors']) {
            $this->logErrors($result['consoleReplayScript']);
            if ($this->failLoud) {
                $this->throwError($result['consoleReplayScript'], $componentName);
            }
        }

        return [
            'evaluated' => $result['html'],
            'consoleReplay' => $result['consoleReplayScript'],
            'hasErrors' => $result['hasErrors']
        ];
    }
527876
function renderCropMarksField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderCheckbox(
			[
				'id' => 'pdf_crop_marks',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'pdf_crop_marks',
				'value' => getset( $this->options, 'pdf_crop_marks' ),
				'label' => $args[0],
			]
		);
	}
1320113
public function processColumnListing($results)
    {
        return array_values(array_map(function ($result)
        {
            $result = (object) $result;

            return $result->column_name;

        }, $results));
    }
173295
public function renderStylesheets(\Twig_Environment $env, $args = array()) {
        $frontendFramework = $this->fetchAutoTablesGlobalConfiguration()->getFrontendFramework();
        return $this->render($env, 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTableStylesheets.html.twig',
            array(
                'includeJqueryUi' => $this->getParameter($args, 'includeJqueryUi', $frontendFramework == FrontendFramework::JQUERY_UI),
                'includeBootstrap3' => $this->getParameter($args, 'includeBootstrap3', false)
            )
        );
    }
903316
protected function sortArgs($prototype, $args)
    {
        $keyArgs = [];
        $posArgs = [];

        // separate positional and keyword arguments
        foreach ($args as $arg) {
            list($key, $value) = $arg;

            $key = $key[1];

            if (empty($key)) {
                $posArgs[] = empty($arg[2]) ? $value : $arg;
            } else {
                $keyArgs[$key] = $value;
            }
        }

        if (! isset($prototype)) {
            return [$posArgs, $keyArgs];
        }

        // copy positional args
        $finalArgs = array_pad($posArgs, count($prototype), null);

        // overwrite positional args with keyword args
        foreach ($prototype as $i => $names) {
            foreach ((array) $names as $name) {
                if (isset($keyArgs[$name])) {
                    $finalArgs[$i] = $keyArgs[$name];
                }
            }
        }

        return [$finalArgs, $keyArgs];
    }
149686
function renderParagraphSeparationField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderRadioButtons(
			[
				'id' => 'pdf_paragraph_separation',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'pdf_paragraph_separation',
				'value' => getset( $this->options, 'pdf_paragraph_separation' ),
				'choices' => $args,
			]
		);
	}
1084749
public function render(array $columnNames, array $rows): string
	{
		if(!$this->isValidInput($columnNames, $rows))
		{
			throw new RuntimeException('The number of cells in each row must match the number of columns.');
		}

		$columnWidths = $this->getColumnWidths($columnNames, $rows);

		// Build table header

		$table = $this->buildRowSeparator($columnWidths);

		$table .= $this->buildTableRow($columnNames, $columnWidths);

		$table .= $this->buildRowSeparator($columnWidths);

		// Add table rows

		foreach($rows as $row)
		{
			$table .= $this->buildTableRow($row, $columnWidths);
		}

		// Add bottom border

		$table .= $this->buildRowSeparator($columnWidths);

		// Return table

		return $table;
	}
1033460
public static String orderBy(OrderByArg... args) {
		if (EmptyUtil.isEmpty(args) == true) {
			return "";
		}
		StringBuilder sql = new StringBuilder();
		Arrays.asList(args).forEach(arg -> {
			sql.append(arg.getColumnName());
			SortType sortType = arg.getSortType();
			if (sortType != null) {
				sql.append(" ");
				sql.append(sortType.toString());
			}
			sql.append(", ");
		});
		sql.setLength(sql.length() - ", ".length());
		return sql.toString();
	}