@param Type\Method $method
@param object $object
@param mixed[] $data
@param string $attribute

@return mixed[]
188697
private function processSerializeTypeMethod(Type\Method $method, $object, array $data, string $attribute): array
    {
        $value = $object->{$method->getter()}();

        if ($this->checkNullForAttribute($value, $attribute) === false) {
            $data[$attribute] = $value;
        }

        return $data;
    }
767235
protected function processMethod($url, $data, $dataType, $method)
    {
        return $this->__invoke(array(
            'url' => $url,
            'method' => $method,
            'dataType' => $dataType,
            'data' => $data
        ));
    }
793112
public function execute($method, $url, array $data = [])
    {
        $client = new Client(['handler' => $this->handler]);

        return json_decode($client->request($method, $url, array_merge($data, self::$OPTIONS))->getBody());
    }
1052593
protected function getAttributes($object, $format = null, array $context)
    {
        $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
        $key = $class.'-'.$context['cache_key'];

        if (isset($this->attributesCache[$key])) {
            return $this->attributesCache[$key];
        }

        $allowedAttributes = $this->getAllowedAttributes($object, $context, true);

        if (false !== $allowedAttributes) {
            if ($context['cache_key']) {
                $this->attributesCache[$key] = $allowedAttributes;
            }

            return $allowedAttributes;
        }

        $attributes = $this->extractAttributes($object, $format, $context);

        if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForMappedObject($object)) {
            array_unshift($attributes, $mapping->getTypeProperty());
        }

        if ($context['cache_key']) {
            $this->attributesCache[$key] = $attributes;
        }

        return $attributes;
    }
909580
public function request($method, $url, array $data = [])
    {
        return $this->request->send($this->baseUrl.'/'.$url, $method, $data);
    }
91549
public function sendRequest($method, $attributes)
    {
        $request = $this->makeRequest($method, $attributes);

        try {
            $response = $this->client->send($request);

            $responseBody = $response->getBody()->getContents();

            return json_decode($responseBody, true);

        } catch (\Exception $e) {

            $this->exception = $e;

            return [
                'status' => 'error',
                'error'  => [
                    'code'           => '0.00',
                    'exception_code' => $e->getCode(),
                    'messages'       => [
                        'Unexpected error',
                        'Caught ' . get_class($e) . ' exception.',
                        $e->getMessage(),
                    ],
                ],
            ];
        }
    }
1062515
public function addChange($table, $method, $data)
    {
        $table = $this->getRawTableName($table);

        if (!isset($this->changes[$table])) {
            $this->changes[$table] = [];
        }

        $this->changes[$table][] = new TableChange([
            'schema' => TableStructure::identifySchema(get_class($this->db->schema)),
            'table' => $table,
            'method' => $method,
            'data' => $data,
        ]);
    }
230531
public function call($method, array $data = null, $type = 'get')
    {
        $url = self::URL_PREFIX . '/' . $method . '?auth_token=' . $this->token;
        if ($data && $type == 'get') {
            $url .= '&' . implode('&', $data);
        }

        $options = [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true
        ];
        if ($data && $type == 'post') {
            $options[CURLOPT_POST] = true;
            $options[CURLOPT_POSTFIELDS] = $data;
        }
        $response = self::jsonValidate($this->executeCurl($options), $this->returnArray);

        return $response['data'];
    }
79352
private function prepareRequestArguments(array $data = null, string $method = null): array
    {
        $data   = $data ?? [];
        $method = $method ?? 'GET';

        // Removes null entries.
        $data = array_filter($data, function ($val) {
            return (null !== $val);
        });

        $headers = [
            'Content-Type' => 'application/json',
            'X-Auth-Email' => $this->email,
            'X-Auth-Key'   => $this->auth_key,
        ];

        $args = [
            'body'    => wp_json_encode($data),
            'headers' => $headers,
            'method'  => strtoupper($method),
            'timeout' => 15,
        ];

        return $args;
    }
932491
private static function call($method, $attributes)
    {
        $extManager = self::$serviceContainer->get('neoclient.extension_manager');

        $response = $extManager->execute($method, $attributes);

        return $response;
    }
1357652
private function setArrayAndCheckNullWithKey(array $data, $object, $key, $attribute): array
    {
        $value = $this->setArray($object);

        if ($this->checkNullForAttribute($value, $key) === false) {
            $data[$attribute][$key] = $value;
        }

        return $data;
    }
87045
protected function loadItem($em, $data, $attributes, $association)
    {
        if (is_object($data)) {
            if (get_class($data) === 'DateTime') {
                return array('type' => 'DateTime', 'name' => $data->format('r'));
            }

            if (array_key_exists('targetEntity', $attributes)) {
                $targetClass = $em->getClassMetadata($attributes['targetEntity']);

//                var_dump($association);die();
                $className = get_class($data);

//                die($className);
                $entityProvider = new EntityProvider($className);

//                $meta = $em->getClassMetadata($className);
                $identifier = $targetClass->getSingleIdentifierFieldName();
                $identifierMethodName = 'get'.ucfirst($identifier);

                return array(
                    'type' => 'reference',
                    'name' => $entityProvider->getName().'_'.$data->$identifierMethodName(),
                );
            }

            throw new \Exception('Unknown data class: '.get_class($data));
        }

        if (!is_array($data)) {
            return str_replace(array("\r\n",   "\r", "\n"), '\n', htmlspecialchars($data, ENT_QUOTES));
        }

        return $data;
    }
205778
public function requestCurl($url, $method = 'GET', $data = [])
    {
        $data_string = json_encode($data);

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Authorization: Bearer ' . $this->token)
        );

        $result = curl_exec($ch);
        $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $result = json_decode($result);

        $result = array_merge((array)$result, ["status_code" => $httpcode]);

        if ($httpcode == 401 || $httpcode == 403) {
            throw new UnauthorizedException("Unauthorized");
        } elseif ($httpcode > 403) {
            throw new \Exception("Status_code: " . $httpcode);
        }

        return $result;
    }
518281
protected function get($method, array $data = [], $key = 'key')
    {
        $data = $this->data($data);

        if (!isset($this->cache[$method][$key])) {
            $this->cache[$method][$key] = $this->client->$method($data);
        }

        return $this->cache[$method][$key];
    }
230229
public function execute($method, $resource, array $data = [])
    {
        $request = new Request($this->handler);
        $dataResource = $request->execute($method, $this->makeUrl($resource), array_merge($data, [
            'headers' => [
                'Authorization' => sprintf('Basic %s', base64_encode($this->token . ':' . ''))
            ]
        ]));

        return $dataResource;
    }
410569
public function request(array $data = [], string $method = Request::GET): Response
    {
        $path = '_cluster/settings';

        return $this->getClient()->request($path, $method, $data);
    }
1284403
private function populateRelation(array $data, $object, ?string $format, array $context, array $components, string $type): array
    {
        $class = $this->getObjectClass($object);

        $attributesMetadata = \array_key_exists($class, $this->attributesMetadataCache) ?
            $this->attributesMetadataCache[$class] :
            $this->attributesMetadataCache[$class] = $this->classMetadataFactory ? $this->classMetadataFactory->getMetadataFor($class)->getAttributesMetadata() : null;

        $key = '_'.$type;
        foreach ($components[$type] as $relation) {
            if (null !== $attributesMetadata && $this->isMaxDepthReached($attributesMetadata, $class, $relation['name'], $context)) {
                continue;
            }

            $attributeValue = $this->getAttributeValue($object, $relation['name'], $format, $context);
            if (empty($attributeValue)) {
                continue;
            }

            $relationName = $relation['name'];
            if ($this->nameConverter) {
                $relationName = $this->nameConverter->normalize($relationName, $class, $format, $context);
            }

            if ('one' === $relation['cardinality']) {
                if ('links' === $type) {
                    $data[$key][$relationName]['href'] = $this->getRelationIri($attributeValue);
                    continue;
                }

                $data[$key][$relationName] = $attributeValue;
                continue;
            }

            // many
            $data[$key][$relationName] = [];
            foreach ($attributeValue as $rel) {
                if ('links' === $type) {
                    $rel = ['href' => $this->getRelationIri($rel)];
                }

                $data[$key][$relationName][] = $rel;
            }
        }

        return $data;
    }