Generate groups for table grouping

@param array $meta The meta data of table

@return array List of results
198454
protected function generateGroups($meta)
    {
        if ($this->group) {
            $result = array();
            $sorts = array();
            foreach ($this->group as $by => $settings) {
                $sorts[$by] = Utility::get($settings, "sort", "asc");
            }
            $sorts = array_merge($sorts, $this->sorting);
            $this->dataStore->sort($sorts);
            Table::groupLevel($meta, $this->group, $this->dataStore, $result);
            return $result;
        }
        return false;
    }
134192
private function generateMeta(bbMetaData $meta)
    {
        if (0 === $meta->count() || 'title' === $meta->getName()) {
            return '';
        }

        $result = '<meta ';
        foreach ($meta as $attribute => $value) {
            if (false !== strpos($meta->getName(), 'keyword') && 'content' === $attribute) {
                $keywords = explode(',', $value);
                foreach ($this->getKeywordObjects($keywords) as $object) {
                    $value = trim(str_replace($object->getUid(), $object->getKeyWord(), $value), ',');
                }
            }

            if ('content' === $attribute && empty($value)) {
                $result = '';
                break;
            }

            $result .= $attribute . '="' . html_entity_decode($value, ENT_COMPAT, 'UTF-8') . '" ';
        }

        return empty($result) ? $result : $result.'/>'.PHP_EOL;
    }
1256852
protected function castPropertiesMeta(array $meta): array
    {
        $properties = [];
        foreach ($meta['@properties'] ?? [] as $name => $data) {
            $properties[$name] = new MetaProperty($data);
        }

        return $properties;
    }
952432
public function addMeta($meta = array())
	{
		foreach ($meta as $type => $value)
		{
			$this->meta[$type] = array_merge($this->meta[$type], $value);
		}
	}
488063
public function getGroups($node) {

    $groupcontents = GroupContent::loadByEntity($node);

    $groups = [];
    // Only react if it is actually posted inside a group.
    if (!empty($groupcontents)) {
      foreach ($groupcontents as $groupcontent) {
        /* @var \Drupal\group\Entity\GroupContent $groupcontent */
        $group = $groupcontent->getGroup();
        /* @var \Drupal\group\Entity\Group $group */
        $groups[] = $group;
      }
    }

    return $groups;
  }
424704
public function group($group, $context) {
		if (!$group) {
			return;
		}
		if (is_string($group) && strpos($group, 'function') === 0) {
			return ['$keyf' => new MongoCode($group)];
		}
		$group = (array) $group;

		foreach ($group as $i => $field) {
			if (is_int($i)) {
				$group[$field] = true;
				unset($group[$i]);
			}
		}
		return ['key' => $group];
	}
1321731
public function create(array $metadata)
    {
        $schema = $this->getSchemaFromMetadata($metadata);

        $statements = $schema->toSql($this->platform);

        $this->build($statements);

        return $statements;
    }
543485
public function get_groups_by_post_type($post_type){
    global $wpdb;

    $query = sprintf("SELECT * FROM %s WHERE post_type = '%s' ORDER BY id",MF_TABLE_CUSTOM_GROUPS,$post_type);
    $groups = $wpdb->get_results( $query, ARRAY_A);
    return $groups;
  }
160620
public function setMeta(array $meta)
    {
        $this->took = isset($meta['took']) ? $meta['took'] : null;
        $this->timed_out = isset($meta['timed_out']) ? $meta['timed_out'] : null;
        $this->shards = isset($meta['_shards']) ? $meta['_shards'] : null;
        $this->hits = isset($meta['hits']) ? $meta['hits'] : null;
        $this->aggregations = isset($meta['aggregations']) ? $meta['aggregations'] : [];

        return $this;
    }
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;
	}
752114
public function getGroups(): Generator
    {
        $command = new Command('LIST ACTIVE');
        $response = yield from $this->sendCommand($command);

        $data = yield from $this->encoder->readData($this->stream);

        if (preg_match_all('/([A-z\._-]+)\s+(\d+)\s+(\d+)\s+(\w)/', $data, $matches, PREG_SET_ORDER) === false) {
            throw new FormatException('Invalid groups format');
        }

        return array_map(function ($matches) {
            if ($matches[4] === 'y') {
                $status = Group::POSTING_PERMITTED;
            } elseif ($matches[4] === 'n') {
                $status = Group::POSTING_NOT_PERMITTED;
            } elseif ($matches[4] === 'm') {
                $status = Group::POSTING_FORWARDED;
            } else {
                $status = Group::STATUS_UNKNOWN;
            }

            $high = (int)$matches[2];
            $low = (int)$matches[3];
            return new Group($matches[1], $high - $low, $low, $high, $status);
        }, $matches);
    }
1350649
protected function encodeMetaToArray($meta): array
    {
        $this->withMeta($meta);

        $writer = $this->getFactory()->createDocumentWriter();

        $writer->setUrlPrefix($this->getUrlPrefix());

        // write header
        $this->writeHeader($writer);

        // write footer
        $this->writeFooter($writer);

        // encode to json
        $array = $writer->getDocument();

        return $array;
    }
1270213
protected function generateTableAnnotation($metadata)
    {
        if ($metadata->isEmbeddedClass) {
            return '';
        }

        $table = array();

        if (isset($metadata->table['schema'])) {
            $table[] = 'schema="' . $metadata->table['schema'] . '"';
        }

        if (isset($metadata->table['name'])) {
            $table[] = 'name="' . $metadata->table['name'] . '"';
        }

        if (isset($metadata->table['options']) && $metadata->table['options']) {
            $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}';
        }

        if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) {
            $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']);
            $table[] = 'uniqueConstraints={' . $constraints . '}';
        }

        if (isset($metadata->table['indexes']) && $metadata->table['indexes']) {
            $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']);
            $table[] = 'indexes={' . $constraints . '}';
        }

        return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')';
    }
231710
private function generateDocumentProperties(array $metadata)
    {
        $lines = [];

        foreach ($metadata['properties'] as $property) {
            $lines[] = $this->generatePropertyDocBlock($property);
            $lines[] = $this->spaces . $property['visibility'] . ' $' . $property['field_name'] . ";\n";
        }

        return implode("\n", $lines);
    }
1003073
private function buildFieldMappings(ClassMetadataInfo $metadata)
    {
        $tableName      = $metadata->table['name'];
        $columns        = $this->tables[$tableName]->getColumns();
        $primaryKeys    = $this->getTablePrimaryKeys($this->tables[$tableName]);
        $foreignKeys    = $this->getTableForeignKeys($this->tables[$tableName]);
        $allForeignKeys = array();

        foreach ($foreignKeys as $foreignKey) {
            $allForeignKeys = array_merge($allForeignKeys, $foreignKey->getLocalColumns());
        }

        $ids           = array();
        $fieldMappings = array();

        foreach ($columns as $column) {
            if (in_array($column->getName(), $allForeignKeys)) {
                continue;
            }

            $fieldMapping = $this->buildFieldMapping($tableName, $column);

            if ($primaryKeys && in_array($column->getName(), $primaryKeys)) {
                $fieldMapping['id'] = true;
                $ids[] = $fieldMapping;
            }

            $fieldMappings[] = $fieldMapping;
        }

        // We need to check for the columns here, because we might have associations as id as well.
        if ($ids && count($primaryKeys) == 1) {
            $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
        }

        foreach ($fieldMappings as $fieldMapping) {
            $metadata->mapField($fieldMapping);
        }
    }
490438
public function prepareMeta(array $meta)
    {
        $meta = parent::getMeta();

        /** @var ModifierInterface $modifier */
        foreach ($this->pool->getModifiersInstances() as $modifier) {
            $meta = $modifier->modifyMeta($meta);
        }
        return $meta;
    }
798979
public function getMeta($meta = null)
  {
    if ($meta === null) {
      return $this->meta;
    }

    return $this->meta->get($meta);
  }