Create.

@param string $name
@param string $field
@param int    $applicationType
@param string $filterType
@param array  $subgroup
@param array  $sort
@param int    $limit

@return Aggregation
438635
public static function create(
        string $name,
        string $field,
        int $applicationType,
        string $filterType,
        array $subgroup = [],
        array $sort = self::SORT_BY_COUNT_DESC,
        int $limit = self::NO_LIMIT
    ): self {
        return new self(
            $name,
            $field,
            $applicationType,
            $filterType,
            $subgroup,
            $sort,
            $limit
        );
    }
971297
public function addGroup($name, $fields = [])
    {
        $group = new Group();
        $group->setName($name);
        $group->setFields($fields);
        $this->addGroupObject($group);
    }
1273244
public function create($resourceType, $name, $data)
    {
        return $this->client()->put($data, 'custom-fields/{resourceType}/{name}', [
            'resourceType' => $resourceType,
            'name' => $name,
        ]);
    }
922013
public function create($filterTypeAlias, $name = null, array $options = [])
    {
        $alias = strtolower($filterTypeAlias);

        if (!$this->filterChain->hasType($alias)) {
            throw new FilterCreatorException(sprintf('Given filter type alias "%s" does not exist.', $alias));
        }


        /** @var FilterInterface $filter */
        $filter = clone $this->filterChain->getType($alias);

        if (!($filter instanceof FilterInterface)) {
            // The filter must implement the bundles FilterInterface.
            throw new FilterCreatorException(sprintf(
                'Filter "%s" must implement Da2e\FiltrationBundle\Filter\Filter\FilterInterface interface.',
                get_class($filter)
            ));
        }

        $filter->setName($name === null ? $this->generateUniqueName($alias) : $name);

        if (count($options) > 0) {
            // Handle filter options if there are such.
            $this->filterOptionHandler->handle($filter, $options);
        }

        return $filter;
    }
385125
public function createExtendedCollection($name, MkCol $mkCol)
    {
        $isCalendar = false;
        $isSubscription = false;
        foreach ($mkCol->getResourceType() as $rt) {
            switch ($rt) {
                case '{DAV:}collection':
                case '{http://calendarserver.org/ns/}shared-owner':
                    // ignore
                    break;
                case '{urn:ietf:params:xml:ns:caldav}calendar':
                    $isCalendar = true;
                    break;
                case '{http://calendarserver.org/ns/}subscribed':
                    $isSubscription = true;
                    break;
                default:
                    throw new DAV\Exception\InvalidResourceType('Unknown resourceType: '.$rt);
            }
        }

        $properties = $mkCol->getRemainingValues();
        $mkCol->setRemainingResultCode(201);

        if ($isSubscription) {
            if (!$this->caldavBackend instanceof Backend\SubscriptionSupport) {
                throw new DAV\Exception\InvalidResourceType('This backend does not support subscriptions');
            }
            $this->caldavBackend->createSubscription($this->principalInfo['uri'], $name, $properties);
        } elseif ($isCalendar) {
            $this->caldavBackend->createCalendar($this->principalInfo['uri'], $name, $properties);
        } else {
            throw new DAV\Exception\InvalidResourceType('You can only create calendars and subscriptions in this collection');
        }
    }
995504
public function buildField($name, $type, $indexed, $tableName, NodeTypeContract $nodeType)
    {
        $this->modelBuilder->build($tableName, $nodeType->getFields());
        $this->buildForm($nodeType);
        $migration = $this->migrationBuilder->buildFieldMigrationForTable($name, $type, $indexed, $tableName);

        $this->migrateUp($migration);
    }
890774
public function createFromImportedData($name, $data)
    {
        if (!is_array($data)) {
            return new GroupParameter($name, [$data]);
        } elseif (!$this->isAssociativeArray($data)) {
            return new GroupParameter($name, $data);
        }
        $parameter = new GroupParameter($name);
        foreach ($data as $childName => $childData) {
            $parameter->addChild($this->createFromImportedData($childName, $childData));
        }
        return $parameter;
    }
1289243
public static function create($name)
    {
        $logger = new Logger($name);

        $localLogConfig = config('logger.local_log');
        if($localLogConfig['enabled'] && !in_array($name, $localLogConfig['exclude_names'])) {
            $streamHandler = self::streamHandler($name);
            $logger->pushHandler($streamHandler);
        }

        $logstashConfig = config('logger.logstash');
        if($logstashConfig['enabled'] && !in_array($name, $logstashConfig['exclude_names'])){
            $gelfHandler = self::logStashHandler($logstashConfig);
            $logger->pushHandler($gelfHandler);
        }

        $requestId = Request::header('x-request-id');
        $logger->setRequestId($requestId);

        return $logger;
    }
228264
public function registerGroup($name,$alias,$fields){
		$grp=new BConfigCategoryGroup();
		$grp->alias=$alias;
		$grp->name=$name;
		foreach($fields as $fld){
			$grp->fields[$fld->alias]=$fld;
			}
		$this->groups[$alias]=$grp;
		return $grp;
		}
64083
protected function createArray(string $fieldName, array $aggregation): array
    {
        $return = [];
        $buckets = $aggregation['buckets'] ?? $aggregation[$fieldName]['buckets'] ?? null;
        if (!$buckets) {
            return $return;
        }
        $attributeId = $this->isAttribute($fieldName);
        foreach ($buckets as $key => $bucket) {
            $return[$key]['count'] = $bucket['doc_count'];
            $return[$key][($attributeId === false ? $fieldName : 'attributeValueId')] = $bucket['key'];
            if ($attributeId !== false) {
                $return[$key]['attributeId'] = $attributeId;
            }
        }

        return array_values($return);
    }
297510
public static function createBool($name)
    {
        $field = new DatabaseField($name, self::TYPE_TINY_INT);
        $field->m_constraint = 1;
        return $field;
    }
728964
private function aggregation($field, $isMulti = false, $operation = '$max', $useMaster = false)
    {
        $pipe = [];
        empty($this->sql['where']) || $pipe[] = [
            '$match' => $this->sql['where']
        ];
        $pipe[] = [
            '$group' => [
                '_id' => $isMulti ? '$' . $isMulti : '0',
                'count' => [$operation => '$' . $field]
            ]
        ];
        $res = $this->mongoDbAggregate($pipe, [], $useMaster);
        if ($isMulti === false) {
            return $res[0]['count'];
        } else {
            return $res;
        }
    }
94589
public static function create_from_field($field) {
        $event = self::create(array(
            'objectid' => $field->id,
            'context' => \context_system::instance(),
            'other' => array(
                'shortname' => $field->shortname,
                'name'      => $field->name,
                'datatype'  => $field->datatype,
            )
        ));

        $event->add_record_snapshot('user_info_field', $field);

        return $event;
    }
1366539
public function add(
        $name,
        $type = null,
        array $filterOptions = [],
        $fieldType = null,
        $fieldOptions = null,
        array $fieldDescriptionOptions = []
    ) {
        if (\is_array($fieldOptions)) {
            $filterOptions['field_options'] = $fieldOptions;
        }

        if ($fieldType) {
            $filterOptions['field_type'] = $fieldType;
        }

        if ($name instanceof FieldDescriptionInterface) {
            $fieldDescription = $name;
            $fieldDescription->mergeOptions($filterOptions);
        } elseif (\is_string($name)) {
            if ($this->admin->hasFilterFieldDescription($name)) {
                throw new \RuntimeException(sprintf('Duplicate field name "%s" in datagrid mapper. Names should be unique.', $name));
            }

            if (!isset($filterOptions['field_name'])) {
                $filterOptions['field_name'] = substr(strrchr('.'.$name, '.'), 1);
            }

            $fieldDescription = $this->admin->getModelManager()->getNewFieldDescriptionInstance(
                $this->admin->getClass(),
                $name,
                array_merge($filterOptions, $fieldDescriptionOptions)
            );
        } else {
            throw new \RuntimeException(
                'Unknown field name in datagrid mapper.'
                .' Field name should be either of FieldDescriptionInterface interface or string.'
            );
        }

        // add the field with the DatagridBuilder
        $this->builder->addFilter($this->datagrid, $type, $fieldDescription, $this->admin);

        return $this;
    }
10409
public function createField($name, $isRequired, $type, ResourceNode $resourceNode = null)
    {
        $fieldFacet = new FieldFacet();
        $fieldFacet->setLabel($name);
        $fieldFacet->setType($type);
        $fieldFacet->setRequired($isRequired);
        $fieldFacet->setResourceNode($resourceNode);
        $this->om->persist($fieldFacet);
        $this->om->flush();

        return $fieldFacet;
    }
233060
private static function createEnumFilter(Endpoint $endpoint, FieldDefinition $field, string $enumName, array $enumValues): Filter
    {
        $name = "{$enumName}ComparisonExpression";
        if ($endpoint->hasType($name)) {
            $condition = $endpoint->getType($name);
        } else {
            /** @var InputObjectDefinition $condition */
            $condition = unserialize(serialize($endpoint->getType(EnumComparisonExpression::class)), ['allowed_classes' => true]);
            $condition->setName($name);
            $condition->getField('values')->setType($enumName)->setList(true);
            $description = $condition->getDescription();
            $description = str_replace('\'{VALUE_1}\'', array_values($enumValues)[0], $description);
            if (isset(array_values($enumValues)[1])) {
                $description = str_replace('\'{VALUE_2}\'', array_values($enumValues)[1], $description);
            } else {
                $description = str_replace(', \'{VALUE_2}\'', null, $description);
            }
            $condition->setDescription($description);
            $endpoint->add($condition);
        }
        $filter = new Filter();
        $filter->name = $filter->field = $field->getName();
        $filter->resolver = EnumFilter::class;
        $filter->type = $condition->getName();

        return $filter;
    }
1015183
public static function create($name, $type = NULL, $defaultValue = self::UNDEFINED, $modifiers = self::MODIFIER_PROTECTED) {
    if (isset($type)) {
      if ($type instanceof GClass) {
        $type = new ObjectType(new GClass($type->getFQN()));
      } elseif (!($type instanceof Type)) {
        $type = Type::create($type);
      }
    }
    
    return new static($name, $type, $defaultValue, $modifiers);
  }