Returns a list of objects
@param  array $data
@param  ClientInterface|null $client 0
@return \Doctrine\Common\Collections\ArrayCollection|self[]|self
175847
public static function all(array $data = [], ClientInterface $client = null)
    {

        return (new RequestService($client))
            ->setResourceClass(static::class)
            ->all($data);
    }
423537
public function setClient(\OAuth2\ServerBundle\Entity\Client $client = null)
    {
        $this->client = $client;

        return $this;
    }
442168
public function convertTypeDescendants(array $data = null)
    {
        $result = [];

        if (empty($data)) {
            return $result;
        }

        foreach (array_filter($data, 'is_array') as $itemData) {

            $container = new TypeDefinitionContainer();

            $typeDefinition = $this->convertTypeDefinition($itemData[JSONConstants::JSON_TYPESCONTAINER_TYPE] ?? []);
            if ($typeDefinition !== null) {
                $container->setTypeDefinition($typeDefinition);
            }

            $container->setChildren(
                $this->convertTypeDescendants($itemData[JSONConstants::JSON_TYPESCONTAINER_CHILDREN] ?? [])
            );

            $container->setExtensions($this->convertExtension($data, JSONConstants::getTypesContainerKeys()));

            $result[] = $container;
        }

        return $result;
    }
998644
public function getClient(): ClientInterface
    {
        if ($this->client === null) {
            $this->client = new Client();
        }

        return $this->client;
    }
125887
public function handleClientData($data)
    {
        $data = get_object_vars($data);
        $varArray = array_keys($data);
        $this->client_data->m = $varArray[0];
        $this->client_data->p = $data[$varArray[0]];
        return $this->client_data;
    }
1281060
public static function instance($result, $client = null)
    {
        if ((array)$result['$data'] === $result['$data']
            && isset($result['$data']['results'])
            && isset($result['$data']['count'])) {
            return new Collection($result, $client);
        }
        
        return new Record($result, $client);
    }
390364
public static function arrayToObject($data)
    {
        if (is_array($data)) {
            /*
            * Return array converted to object
            * Using __FUNCTION__ (Magic constant)
            * for recursive call
            */
            $self_name = 'self::' . __FUNCTION__;

            return (object)array_map($self_name, $data);
        } else {
            // Return object
            return $data;
        }
    }
913387
public static function create(array $data = [], ClientInterface $client = null)
    {

        return (new RequestService($client))
            ->setResourceClass(static::class)
            ->create($data);
    }
729509
public function addClient(\Gpupo\CommonSchema\ORM\Entity\Application\API\OAuth\Client\Client $client)
    {
        $this->clients[] = $client;

        return $this;
    }
921049
public function toObject(array $data)
    {
        $data = json_decode(json_encode($data));

        if ($data === []) {
            $data = new \StdClass();
        }

        return $data;
    }
710133
public static function create($client, $data) {
    $response = $client->post(static::$path, $data);

    if ($response->statusCode == 201) {
      $class = get_called_class();
      return new $class($client, $response->json());
    }
  }
922504
private function buildContentfulEntries(ResourceArray $entries, Client $client): array
    {
        $contentfulEntries = [];

        foreach ($entries as $remoteEntry) {
            $id = $remoteEntry->getSpace()->getId() . '|' . $remoteEntry->getId();
            $contentfulEntry = $this->findContentfulEntry($id);
            if (!$contentfulEntry instanceof ContentfulEntry) {
                $contentfulEntry = $this->buildContentfulEntry($remoteEntry, $id);
            } else {
                $contentfulEntry->reviveRemoteEntry($client);
            }
            $contentfulEntries[] = $contentfulEntry;
        }

        return $contentfulEntries;
    }
884369
public static function deserializeObject(array $data)
    {
        $subAttributes = [];
        if (isset($data['subAttributes'])) {
            foreach ($data['subAttributes'] as $subAttribute) {
                $subAttributes[] = static::deserializeObject($subAttribute);
            }
        }
        $result = new static(
            $data['name'],
            $data['type'],
            $data['multiValued'],
            $data['required'],
            isset($data['description']) ? $data['description'] : null,
            $subAttributes,
            isset($data['canonicalValues']) ? $data['canonicalValues'] : [],
            isset($data['caseExact']) ? $data['caseExact'] : false,
            $data['mutability'],
            $data['returned'],
            isset($data['uniqueness']) ? $data['uniqueness'] : null,
            isset($data['referenceTypes']) ? $data['referenceTypes'] : []
        );

        return $result;
    }
248484
public function load($client = null)
	{
		$data = array();

		// First we'll get the root configuration path for the environment which is
		// where all of the configuration files live for that namespace, as well
		// as any environment folders with their specific configuration items.
		try
		{
			$paths = $this->getPath($this->defaultPath);

			if (empty($paths))
			{
				throw new EmptyDirectoryException("Configuration directory: [" . $this->defaultPath . "] is empty");
			}

			foreach ($paths as $path)
			{
				// Get file information
				$info      = pathinfo($path);
				$group     = isset($info['filename'])  ? strtolower($info['filename'])  : '';
				$extension = isset($info['extension']) ? strtolower($info['extension']) : '';
				if (!$extension || $extension == 'html')
				{
					continue;
				}
				$parser    = $this->getParser($extension);

				$data[$group] = $parser->parse($path);
			}

			if (empty($data))
			{
				throw new EmptyDirectoryException("Configuration directory: [" . $this->defaultPath . "] is empty");
			}

			if ($client)
			{
				$paths = $this->getPath($this->defaultPath . DIRECTORY_SEPARATOR . $client);

				foreach ($paths as $path)
				{
					// Get file information
					$info      = pathinfo($path);
					$group     = isset($info['filename'])  ? strtolower($info['filename'])  : '';
					$extension = isset($info['extension']) ? strtolower($info['extension']) : '';
					if (!$extension || $extension == 'html')
					{
						continue;
					}
					$parser    = $this->getParser($extension);

					if (!isset($data[$group]))
					{
						$data[$group] = array();
					}
					$data[$group] = array_replace_recursive(
						$data[$group],
						$parser->parse($path)
					);
				}
			}
		}
		catch (\Exception $e)
		{
			$loader = new Legacy();
			$loader->split();

			$data = $loader->toArray();
		}

		return $data;
	}
190004
public function getAllIds($collection)
    {
        $params   = [
            self::OPTION_COLLECTION => $this->makeCollection($collection)
        ];
        $response = $this->getConnection()->put(Urls::URL_ALL_KEYS, $this->json_encode_wrapper($params));

        $data = $response->getJson();
        if (!isset($data[Cursor::ENTRY_RESULT])) {
            throw new ClientException('Got an invalid document list from the server');
        }

        $cursor = new Cursor($this->getConnection(), $response->getJson(), ['_documentClass' => $this->_documentClass]);
        $ids    = [];
        foreach ($cursor->getAll() as $location) {
            $ids[] = UrlHelper::getDocumentIdFromLocation($location);
        }

        return $ids;
    }
968533
public function clients()
    {
        if (is_null($this->clientRequests)) {
            $this->clientRequests = new ClientRequests($this->client);
        }

        return $this->clientRequests;
    }
1068137
protected function convertToResource($data)
    {
        return Collection::make($this->client, $data->id)
            ->init($data);
    }