Intermediate function to call the createFromArray function from the right context

@param $data
@param $options

@return Document
@throws \ArangoDBClient\ClientException
482339
protected function createFromArrayWithContext($data, $options)
    {
        $_documentClass = $this->_documentClass;

        return $_documentClass::createFromArray($data, $options);
    }
527311
protected function _createNewContent($options = array()) {

        /**
         * Import variables into the current symbol table from an array
         */
        extract($options);

        /**
         * Create new entity
         */
        $contentTable = TableRegistry::get('CmsContent');
        $content = $contentTable->newEntity();
        $content->parent = isset($parent) ? intval($parent) : 0;
        $content->name = $this->_randomString();
        $content->content_title = isset($content_title) ? h($content_title) : '';
        $content->content_description = isset($content_description) ? h($content_description) : '';
        $content->content_excerpt = isset($content_excerpt) ? h($content_excerpt) : '';
        $content->content_status = isset($content_status) ? trim($content_status) : 'draft';
        $content->content_type = isset($content_type) ? trim($content_type) : 'page';
        $content->content_path = isset($content_path) ? trim($content_path) : '';
        $content->menu_order = isset($menu_order) ? trim($menu_order) : 0;
        $content->publish_start = isset($publish_start) ? trim($publish_start) : date('Y-m-d H:i:s');
        $content->publish_end = isset($publish_end) ? trim($publish_end) : '0000-00-00 00:00:00';
        $content->author_id = isset($author_id) ? intval($author_id) : 1;
        $content->created = date('Y-m-d H:i:s');
        $content->created_user = isset($created_user) ? intval($created_user) : 1;
        $content->modified = date('Y-m-d H:i:s');
        $content->modified_user = isset($modified_user) ? intval($modified_user) : 1;

        /**
         * Save and set name of Content
         */
        if ($contentTable->save($content)) :
            $content->name = (!isset($name)) ? $content->id : $this->_permittedContentName($content->id, $name);
            if ($contentTable->save($content))
                return $content->id;
        endif;

        /**
         * If not save Content return FALSE
         */
        return FALSE;
    }
326557
public function _castArray($name, $data, $options)
    {
        $options['type'] = isset($options['relation']) && $options['relation'] === 'hasManyThrough' ? 'through' : 'set';
        $class = ltrim($options['class'], '\\');
        $classes = $class::classes();
        $collection = $classes[$options['type']];

        if ($data instanceof $collection) {
            return $data;
        }

        $isThrough = $options['type'] === 'through';

        $isDocument = $class === Document::class;

        $config = [
            'schema'    => $isDocument ? $this : $class::definition(),
            'basePath'  => $isDocument ? $name : null,
            'meta'      => isset($options['meta']) ? $options['meta'] : [],
            'exists'    => $options['exists'],
            'defaults'  => $options['defaults']
        ];
        if (isset($options['config'])){
            $config = Set::extend($config, $options['config']);
        }

        $column = isset($this->_columns[$name]) ? $this->_columns[$name] : [];
        if (!empty($column['format']) && $data !== null) {
            $type = $column['format'];
            $data = $this->convert('cast', $type, $data, $column, $config);
        }

        if ($isThrough) {
            $config['parent'] = $options['parent'];
            $config['through'] = $options['through'];
            $config['using'] = $options['using'];
            $config['data'] = $data;
        } else {
            $config['data'] = $data ?: [];
        }
        return new $collection($config);
    }
1347936
protected function createNodeInstance(array $data, array $options = []): NodeInterface
    {
        $factory = $this->getNodeFactory();

        $node = $factory($data, $options);

        if (!is_object($node) || !($node instanceof NodeInterface)) {
            throw ValidationException::create(
                'Node Factory must return an instance of NodeInterface.'
            );
        }

        $this->_nodeRegistry[$node->getId()] = $node;

        return $node;
    }
869949
public function createForm($data = null, array $options = [])
    {
        return $this->formFactory->create(RegionFormType::class, $data, $options);
    }
196517
public function deserialize(array $data, ResourceNode $resourceNode, array $options = [])
    {
        $this->sipe('name', 'setName', $data, $resourceNode);

        if (!in_array(Options::REFRESH_UUID, $options)) {
            $this->sipe('id', 'setUuid', $data, $resourceNode);
        }

        if (isset($data['meta']['workspace'])) {
            /** @var Workspace $workspace */
            $workspace = $this->om->getRepository(Workspace::class)->findOneBy(['uuid' => $data['meta']['workspace']['uuid']]);
            $resourceNode->setWorkspace($workspace);
        }

        if (isset($data['poster']) && isset($data['poster']['url'])) {
            $resourceNode->setPoster($data['poster']['url']);
        }

        if (isset($data['thumbnail']) && isset($data['thumbnail']['url'])) {
            $resourceNode->setThumbnail($data['thumbnail']['url']);
        }

        // meta
        if (empty($resourceNode->getResourceType())) {
            /** @var ResourceType $resourceType */
            $resourceType = $this->om
                ->getRepository('ClarolineCoreBundle:Resource\ResourceType')
                ->findOneBy(['name' => $data['meta']['type']]);

            $resourceNode->setResourceType($resourceType);
        }

        if (empty($resourceNode->getMimeType())) {
            if (isset($data['meta']) && !empty($data['meta']['mimeType'])) {
                $mimeType = $data['meta']['mimeType'];
            } else {
                $mimeType = 'custom/'.$resourceNode->getResourceType()->getName();
            }

            $resourceNode->setMimeType($mimeType);
        }

        if (isset($data['rights'])) {
            $this->deserializeRights($data['rights'], $resourceNode, $options);
        }

        $this->sipe('meta.published', 'setPublished', $data, $resourceNode);
        $this->sipe('meta.description', 'setDescription', $data, $resourceNode);
        $this->sipe('meta.license', 'setLicense', $data, $resourceNode);
        $this->sipe('meta.authors', 'setAuthor', $data, $resourceNode);
        $this->sipe('meta.commentsActivated', 'setCommentsActivated', $data, $resourceNode);

        // display
        $this->sipe('display.fullscreen', 'setFullscreen', $data, $resourceNode);
        $this->sipe('display.showIcon', 'setShowIcon', $data, $resourceNode);
        $this->sipe('display.closable', 'setClosable', $data, $resourceNode);
        $this->sipe('display.closeTarget', 'setCloseTarget', $data, $resourceNode);

        // restrictions
        $this->sipe('restrictions.code', 'setAccessCode', $data, $resourceNode);
        $this->sipe('restrictions.allowedIps', 'setAllowedIps', $data, $resourceNode);
        $this->sipe('restrictions.hidden', 'setHidden', $data, $resourceNode);

        if (isset($data['restrictions']['dates'])) {
            $dateRange = DateRangeNormalizer::denormalize($data['restrictions']['dates']);

            $resourceNode->setAccessibleFrom($dateRange[0]);
            $resourceNode->setAccessibleUntil($dateRange[1]);
        }
    }
215802
public static function create(array $data, array $options = []) {
        /** @type \Titon\Model\Model $model */
        $model = new static();
        $model->fill($data);

        if ($model->save($options)) {
            return $model;
        }

        return null;
    }
1182003
public function setJsonBody(array $data, int $options=JSON_PRETTY_PRINT|JSON_NUMERIC_CHECK)
  {
    $this->setContentType('application/json')
         ->setBody( json_encode($data,$options) );

    return $this;
  }
667330
public function createDocument($collection, array $data, array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->create($data);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
390859
public static function create(array $options)
    {
        if (isset($options['url'])) {
            $urlParts = parse_url($options['url']);

            foreach ($urlParts as $part => $value) {
                switch ($part) {
                    case 'host':
                    case 'user':
                    case 'port':
                        $options[$part] = $value;
                        break;

                    case 'path':
                        $path = explode('/', $value);
                        $options['dbname'] = array_pop($path);
                        $options['path'] = trim(implode('/', $path), '/');
                        break;

                    case 'pass':
                        $options['password'] = $value;
                        break;

                    case 'scheme':
                        $options['ssl'] = ($value === 'https');
                        break;

                    default:
                        break;
                }
            }
        }

        if (!isset($options['dbname'])) {
            throw new \InvalidArgumentException("'dbname' is a required option to create a CouchDBClient");
        }

        $defaults = [
            'type'     => 'socket',
            'host'     => 'localhost',
            'port'     => 5984,
            'user'     => null,
            'password' => null,
            'ip'       => null,
            'ssl'      => false,
            'path'     => null,
            'logging'  => false,
            'timeout'  => 10,
            'headers'  => [],
        ];
        $options = array_merge($defaults, $options);

        if (!isset(self::$clients[$options['type']])) {
            throw new \InvalidArgumentException(sprintf('There is no client implementation registered for %s, valid options are: %s',
                $options['type'], implode(', ', array_keys(self::$clients))
            ));
        }
        $connectionClass = self::$clients[$options['type']];
        $connection = new $connectionClass(
            $options['host'],
            $options['port'],
            $options['user'],
            $options['password'],
            $options['ip'],
            $options['ssl'],
            $options['path'],
            $options['timeout'],
            $options['headers']
        );
        if ($options['logging'] === true) {
            $connection = new HTTP\LoggingClient($connection);
        }

        return new static($connection, $options['dbname']);
    }
212691
public function create(array $options = [])
    {
        foreach (['host', 'port', 'username', 'secret'] as $key) {
            $options[$key] = Arr::get($options, $key, null);
        }
        $promise = $this->connector->create($options['host'], $options['port'])->then(function (Stream $stream) {
            return new Client($stream, new Parser());
        });
        if (!is_null($options['username'])) {
            $promise = $promise->then(function (Client $client) use ($options) {
                $sender = new ActionSender($client);

                return $sender->login($options['username'], $options['secret'])->then(
                    function () use ($client) {
                        return $client;
                    },
                    function ($error) use ($client) {
                        $client->close();
                        throw $error;
                    }
                );
            }, function ($error) {
                throw $error;
            });
        }

        return $promise;
    }
1040796
public function deserialize($data, ChoiceQuestion $choiceQuestion = null, array $options = [])
    {
        if (empty($choiceQuestion)) {
            $choiceQuestion = new ChoiceQuestion();
        }

        $this->sipe('multiple', 'setMultiple', $data, $choiceQuestion);
        $this->sipe('random', 'setShuffle', $data, $choiceQuestion);
        $this->sipe('numbering', 'setNumbering', $data, $choiceQuestion);

        $this->deserializeChoices($choiceQuestion, $data['choices'], $data['solutions'], $options);

        return $choiceQuestion;
    }
550829
public function add(array $data, array $options = array())
    {
        $result = array();
        $this->hook->attach('order.submit.before', $data, $options, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        $data['order_id'] = $this->order->add($data);

        if (empty($data['order_id'])) {
            return $this->getResultError();
        }

        $order = $this->order->get($data['order_id']);
        $this->setBundledProducts($order, $data);

        if (empty($options['admin'])) {
            $this->setPriceRules($order);
            $this->updateCart($order, $data['cart']);
            $this->notifyCreated($order);
            $result = $this->getResultAdded($order);
        } else {
            $this->cloneCart($order, $data['cart']);
            $result = $this->getResultAddedAdmin($order);
        }

        $this->hook->attach('order.submit.after', $data, $options, $result, $this);
        return (array) $result;
    }
1273133
public function create(array $options = [])
    {
        $this->info = $this->connection->createTopic($options + [
            'name' => $this->name
        ]);

        return $this->info;
    }
1193037
public function create(array $options = [])
    {
        $data = $this->creationSerialize();

        $this->security->getKuzzle()->query(
            $this->security->buildQueryArgs('createUser'),
            $data,
            $options
        );

        return $this;
    }
300016
public function createCollection(array $data, array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->create($data);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
273164
public function set(array $data, array $options = []) {
		$defaults = ['init' => false];
		$options += $defaults;

		$cast = ($schema = $this->schema());

		foreach ($data as $key => $val) {
			unset($this->_increment[$key]);
			if (strpos($key, '.')) {
				$this->_setNested($key, $val);
				continue;
			}
			if ($cast) {
				$pathKey = $this->_pathKey;
				$model = $this->_model;
				$parent = $this;
				$val = $schema->cast($this, $key, $val, compact('pathKey', 'model', 'parent'));
			}
			if ($val instanceof self) {
				$val->_exists = $options['init'] && $this->_exists;
				$val->_pathKey = ($this->_pathKey ? "{$this->_pathKey}." : '') . $key;
				$val->_model = $val->_model ?: $this->_model;
				$val->_schema = $val->_schema ?: $this->_schema;
			}
			$this->_updated[$key] = $val;
		}
	}