Takes the given data and attempts to build a Descriptor from it.

@param mixed $data

@throws \InvalidArgumentException if no Assembler could be found that matches the given data.

@return DescriptorAbstract|Collection|null
349191
public function buildDescriptor($data)
    {
        $assembler = $this->getAssembler($data);
        if (!$assembler) {
            throw new \InvalidArgumentException(
                'Unable to build a Descriptor; the provided data did not match any Assembler '. get_class($data)
            );
        }

        if ($assembler instanceof Builder\AssemblerAbstract) {
            $assembler->setBuilder($this);
        }

        // create Descriptor and populate with the provided data
        $descriptor = $assembler->create($data);
        if (!$descriptor) {
            return null;
        }

        $descriptor = (!is_array($descriptor) && (!$descriptor instanceof Collection))
            ? $this->filterAndValidateDescriptor($descriptor)
            : $this->filterAndValidateEachDescriptor($descriptor);

        return $descriptor;
    }
829302
public function create($data)
    {
        $interfaceDescriptor = new InterfaceDescriptor();

        $interfaceDescriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
        $interfaceDescriptor->setName($data->getName());
        $interfaceDescriptor->setLine($data->getLocation()->getLineNumber());
        $interfaceDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: '');

        // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself
        $interfaceDescriptor->setNamespace(substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 1));

        $this->assembleDocBlock($data->getDocBlock(), $interfaceDescriptor);
        $this->addConstants($data->getConstants(), $interfaceDescriptor);
        $this->addMethods($data->getMethods(), $interfaceDescriptor);

        foreach ($data->getParents() as $interfaceClassName) {
            $interfaceDescriptor->getParent()->set((string) $interfaceClassName, $interfaceClassName);
        }

        return $interfaceDescriptor;
    }
1341573
public static function fromSerialized($data)
    {
        if (!$data || !is_string($data)) {
            return null;
        }

        $decoded = json_decode($data, true);

        if (!is_array($decoded)) {
            return null;
        }

        return new self($decoded);
    }
257355
public function create(array &$data = null) {
		$modelClass = $this->getModelClass();

		$model = $modelClass::factory($data);
		$model->setDatagate($this);

		if ($this->hasLocator()) {
			$model->setLocator($this->getLocator());
		}

		if (empty($data)) {
			$model->forceInsert();
		}

		return $model;
	}
260086
public function create($data)
    {
        $fileDescriptor = new FileDescriptor($data->getHash());
        $fileDescriptor->setPackage(
            $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $this->getBuilder()->getDefaultPackage()
        );

        $fileDescriptor->setName($data->getName());
        $fileDescriptor->setPath($data->getPath());
        if ($this->getBuilder()->getProjectDescriptor()->getSettings()->shouldIncludeSource()) {
            $fileDescriptor->setSource($data->getSource());
        }

        $fileDescriptor->setIncludes(new Collection($data->getIncludes()));
        $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaces()));

        $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor);
        $this->overridePackageTag($data, $fileDescriptor);

        //$this->addMarkers($data->getMarkers(), $fileDescriptor);
        $this->addConstants($data->getConstants(), $fileDescriptor);
        $this->addFunctions($data->getFunctions(), $fileDescriptor);
        $this->addClasses($data->getClasses(), $fileDescriptor);
        $this->addInterfaces($data->getInterfaces(), $fileDescriptor);
        $this->addTraits($data->getTraits(), $fileDescriptor);

        return $fileDescriptor;
    }
680768
public function create($data)
    {
        $descriptor = new TagDescriptor($data->getName());

        if ($data instanceof BaseTag) {
            $descriptor->setDescription($data->getDescription());
        }

        return $descriptor;
    }
1306346
public function resolveDataValue($data)
    {
        if ($data instanceof Data) {

            return $this->setData($data);

        } elseif (is_array($data)) {

            return $this->setData(new Data($data));
        }

        throw new \InvalidArgumentException(
            "Data must be View\Data or array value"
        );
    }
18347
public static function deserializeObject(array $data)
    {
        return new static(
            $data['type'],
            $data['name'],
            $data['description'],
            isset($data['specUri']) ? $data['specUri'] : null,
            isset($data['documentationUri']) ? $data['documentationUri'] : null
        );
    }
126243
function import($data)
    {
        if ($data === null)
            return $this;

        if (!(is_array($data) || $data instanceof \Traversable || $data instanceof \stdClass))
            throw new \InvalidArgumentException(sprintf(
                'Data must be instance of \Traversable, \stdClass or array. given: (%s)'
                , \Poirot\Std\flatten($data)
            ));

        if ($data instanceof \stdClass)
            $data = \Poirot\Std\toArrayObject($data);

        
        foreach ($data as $k => $v)
            $this->set($k, $v);

        return $this;
    }
471541
protected function createObjectFrom($data)
    {
        $class_name = $this->class_name;

        try {
            return new $class_name($data);
        } catch (\InvalidArgumentException $e) {
            throw new ConverterException(
                sprintf("Unable to create a '%s' instance.", $class_name),
                null,
                $e
            );
        }
    }
1046281
public function setData($data)
    {
        $this->data = $data;

        if (is_string($this->data)) {
            $this->data = json_decode($this->data, true);
        } else if (is_object($data)) {
            $this->data = json_decode(json_encode($this->data), true);
        } else if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf('Invalid data type in JsonStore. Expected object, array or string, got %s', gettype($data)));
        }
    }
1040263
public function getDataWrapper($data = null)
    {
        // if $data is set reconstruct the data wrapper
        if (!$this->dataWrapper || $data) {
            $this->dataWrapper = new DataWrapper\ArrayWrapper($data);
        }

        return $this->dataWrapper;
    }
1289152
public function make($data)
    {
        if (is_object($data) && $data instanceof Request) {
            return new RequestTransformer();
        }

        if (is_array($data)) {
            return new ArrayTransformer();
        }

        throw new InvalidArgumentException('An array, or an instance of Illuminate\Http\Request was expected.');
    }
974267
public function fill($data)
    {
        if (!$this->object) {
            throw new InvalidArgumentException(
                'There are no object to be mapped'
            );
        }

        if (!is_object($data)) {
            throw new InvalidArgumentException('Data should be an object');
        }

        $data = $this->extractData($data);
        $allowed = $this->extractAllowedAttributes($this->class);

        foreach ($this->class->getProperties() as $property) {
            $name = $property->getName();
            if (!in_array($name, $allowed, true)
                || !array_key_exists(
                    $name,
                    $data
                )
            ) {
                continue;
            }

            $property->setAccessible(true);
            $property->setValue($this->object, $data[$name]);
        }

        return $this->object;
    }
54319
public function unserialize(array $data)
    {
        if (!isset($data['access_token'])) {
            throw new \InvalidArgumentException('Unable to create a RawToken without an "access_token"');
        }

        $this->accessToken = $data['access_token'];
        $this->refreshToken = isset($data['refresh_token']) ? $data['refresh_token'] : null;
        $this->expiresAt = isset($data['expires_at']) ? $data['expires_at'] : null;

        return $this;
    }
1142231
public static function createFromKeyData(array $data): self
    {
        if (!isset($data['keys'])) {
            throw new InvalidArgumentException('Invalid data.');
        }
        if (!\is_array($data['keys'])) {
            throw new InvalidArgumentException('Invalid data.');
        }
        $jwkset = new self([]);
        foreach ($data['keys'] as $key) {
            $jwk = new JWK($key);
            if ($jwk->has('kid')) {
                $jwkset->keys[$jwk->get('kid')] = $jwk;
            } else {
                $jwkset->keys[] = $jwk;
            }
        }

        return $jwkset;
    }
509776
final function import($data)
    {
        if ($data === null)
            return $this;

        if (!(is_array($data) || $data instanceof \Traversable || $data instanceof \stdClass))
            throw new \InvalidArgumentException(sprintf(
                'Data must be instance of \Traversable, \stdClass or array. given: (%s) on (%s).'
                , \Poirot\Std\flatten($data), get_class($this)
            ));

        if ($data instanceof \stdClass)
            $data = \Poirot\Std\toArrayObject($data);

        $this->doSetFrom($data);

        return $this;
    }