Construct new object
@param string $type Name of class of object that should be constructed
@param array $data initial values of properties of new object
@return mixed new object of class $type or null if class $type does not exist
343773
public function newObject($type, array $data = [])
    {
        $type = $this->getFullType($type);
        if (class_exists($type)) {
            $table = $type::getCollection();
            return new $type($data, $this->mongodb->$table, $this->cache);
        }
        return null;
    }
642407
public function factoryFromArray(array $data, $type = null)
    {
        if ($type === null) {
            if (array_key_exists('type', $data)) {
                $type = $data['type'];
                unset($data['type']);
            } else {
                throw new \InvalidArgumentException(
                    'Parameter type not specified in ConfirmationFactory.factoryFromArray()'
                );
            }
        }
        $confirmation = $this->factory($type);
        foreach ($data as $key => $value) {
            if ($confirmation->offsetExists($key)) {
                $confirmation->offsetSet($key, $value);
            }
        }

        return $confirmation;
    }
224886
protected function createForm($type, $data = null, array $options = array())
    {
        return $this->factory->create($type, $data, $options);
    }
298166
public function create(array $data = array())
    {
        if (!isset($data["configPathPrefix"])) {
            $data["configPathPrefix"] = $this->configPathPrefix;
        }
        return $this->_objectManager->create($this->_instanceName, $data);
    }
775042
public function copy($type = null)
    {
        $builder = new Builder($this->type, $this->dogmatist, $this->parent, $this->strict);
        $this->copyData($builder);

        if ($type !== null) {
            $builder->setType($type);
        }

        return $builder;
    }
918498
public function buildTree($type, array $data)
    {
        $node = $this->resolver->resolve($type, $data);

        $fieldMap = $this->knowledge->compareFields($type, $data);


        $this->filler->fillNode($node, $fieldMap);

        return $node;
    }
203619
protected function create($data = null)
    {
        if ($this->hasMethod('__create') && is_callable([$this, '__create'])) {
            return $this->__create($data);
        }

        // notify observers about new data
        $this->notify();
    }
632380
public static function asType($type, array $data)
    {
        $converter = new TypeStringListConverter($type);
        $converter->setArraySource($data);
        return new static($converter);
    }
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;
    }
924419
public function makeInstance($class, $data)
    {
        $class = new \ReflectionClass($class);
        $constructArguments = [];
        if (isset($data['__construct'])) {
            $constructArguments = $this->constructorArgs($data['__construct']);
        }

        return $class->newInstanceArgs($constructArguments);
    }
579601
public function create( $data )
    {
        $structure = parent::create( $data );

        if ( $structure instanceof Structure\ProxyAbstract )
        {
            $structure->prepareCreate();
        }

        return $structure;
    }
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;
    }
1046498
protected function createProperty($type)
    {
        return $this->getSchema()->getFactory()->createProperty(
            [ 'type' => $type, 'name' => $this->getName().'_item', 'required' => true ],
            $this->getSchema(),
            $this
        );
    }
888479
public function create($data = [])
	{
		$created = $this->model->create($data);

		if( ! $created)
		{
			return new Payload(null, 'not_created');
		}

		return new Payload($created, 'created');
	}
1015183
public static function create($name, $type = NULL, $defaultValue = self::UNDEFINED, $modifiers = self::MODIFIER_PROTECTED) {
    if (isset($type)) {
      if ($type instanceof GClass) {
        $type = new ObjectType(new GClass($type->getFQN()));
      } elseif (!($type instanceof Type)) {
        $type = Type::create($type);
      }
    }
    
    return new static($name, $type, $defaultValue, $modifiers);
  }
909478
private function _createObjectFromData($name, $data)
    {
        try {
            $cls = new $name();
            foreach ($data as $key => $value) {
                if ($name !== 'stdClass' && !array_key_exists(strtolower($key), get_object_vars($cls))) {
                    var_dump(get_object_vars($cls));
                    continue;
                }
                $key = strtolower($key);
                $cls->$key = $value;
            }
            return $cls;
        } catch (\Exception $e) {
            return null;
        }
    }
314246
private function createInstance(string $class, array $data)
    {
        $rule = $this->rules[$class];

        $reflectionClass = new \ReflectionClass($class);
        $object = $reflectionClass->newInstanceWithoutConstructor();
        $reflectionObject = new \ReflectionObject($object);

        foreach ($rule->getMap() as $property => $key) {
            $reflectionProperty = $reflectionObject->getProperty($property);
            $reflectionProperty->setAccessible(true);

            $constructor = $rule->getConstructor($property);

            $reflectionProperty->setValue($object, is_callable($constructor) ? $constructor($data[$key]) : $data[$key]);
        }

        return $object;
    }