@param array                    $info
@param ResultInterface|Resource $data
@param array                    $identity

@return Resource|Batch
972781
private function createResources(array $info, $data, array $identity)
    {
        $data = isset($info['path'])
            ? jp\search($info['path'], $data)
            : null;

        if (isset($identity[0])) {
            $resources = [];
            foreach ($identity as $index => $id) {
                $datum = isset($data[$index]) ? $data[$index] : $data;
                $resources[] = new Resource($this, $info['type'], $id, $datum);
            }
            return new Batch($this, $info['type'], $resources);
        } else {
            return new Resource($this, $info['type'], $identity, $data);
        }
    }
490836
public function findAll(Identity $identity = null)
    {
        if ($identity === null) {
            $identity = $this->getIdentity();
        }

        return $this
            ->_fetchAll($identity)
            ->_fetchCount($identity)
            ->_returnCollection();
    }
1057748
public function update(string $id,
                           int $version,
                           string $name,
                           string $data,
                           array $labels = [],
                           array $drive = [],
                           array $templating = [])
    {
        $data = array_filter([
            'Name' => $name,
            'Labels' => $labels,
            'Data' => $data,
            'Drive' => $drive,
            'Templating' => $templating,
        ]);

        $url = self::$base_url.'/'.$id.'/update?'.http_build_query(['version' => $version]);

        return self::$curl->post($url, json_encode($data), self::HEADER);
    }
1007711
public function deployInstanceAsync($id, $data = null)
    {
        return $this->deployInstanceAsyncWithHttpInfo($id, $data)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
519055
private function createRelationship(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $data = ($this->extract)($entity);
        $start = $data->get($meta->startNode()->property());
        $end = $data->get($meta->endNode()->property());
        $varName = $this->name->sprintf(\md5($identity->value()));
        $startName = $this->name->sprintf(\md5($start));
        $endName = $this->name->sprintf(\md5($end));

        $paramKey = $varName->append('_props');
        $properties = $this->buildProperties($meta->properties(), $paramKey);
        $keysToKeep = $data->keys()->intersect($properties->keys());

        return $this
            ->matchEdge(
                $endName,
                $meta->endNode(),
                $end,
                $this->matchEdge(
                    $startName,
                    $meta->startNode(),
                    $start,
                    $query
                )
            )
            ->create((string) $startName)
            ->linkedTo((string) $endName)
            ->through(
                (string) $meta->type(),
                (string) $varName,
                'right'
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $paramKey
                    ->prepend('{')
                    ->append('}.')
                    ->append($meta->identity()->property())
            )
            ->withProperties($properties->reduce(
                [],
                static function(array $carry, string $property, string $cypher): array {
                    $carry[$property] = $cypher;

                    return $carry;
                }
            ))
            ->withParameter(
                (string) $paramKey,
                $data
                    ->filter(static function(string $key) use ($keysToKeep): bool {
                        return $keysToKeep->contains($key);
                    })
                    ->put($meta->identity()->property(), $identity->value())
                    ->reduce(
                        [],
                        static function(array $carry, string $key, $value): array {
                            $carry[$key] = $value;

                            return $carry;
                        }
                    )
            );
    }
171042
public function setID($identity)
    {
        $idAttribute = $this->idAttribute;
        return (is_string($idAttribute) && !empty($idAttribute)) ? $this->$idAttribute = $identity : null;
    }
11512
public function updateOrCreate(array $identifiers, array $data)
    {
        $existing = $this->model->where(array_only($data, $identifiers))->first();

        if ($existing) {
            $existing->update($data);

            return $existing;
        }

        return $this->create($data);
    }
488307
public function deployInstanceCodebaseAsync($id, $data = null)
    {
        return $this->deployInstanceCodebaseAsyncWithHttpInfo($id, $data)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
1170027
protected function _fetchCount(Identity $identity)
    {
        $this->_totalItemsCount = $this->_db->fetchOne($this->_getSelectCount($identity));
        return $this;
    }
765985
public function connect(Info $info): PDO {
    try {
      $mysql = new PDO("{$info->getDsn()}:host={$info->getHost()};dbname={$info->getDbname()};port={$info->getPort()};charset={$info->getCharset()}", $info->getUser(), $info->getPassword(), array(
        PDO::ATTR_AUTOCOMMIT => false,
        PDO::ATTR_PERSISTENT => false,
        PDO::ATTR_EMULATE_PREPARES => true,
        PDO::ATTR_TIMEOUT => 1800,
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES {$info->getCharset()}"
      ));
    } catch (Exception $ex) {
      $mysql = null;
      throw $ex;
    }
    return $mysql;
  }
1207323
public function get(string $class, string $identity)
    {
        if (!$this->has($class, $identity)) {
            return null;
        }

        return $this->entities["{$class}:{$identity}"];
    }
1328811
private function matchAggregate(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $name = $this->name->sprintf(\md5($identity->value()));
        $this->variables = $this->variables->add((string) $name);

        $query = $query
            ->match(
                (string) $name,
                $meta->labels()->toPrimitive()
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );

        return $meta
            ->children()
            ->reduce(
                $query,
                function(Query $carry, string $property, Child $child) use ($name): Query {
                    $carry = $carry
                        ->match((string) $name)
                        ->linkedTo(
                            $childName = (string) $name
                                ->append('_')
                                ->append($child->relationship()->property())
                                ->append('_')
                                ->append($child->relationship()->childProperty()),
                            $child->labels()->toPrimitive()
                        )
                        ->through(
                            (string) $child->relationship()->type(),
                            $relName = (string) $name
                                ->append('_')
                                ->append($child->relationship()->property())
                        );
                    $this->variables = $this->variables
                        ->add($childName)
                        ->add($relName);

                    return $carry;
                }
            );
    }
646406
public function callResult($id, $data = array()) {
        return $this->send(json_encode(array(WAMP::MSG_CALL_RESULT, $id, $data)));
    }
3704
public function update($identity, $label = null, $master = null, $status = null)
    {

        $params = array();
        if (! is_null($label)) {
            $params['label'] = $label;
        }
        if (! is_null($master)) {
            $params['master'] = $master;
        }
        if (! is_null($status)) {
            $params['status'] = $status;
        }

        return $this->_user->put('account/identity/' . $identity, $params);
    }
5411
private function createAggregate(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $data = ($this->extract)($entity);
        $varName = $this->name->sprintf(\md5($identity->value()));

        $query = $query->create(
            (string) $varName,
            $meta->labels()->toPrimitive()
        );
        $paramKey = $varName->append('_props');
        $properties = $this->buildProperties(
            $meta->properties(),
            $paramKey
        );
        $keysToKeep = $data->keys()->intersect($properties->keys());

        $query = $query
            ->withProperty(
                $meta->identity()->property(),
                (string) $paramKey
                    ->prepend('{')
                    ->append('}.')
                    ->append($meta->identity()->property())
            )
            ->withProperties($properties->reduce(
                [],
                static function(array $carry, string $property, string $cypher): array {
                    $carry[$property] = $cypher;

                    return $carry;
                }
            ))
            ->withParameter(
                (string) $paramKey,
                $data
                    ->filter(static function(string $key) use ($keysToKeep): bool {
                        return $keysToKeep->contains($key);
                    })
                    ->put(
                        $meta->identity()->property(),
                        $identity->value()
                    )
                    ->reduce(
                        [],
                        static function(array $carry, string $key, $value): array {
                            $carry[$key] = $value;

                            return $carry;
                        }
                    )
            );

        $query = $meta
            ->children()
            ->reduce(
                $query,
                function(Query $carry, string $property, Child $child) use ($varName, $data): Query {
                    return $this->createAggregateChild(
                        $child,
                        $varName,
                        $data->get($property),
                        $carry
                    );
                }
            );
        $this->variables = $this->variables->add((string) $varName);

        return $query;
    }
1062016
protected function render(array $info)
    {
        $content = file_get_contents($this->path);

        $generator = $this->assets;
        $info['home_url'] = $generator('/');
        $info['favicon_url'] = $generator('favicon.ico');

        foreach ($info as $key => $val) {
            $content = str_replace("{{ $$key }}", $val, $content);
        }

        return $content;
    }
785980
public static function getOrFail($data = [], Entity $entity = null, callable $callable = null)
    {
        if (!$entity) {
            $entity = (new static)->getEntity();
        }

        if (is_scalar($data)) {
            return $entity->where('id', $data)->oneOrFail($callable);
        } else {
            return $entity->whereArr($data)->oneOrFail($callable);
        }
    }