Take the data from the mform and create the endpoint.

@param stdClass $data
@return \core\oauth2\endpoint
770459
public static function create_endpoint($data) {
        require_capability('moodle/site:config', context_system::instance());
        $endpoint = new endpoint(0, $data);

        // Will throw exceptions on validation failures.
        $endpoint->create();
        return $endpoint;
    }
784238
protected function create($data = null)
    {
        $method = '__'.str_replace(__CLASS__.'::', '', __METHOD__);

        if ($this->hasMethod($method) && is_callable([$this, $method])) {
            $arguments = func_get_args();
            if (empty($arguments)) {
                $result = $this->{$method}();
            } else {
                $result = call_user_func_array([$this, $method], $arguments);
            }

            return $result;
        }
    }
579601
public function create( $data )
    {
        $structure = parent::create( $data );

        if ( $structure instanceof Structure\ProxyAbstract )
        {
            $structure->prepareCreate();
        }

        return $structure;
    }
1125366
public static function fromData(array $data)
    {
        $reflection = new \ReflectionClass(static::class);
        $instance = $reflection->newInstanceWithoutConstructor();
        $instance->data = $data;
        $instance->jsonUnserialize($data);
        return $instance;
    }
52191
public function createOrder($data)
    {
        $endpoint = "{$this->apiUrl}/charges";

        $res = Requests::post(
            $endpoint,
            $this->headers,
            json_encode($data),
            $this->options
        );
        $this->validateResponse($res);

        return json_decode($res->body, true);
    }
1009795
public function createUserFromOAuth($data)
    {
        $user = $this->createUser();
        $user->setAuthDataByProvider($data['provider'], ['id' => $data['id'], 'token' => $data['token']]);
        $user->setAuthProvider($data['provider']);
        $user->setFirstAuthProvider($data['provider']);
        $user->setUsername($data['email']);
        $user->setEmail($data['email']);
        $user->setPassword('none');
        $user->setEnabled(true);
        $user->setContact(new Contact);

        return $user;
    }
149448
public function make($data)
    {
        $driver = $this->instance ?? $this->createDriver();

        return $driver->init($data);
    }
1229842
public function create($data)
    {
        $descriptor = new MethodDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setMethodName($data->getMethodName());
        $descriptor->setStatic($data->isStatic());

        $response = new ReturnDescriptor('return');
        $response->setType($data->getReturnType());
        $descriptor->setResponse($response);

        foreach ($data->getArguments() as $argument) {
            if (array_key_exists('name', $argument) && array_key_exists('type', $argument)) {
                $argumentDescriptor = $this->createArgumentDescriptorForMagicMethod(
                    $argument['name'],
                    $argument['type']
                );
                $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor);
            }
        }

        return $descriptor;
    }
1036163
public function create($data)
    {
        /** @var RcmUserService $rcmUserService */
        $rcmUserService = $this->serviceLocator->get(RcmUserService::class);

        //ACCESS CHECK
        $result = $rcmUserService->isAllowed(
            ResourceName::RESOURCE_SITES,
            'admin'
        );

        return new ApiJsonModel(['canEdit' => $result]);
    }
1217536
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();

        return $this->response = new PaymentResponse($this, $httpResponse);
    }
1132693
private function createMultiLanguageController(stdClass $data)
    {
        $this->createFileFromTemplate([
            "destination"         => $data->controllerDestination,
            "templateDestination" => __DIR__ . '/../templates/service/controller/multiLanguage.hctpl',
            "content"             => [
                "namespace"                      => $data->controllerNamespace,
                "controllerName"                 => $data->controllerName,
                "acl_prefix"                     => $data->aclPrefix,
                "serviceURL"                     => $data->serviceURL,
                "translationsLocation"           => $data->translationsLocation,
                "serviceNameDotted"              => $this->stringWithDash($data->translationFilePrefix),
                "controllerNameDotted"           => $data->serviceRouteName,
                "adminListHeader"                => $this->getAdminListHeader($data),
                "formValidationName"             => $data->formValidationName,
                "translationsFormValidationName" => $data->formTranslationsValidationName,
                "functions"                      => replaceBrackets(file_get_contents(__DIR__ . '/../templates/service/controller/multilanguage/functions.hctpl'),
                    [
                        "modelName"      => $data->mainModel->modelName,
                        "modelNameSpace" => $data->modelNamespace,
                    ]),
                "inputData"                      => $this->getInputData($data),
                "useFiles"                       => $this->getUseFiles($data, true),
                "mainModelName"                  => $data->mainModel->modelName,
                "searchableFields"               => $this->getSearchableFields($data),
                "searchableFieldsTranslations"   => $this->getSearchableFields($data, true),
            ],
        ]);

        return $data->controllerDestination;
    }
1227374
protected function createServer($data)
    {
        /** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
        $appServer = oxNew(\OxidEsales\Eshop\Core\DataObject\ApplicationServer::class);

        $appServer->setId($this->getServerParameter($data, 'id'));
        $appServer->setTimestamp($this->getServerParameter($data, 'timestamp'));
        $appServer->setIp($this->getServerParameter($data, 'ip'));
        $appServer->setLastFrontendUsage($this->getServerParameter($data, 'lastFrontendUsage'));
        $appServer->setLastAdminUsage($this->getServerParameter($data, 'lastAdminUsage'));

        return $appServer;
    }
695943
protected function createToken($data)
    {
        if (empty($data) || !is_array($data)) {
            return null;
        }

        if (!isset($data['auth']) || !is_array($data['auth'])) {
            return null;
        }

        if (!isset($data['auth']['passwordCredentials']) || !is_array($data['auth']['passwordCredentials'])) {
            return null;
        }

        $credentials = $data['auth']['passwordCredentials'];

        if (!isset($credentials['username']) || !isset($credentials['password'])) {
            return null;
        }

        // validate using Username and password
        $username = $credentials['username'];
        $password = $credentials['password'];

        return new UsernamePasswordToken($username, $password, $this->providerKey);
    }
388000
public function withData($data): self
    {
        $new = clone $this;
        $new->data = $data instanceof MessageData ? $data : MessageData::fromArray($data);

        return $new;
    }
348303
public function create($data)
    {
        $methodDescriptor = new MethodDescriptor();
        $this->mapReflectorToDescriptor($data, $methodDescriptor);

        $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor);
        $this->addArguments($data, $methodDescriptor);
        $this->addVariadicArgument($data, $methodDescriptor);

        return $methodDescriptor;
    }
1197364
public static function createFromData(array $data)
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::REQUIRED_METHOD);
        }

        if (!in_array($data['method'], self::$availableMethods, true)) {
            throw new DomainException(
                sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
            );
        }

        return parent::createFromData($data);
    }
271072
public function create($data)
	{
		// @todo: Implement processing
		$processPayload = new Payload($data, Payload::STATUS_VALID); // @todo: Super temporary WIP

		// // Process data given.
		// $processPayload = $this->process(__FUNCTION__, $data);

		// if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		// {
		// 	return $processPayload;
		// }

		// Create the entity with the given data.
		$aggregatePayload = $this->aggregate[self::getEntityType()]->create($processPayload->getData());

		// No need to procede if dynamic content was not created.
		if( ! $aggregatePayload->isStatus(Payload::STATUS_CREATED))
		{
			return $aggregatePayload;
		}

		// Create the newly created entity's EntityIdentifier.
		$identifierPayload = $this->createIdentifier($aggregatePayload->getData());

		if( ! $identifierPayload->isStatus(Payload::STATUS_CREATED))
		{
			return $identifierPayload;
		}

		// @todo: The following currently adds an additional query just for the ease of getting the full entity to return.
		$createdEntityPayload = $this->getOneByUuid($aggregatePayload->getData()->getUuid());

		if( ! $createdEntityPayload->isStatus(Payload::STATUS_FOUND))
		{
			return $createdEntityPayload;
		}

		return new Payload($createdEntityPayload->getData(), $aggregatePayload->getStatus());
	}