Creates and returns the wrapper.
Only objects are allowed to be passed, else an exception will be thrown.
Store the input object to the created wrapper.

@param $object

@return Helper
777804
public static function instance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Only objects are allowed to be passed to the helper.');
        }

        $response = new self();
        $response->origin = $object;
        $response->target = new ReflectionClass($object);
        return $response;
    }
887836
protected function adder($object)
    {
        $rel = $this;

        return function($value) use ($object, $rel) {
            return $rel->add($object, $value);
        };
    }
1301738
public static function get($object) {
        $class = $object->name;

        /** @var \Gcs\Framework\Core\Orm\Entity\Entity $class */
        $class = new $class();

        $request = Request::instance();

        if (($class->getForm() == '' && $request->data->form == true) || isset($request->data->post[$class->getForm()])) {
            switch ($request->data->method) {
                case 'get' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeInsert();
                    break;

                case 'post' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeInsert();
                    break;

                case 'put' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeUpdate();
                    break;

                case 'patch' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforePatch();
                    break;

                case 'delete' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeDelete();
                    break;
            }

            $class->check();
        }

        return $class;
    }
906918
protected static function createFromObjectForAdditional($object)
    {
        $indexProperty = null;
        $class = null;

        if (property_exists($object, 'anyOf')) {
            $indexProperty = 'anyOf';
            $class = AnyOf::class;
        } elseif (property_exists($object, 'allOf')) {
            $indexProperty = 'allOf';
            $class = AllOf::class;
        } elseif (property_exists($object, 'oneOf')) {
            $indexProperty = 'oneOf';
            $class = OneOf::class;
        } else {
            return null;
        }

        //Parse index property's object as validator
        foreach ($object->{$indexProperty} as &$property) {
            $property = BaseValidator::createFromObject($property);
        }

        $validator = new $class($object->{$indexProperty});

        return $validator;
    }
131398
public function clon(&$object=null) {
    list($object) = self::_wrapArgs(func_get_args(), 1);
    
    $clone = null;
    if(is_array($object)) $clone = (array) clone (object) $object;
    elseif(!is_object($object)) $clone = $object;
    elseif(!$clone) $clone = clone $object;
    
    // shallow copy object
    if(is_object($clone) && count($clone) > 0) {
      foreach($clone as $k=>$v) {
        if(is_array($v) || is_object($v)) $clone->$k =& $object->$k;
      }
    }
    
    // shallow copy array
    elseif(is_array($clone) && count($clone) > 0) {
      foreach($clone as $k=>$v) {
        if(is_array($v) || is_object($v)) $clone[$k] =& $object[$k];
      }
    }
    return self::_wrap($clone);
  }
1068193
protected function callMethods($object)
    {
        if (! empty($this->methods)) {
            foreach ($this->methods as $method => $args) {
                $reflection = new \ReflectionMethod($object, $method);

                $arguments = array();

                foreach ($args as $arg) {
                    if (is_string($arg) && (class_exists($arg) || $this->container->bound($arg))) {
                        $arguments[] = $this->container->resolve($arg);
                        continue;
                    }

                    $arguments[] = $arg;
                }

                $reflection->invokeArgs($object, $arguments);
            }
        }

        return $object;
    }
1239969
protected static function convert_object_to_array($object) {
	if (is_object($object) == false) {
		throw new \Exception('can only convert objects');
	}
	
	if ($object instanceof \alsvanzelf\jsonapi\resource) {
		return $object->get_array();
	}
	
	return get_object_vars($object);
}
321929
public function getPropForkObject(object $object): object {
		return $this->getObjectPropertyAccessProxy()->getValue($object) 
				?? ReflectionUtils::createObject($this->getEntityProperty(true)
						->getEmbeddedEntityPropertyCollection()->getClass());
	}
425003
public function save($object)
    {

        if (is_array($object)) {
            $objectData = $object;
            if ($object['id'] > 0) {
                $object = $this->find($object['id']);
            } else {
                $object = $this->createNewObject();
            }
            $this->assignArrayToObject($object, $objectData);
        } else if (!$this->isCorrectInstance($object)) {
            $this->addErrorMessage(self::ERROR_WRONG_OBJECT);
        }

        if (!$this->hasError()) {
            $check = $this->manager->save($object);
            if ($check) {
                $this->addSuccessMessage(self::SUCCESS_SAVED);
            }
        }

        return $object;
    }
614914
private function supports($object)
    {
        if ($object instanceof ObjectCollection) {
            return $object->isInstanceOf($this->getClass());
        } else {
            //doctrine sends proxy so we have to do the check with the instanceof operator
            $rc = new \ReflectionClass($this->getClass());
            $toCheck = $rc->newInstanceWithoutConstructor();

            return $object instanceof $toCheck;
        }
    }
978364
protected function recordObjectContent($object)
	{
		foreach ($object as $k => $v)
		{
			if ($this->canDeduplicate($v) && !$this->shouldPreserve($v))
			{
				$object[$k] = $this->recordObject($v);
			}
		}

		return $object;
	}
1238590
public function store($object)
    {
        if (!is_object($object)) {
            throw new InvalidArgumentException(1, 'object');
        }

        $objects = array();
        $id = $this->doStore($this->freezer->freeze($object, $objects));

        if ($id !== null) {
            $object->{$this->freezer->getIdProperty()} = $id;
        }

        return $object->{$this->freezer->getIdProperty()};
    }
1064979
private function withDirectObjectReference($object) : self
    {
        Assert::isObject($object, "Direct reference passed to service activator must be object");

        $this->directObjectReference = $object;

        return $this;
    }
1341169
protected function injectObjectDependencies($object)
    {
        if (count($this->injectors)) {
            $class = get_class($object);
            foreach ($this->injectors as $interface => $injector) {
                $this->trace(
                    'Call injector for "{class}" for support interface "{interface}".',
                    [
                        'class' => $class,
                        'interface' => $interface
                    ]
                );
                call_user_func($injector, $object, $this->getToolkit());
            }
        }
    }
894402
public function create(Container $object)
    {
        $sql = "INSERT INTO %1\$s (%2\$s) VALUES (%3\$s)";
        $placeholders = [];
        $values = [];
        foreach ($this->fields as $field) {
            if (property_exists($object, $field)
                && !isset($this->annotations['properties'][$field]['From'])
                && isset($object->$field)
            ) {
                $placeholders[$field] = '?';
                $values[] = $object->$field;
            }
        }
        $this->flattenValues($values);
        $sql = sprintf(
            $sql,
            $this->identifier,
            implode(', ', array_keys($placeholders)),
            implode(', ', $placeholders)
        );
        $stmt = $this->getStatement($sql);
        try {
            $retval = $stmt->execute($values);
        } catch (PDOException $e) {
            return false;
        }
        if (count($this->primaryKey) == 1) {
            $pk = $this->primaryKey[0];
            try {
                $object->$pk = $this->adapter->lastInsertId($this->identifier);
                $this->load($object);
            } catch (PDOException $e) {
                // Means this is not supported by this engine.
            }
        }
        return $retval;
    }
581303
public static function get($object) {
        /** @var \Gcs\Framework\Core\Http\Request\Form $class */
        $class = $object->name;
        $class = new $class();
        $class->init();

        $request = Request::instance();

        if (($class->getForm() == '' && $request->data->form == true) || isset($request->data->post[$class->getForm()])) {
            switch ($request->data->method) {
                case 'get' :
                    $class->get();
                    break;

                case 'post' :
                    $class->post();
                    break;

                case 'put' :
                    $class->put();
                    break;

                case 'patch' :
                    $class->patch();
                    break;

                case 'delete' :
                    $class->delete();
                    break;
            }

            $class->check();
        }

        return $class;
    }
1302434
protected function recordObject($object)
	{
		$js      = $this->encoder->encode($object);
		$varName = $this->getVarName($js);

		if ($this->isIterable($object))
		{
			$object = $this->recordObjectContent($object);
		}

		if (!isset($this->configValues[$varName]))
		{
			$this->configValues[$varName] = new ConfigValue($object, $varName);
			$this->jsLengths[$varName]    = strlen($js);
		}
		$this->configValues[$varName]->incrementUseCount();

		return $this->configValues[$varName];
	}