@param stdClass $jsonObject

@return $this
495669
public function loadJSONObject($jsonObject)
    {
        if (isset($jsonObject->type)) {
            $this->setType($jsonObject->type);
        }
        if (isset($jsonObject->url)) {
            $this->setUrl($jsonObject->url);
        }
        if (isset($jsonObject->options)) {
            $this->setOptions($jsonObject->options);
        }
        if (isset($jsonObject->package)) {
            $package = new Package();
            $package->setName($jsonObject->package->name)
                ->setVersion($jsonObject->package->version)
                ->setDist($jsonObject->package->dist)
                ->setSource($jsonObject->package->source);

            $this->setPackage($package);
        }

        return $this;
    }
1060416
public static function initializeByObject(stdClass $Object) {
        $Receipt = new self();

        if (isset($Object->app_item_id)) {
            $Receipt->setAppItemId($Object->app_item_id);
        }

        if (isset($Object->bid)) {
            $Receipt->setBid($Object->bid);
        }

        if (isset($Object->bvrs)) {
            $Receipt->setBvrs($Object->bvrs);
        }

        if (isset($Object->product_id)) {
            $Receipt->setProductId($Object->product_id);
        }

        if (isset($Object->quantity)) {
            $Receipt->setQuantity($Object->quantity);
        }

        if (isset($Object->transaction_id)) {
            $Receipt->setTransactionId($Object->transaction_id);
        }

        if (isset($Object->original_transaction_id)) {
            $Receipt->setOriginalTransactionId($Object->original_transaction_id);
        }

        if (isset($Object->purchase_date)) {
            $Receipt->setPurchaseDate($Object->purchase_date);
        }

        if (isset($Object->original_purchase_date)) {
            $Receipt->setOriginalPurchaseDate($Object->original_purchase_date);
        }

        if (isset($Object->cancellation_date)) {
            $Receipt->setCancellationDate($Object->cancellation_date);
        }

        return $Receipt;
    }
618739
public function populateDefaultRelations(DataObject $object)
    {
        foreach ($object->hasOne() as $name => $class) {
            
            if ($id = $this->getDefaultRelation($class)) {
                $object->{$name . 'ID'} = $id;
            }
            
        }
        
        return $object;
    }
105369
public function map($json, $object)
    {
        if ($this->bEnforceMapType && !is_object($json)) {
            throw new InvalidArgumentException(
                'JsonMapper::map() requires first argument to be an object'
                . ', ' . gettype($json) . ' given.'
            );
        }
        if (!is_object($object)) {
            throw new InvalidArgumentException(
                'JsonMapper::map() requires second argument to be an object'
                . ', ' . gettype($object) . ' given.'
            );
        }

        $strClassName = get_class($object);
        $rc = new ReflectionClass($object);
        $strNs = $rc->getNamespaceName();
        $providedProperties = array();
        foreach ($json as $key => $jvalue) {
            $key = $this->getSafeName($key);
            $providedProperties[$key] = true;

            // Store the property inspection results so we don't have to do it
            // again for subsequent objects of the same type
            if (!isset($this->arInspectedClasses[$strClassName][$key])) {
                $this->arInspectedClasses[$strClassName][$key]
                    = $this->inspectProperty($rc, $key);
            }

            list($hasProperty, $accessor, $type)
                = $this->arInspectedClasses[$strClassName][$key];

            if (!$hasProperty) {
                if ($this->bExceptionOnUndefinedProperty) {
                    throw new JsonMapper_Exception(
                        'JSON property "' . $key . '" does not exist'
                        . ' in object of type ' . $strClassName
                    );
                } else if ($this->undefinedPropertyHandler !== null) {
                    call_user_func(
                        $this->undefinedPropertyHandler,
                        $object, $key, $jvalue
                    );
                } else {
                    $this->log(
                        'info',
                        'Property {property} does not exist in {class}',
                        array('property' => $key, 'class' => $strClassName)
                    );
                }
                continue;
            }

            if ($accessor === null) {
                if ($this->bExceptionOnUndefinedProperty) {
                    throw new JsonMapper_Exception(
                        'JSON property "' . $key . '" has no public setter method'
                        . ' in object of type ' . $strClassName
                    );
                }
                $this->log(
                    'info',
                    'Property {property} has no public setter method in {class}',
                    array('property' => $key, 'class' => $strClassName)
                );
                continue;
            }

            if ($this->isNullable($type) || !$this->bStrictNullTypes) {
                if ($jvalue === null) {
                    $this->setProperty($object, $accessor, null);
                    continue;
                }
                $type = $this->removeNullable($type);
            } else if ($jvalue === null) {
                throw new JsonMapper_Exception(
                    'JSON property "' . $key . '" in class "'
                    . $strClassName . '" must not be NULL'
                );
            }

            if ($type === null || $type === 'mixed') {
                //no given type - simply set the json data
                $this->setProperty($object, $accessor, $jvalue);
                continue;
            } else if ($this->isObjectOfSameType($type, $jvalue)) {
                $this->setProperty($object, $accessor, $jvalue);
                continue;
            } else if ($this->isSimpleType($type)) {
                if ($type === 'string' && is_object($jvalue)) {
                    throw new JsonMapper_Exception(
                        'JSON property "' . $key . '" in class "'
                        . $strClassName . '" is an object and'
                        . ' cannot be converted to a string'
                    );
                }
                settype($jvalue, $type);
                $this->setProperty($object, $accessor, $jvalue);
                continue;
            }

            //FIXME: check if type exists, give detailed error message if not
            if ($type === '') {
                throw new JsonMapper_Exception(
                    'Empty type at property "'
                    . $strClassName . '::$' . $key . '"'
                );
            }

            $array = null;
            $subtype = null;
            if ($this->isArrayOfType($type)) {
                //array
                $array = array();
                $subtype = substr($type, 0, -2);
            } else if (substr($type, -1) == ']') {
                list($proptype, $subtype) = explode('[', substr($type, 0, -1));
                if (!$this->isSimpleType($proptype)) {
                    $proptype = $this->getFullNamespace($proptype, $strNs);
                }
                if ($proptype == 'array') {
                    $array = array();
                } else {
                    $array = $this->createInstance($proptype, false, $jvalue);
                }
            } else {
                $type = $this->getFullNamespace($type, $strNs);
                if (is_a($type, 'ArrayObject', true)) {
                    $array = $this->createInstance($type, false, $jvalue);
                }
            }

            if ($array !== null) {
                if (!is_array($jvalue) && $this->isFlatType(gettype($jvalue))) {
                    throw new JsonMapper_Exception(
                        'JSON property "' . $key . '" must be an array, '
                        . gettype($jvalue) . ' given'
                    );
                }

                $cleanSubtype = $this->removeNullable($subtype);
                if (!$this->isSimpleType($cleanSubtype)
                    && $cleanSubtype !== null
                ) {
                    $subtype = $this->getFullNamespace($cleanSubtype, $strNs);
                }
                $child = $this->mapArray($jvalue, $array, $subtype, $key);
            } else if ($this->isFlatType(gettype($jvalue))) {
                //use constructor parameter if we have a class
                // but only a flat type (i.e. string, int)
                if ($this->bStrictObjectTypeChecking) {
                    throw new JsonMapper_Exception(
                        'JSON property "' . $key . '" must be an object, '
                        . gettype($jvalue) . ' given'
                    );
                }
                $type = $this->getFullNamespace($type, $strNs);
                $child = $this->createInstance($type, true, $jvalue);
            } else {
                $type = $this->getFullNamespace($type, $strNs);
                $child = $this->createInstance($type, false, $jvalue);
                $this->map($jvalue, $child);
            }
            $this->setProperty($object, $accessor, $child);
        }

        if ($this->bExceptionOnMissingData) {
            $this->checkMissingData($providedProperties, $rc);
        }

        return $object;
    }
709153
public function getJSONObject()
    {
        $r = new \stdClass();
        $r->name = $this->getCollectionName() !== '' ? $this->getCollectionName() : t('(No Title)');
        if ($this->isAliasPage()) {
            $r->cID = $this->getCollectionPointerOriginalID();
        } else {
            $r->cID = $this->getCollectionID();
        }
        if ($this->isExternalLink()) {
            $r->url = $this->getCollectionPointerExternalLink();
        } else {
            $r->url = (string) $this->getCollectionLink();
        }

        return $r;
    }
823362
public function setByObject(stdClass $object)
    {
        $vars = get_object_vars($object);

        if (is_array($vars)) {
            foreach ($vars as $property => $value) {
                $this->$property = $value;
            }
        }

        return $this;
    }
1118476
protected function setSerializerClass(string $serializerClass): self
    {
        assert(
            class_exists($serializerClass) === true &&
            in_array(JsonApiDataRulesSerializerInterface::class, class_implements($serializerClass)) === true
        );

        $this->serializerClass = $serializerClass;

        return $this;
    }
1080807
public function setCallbackObject($callbackObject = FALSE)
    {
        $this->callbackObject = $callbackObject;
        $this->debug->debug(__FUNCTION__, 'setCallbackObject: ' . json_encode($this->callbackObject));
    }
773995
public function createNewNode(stdClass $jsonNode) {
    $nodeClass = $this->container->getRoleFQN('NavigationNode');
    $node = new $nodeClass((array) $jsonNode->title);
    $node->generateSlugs();
    $defaultSlug = current($node->getI18nSlug());  // not matter what current language is, this is the default language

    $page = $this->createNewPage($defaultSlug);
    $this->dc->getEntityManager()->persist($page);

    $node->setPage($page);

    return $node;
  }
816662
public function getJSONObject()
    {
        $r = new \stdClass();
        $r->name = $this->getCollectionName();
        $r->cID = $this->getCollectionID();

        return $r;
    }
93338
public function setDataObjectClass($class)
    {
        if (!$class) {
            throw new InvalidArgumentException("Missing class provided");
        }

        if (!class_exists($class)) {
            throw new InvalidArgumentException("Non-existent classname \"{$class}\"");
        }

        if (!is_subclass_of($class, DataObject::class)) {
            throw new InvalidArgumentException("\"{$class}\" is not a DataObject subclass");
        }

        $this->dataObjectClass = $class;
        return $this;
    }
212505
public function newObject($entity, $jsonObject)
	{
		$retValue = array();

		if (! is_null($this->_db)){
			try{
				$mongo = $this->_db->selectCollection($entity);

				// Insert Object
				$mongo->insert($jsonObject);

				$retValue = $jsonObject;
			}
			catch(Exception $e) {
				$this->_log->addError($e->getMessage());
			}
		}

		return $retValue;
	}
881682
public function push($object): self
    {
        $this->internalDataListUpdate();
        array_push($this->internalDataListData, $object);
        return $this;
    }
221731
public function asObject($asObject = null)
    {
        if ($asObject === null)
        {
            return $this->_asObject;
        }
        $this->_asObject = $asObject;

        return $this;
    }
435271
public function setRequest(JsonRequest $request)
    {
        $this->id = $request->getId();
        $this->jsonrpc = $request->getJsonrpc();
        $this->method = $request->getMethod();
        $this->request = $request;

        if (!$request->getResponse()) {
            $request->setResponse($this);
        }

        return $this;
    }
99884
public function map($json, $object)
    {
        foreach ($json as $key => $jvalue) {
            $key = $this->getSafeName($key);
            $setter = 'set' . $this->getCamelCaseName($key);
            if (method_exists($object, $setter)) {
                $object->{$setter}($jvalue);
            }
        }

        return $object;

    }
1049661
public function withJsonResponse($class = null, DeserializationContext $context = null)
    {
        $this->responseParser = new JsonMessageParser($class, $context);

        return $this;
    }