Creates a Descriptor from the provided data.

@param Property $data

@return PropertyDescriptor
499944
public function create($data)
    {
        $propertyDescriptor = new PropertyDescriptor();
        $propertyDescriptor->setNamespace(substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 3));
        $propertyDescriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
        $propertyDescriptor->setName($data->getName());
        $propertyDescriptor->setVisibility((string) $data->getVisibility() ?: 'public');
        $propertyDescriptor->setStatic($data->isStatic());
        $propertyDescriptor->setDefault($data->getDefault());

        $this->assembleDocBlock($data->getDocBlock(), $propertyDescriptor);
        $propertyDescriptor->setLine($data->getLocation()->getLineNumber());

        return $propertyDescriptor;
    }
841714
public function fromArray($data)
    {
        foreach ($data as $key => $val) {
            if (is_int($key)) {
                if (method_exists($this, "add")) {
                    $this->add($val);
                }
            }

            $propertyName = $key;
            $ourPropertyName = array_search($propertyName, $this->propNameMap);

            if ($ourPropertyName && isset($data[$ourPropertyName])) {
                $propertyName = $ourPropertyName;
            }

            if (!empty($this->propNameMap)) {
                if (array_key_exists($key, $this->propNameMap)) {
                    $propertyName = $this->propNameMap[$key];
                }
            }

            if (property_exists($this, $propertyName)) {
                if (isset($this->mappingClasses[$propertyName])) {
                    $this->{$propertyName} = new $this->mappingClasses[$propertyName]($val);
                } else {
                    $this->{$propertyName} = $val;
                }
            }
        }
        return $this;
    }
1351207
protected function toObject($data)
	{
		$obj = new stdClass;

		foreach ($data as $key => $datum)
		{
			if (is_array($datum))
			{
				$obj->$key = $this->toObject($datum);
			}
			else
			{
				$obj->$key = $datum;
			}
		}

		return $obj;
	}
824869
public function createReference($data)
	{
		// Get the data ready for creation.
		switch(gettype($data))
		{
			// Use an Object to update.
			case 'object':
				// Add entity type and key to creation data.
				$createData = ['entity_type' => $data->getType(), 'entity_id' => $data->getKey()];
			break;

			default:
				$createData = $data;
			break;
		}

		// Create the newly created entity's EntityIdentifier.
		return $this->aggregate[ReferenceServiceProvider::getProviderKey()]->create($createData);
	}
1229842
public function create($data)
    {
        $descriptor = new MethodDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setMethodName($data->getMethodName());
        $descriptor->setStatic($data->isStatic());

        $response = new ReturnDescriptor('return');
        $response->setType($data->getReturnType());
        $descriptor->setResponse($response);

        foreach ($data->getArguments() as $argument) {
            if (array_key_exists('name', $argument) && array_key_exists('type', $argument)) {
                $argumentDescriptor = $this->createArgumentDescriptorForMagicMethod(
                    $argument['name'],
                    $argument['type']
                );
                $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor);
            }
        }

        return $descriptor;
    }
869026
public function create($data)
    {
        $descriptor = new NamespaceDescriptor();
        $descriptor->setName($data->getName());
        $descriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
        $namespace = substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 1);
        $descriptor->setNamespace($namespace === '' ? '\\' : $namespace);

        return $descriptor;
    }
700501
public function create($data)
    {
        $classDescriptor = new ClassDescriptor();

        $classDescriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
        $classDescriptor->setName($data->getName());
        $classDescriptor->setPackage(
            $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $this->getBuilder()->getDefaultPackage()
        );
        $classDescriptor->setLine($data->getLocation()->getLineNumber());
        $classDescriptor->setParent($data->getParent());
        $classDescriptor->setAbstract($data->isAbstract());
        $classDescriptor->setFinal($data->isFinal());
        $classDescriptor->setNamespace(substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 1));

        foreach ($data->getInterfaces() as $interfaceClassName) {
            $classDescriptor->getInterfaces()->set((string) $interfaceClassName, $interfaceClassName);
        }

        $this->assembleDocBlock($data->getDocBlock(), $classDescriptor);

        $this->addConstants($data->getConstants(), $classDescriptor);
        $this->addProperties($data->getProperties(), $classDescriptor);
        $this->addMethods($data->getMethods(), $classDescriptor);
        $this->addUses($data->getUsedTraits(), $classDescriptor);

        return $classDescriptor;
    }
61727
public function make($data = null)
    {
        if (is_null($data)) {
            return new NullResource();
        } elseif (is_array($data)) {
            return static::makeFromArray($data);
        }

        $method = static::getMakeMethod($data);

        return static::$method($data);
    }
165523
protected function normalizeData( $data )
	{
		// If an object was provided, get its public properties
		if( is_object( $data )) {
			$this->data = get_object_vars( $data );
		}
		else {
			$this->data = $data;
		}

		return $this;
	}
99512
public function create($data)
    {
        $seo = new SeoViewObject();

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

        $seo->title = $data['title'];
        $seo->description = $data['description'];
        $seo->keywords = $data['keywords'];
        $seo->canonicalUrl = $data['canonicalUrl'];
        $seo->noIndex = $data['noIndex'];
        $seo->noFollow = $data['noFollow'];
        $seo->hideInSitemap = $data['hideInSitemap'];

        return $seo;
    }
1353764
protected function convertObject($data)
    {

        if ($this->isIgnoredObject($data)) {
            return;
        }

        if ($this->isXMLElement($data)) {
            return $data;
        }

        $reflection = new ReflectionObject($data);

        if ($this->isArrayAble($reflection)) {
            $data = $data->toArray();
            return $this->ensureBuildable($data);
        }

        if ($this->isCircularReference($data)) {
            return;
        }

        $out = [];

        $methods    = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
        $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);

        $this->getObjectGetterValues($methods, $data, $out);

        $this->setObjectProperties($properties, $data, $out);

        return $out;
    }
1085833
public function create($data)
    {
        $descriptor = new VarDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setVariableName($data->getVariableName());

        $types = $this->builder->buildDescriptor(
            new Collection($data->getVariableName() == '$this' ? array('$this') : $data->getTypes())
        );
        $descriptor->setTypes($types);

        return $descriptor;
    }
1310940
protected function toArrayRecursive($data)
    {
        if (is_array($data) || is_object($data)) {
            $result = [];
            foreach ($data as $key => $value) {
                if ($key === "mappingClasses" || $key === "propNameMap") {
                    continue;
                }
                $propNameMap = $key;
                $obj = $this;
                if (is_object($data)) {
                    $obj = $data;
                }

                if (property_exists($obj, $propNameMap)) {
                    $ourPropertyName = array_search($propNameMap, $obj->propNameMap);

                    if ($ourPropertyName) {
                        $propNameMap = $ourPropertyName;
                    }
                }

                if (is_object($value) && method_exists($value, "getAll")) {
                    if (method_exists($obj, 'toArrayRecursive')) {
                        $result[$propNameMap] = $obj->toArrayRecursive($value->getAll());
                    }
                } else if ($value !== null) {
                    if (method_exists($obj, 'toArrayRecursive')) {
                        $result[$propNameMap] = $obj->toArrayRecursive($value);
                    }
                }
            }
            return $result;
        }
        return $data;
    }
651358
public static function make($data = [])
    {
        // filter empty values
        $data = array_filter($data);

        // remove auto data;
        unset($data['id']);
        unset($data['created_at']);
        unset($data['updated_at']);

        //
        $model = new static($data);

        return $model;
    }
728275
public function create($data)
    {
        $functionDescriptor = new FunctionDescriptor();

        $this->mapReflectorPropertiesOntoDescriptor($data, $functionDescriptor);
        $this->assembleDocBlock($data->getDocBlock(), $functionDescriptor);
        $this->addArgumentsToFunctionDescriptor($data->getArguments(), $functionDescriptor);

        return $functionDescriptor;
    }
694575
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;
        }

        return (!is_array($descriptor) && (!$descriptor instanceof Collection))
            ? $this->filterDescriptor($descriptor)
            : $this->filterEachDescriptor($descriptor);
    }
576212
public function mergePropertyData(array $data)
    {
        $this->propertyData = array_replace($this->propertyData, $data);

        if (!$this->isMergingWidgetData) {
            $this->setCoreData($this->propertyData);
        }

        if ($this->property) {
            $this->property->setData($data);
        }

        return $this;
    }