Constructs object based on passed object.
Should be an array of attributes or a WP_Post.

@param mixed $object Array of attributes or a WP_Post.
976861
public function from_post( $object )
	{
		if ( is_array( $object ) ) {

			$this->attributes = $object;

		} else if ( is_a( $object, 'WP_Post' ) ) {

			$this->attributes = $object->to_array();

		}

		if ( ! empty( $this->attributes ) ) {

			$this->load_meta();
			
		}

		return $this;
	}
1194712
protected function createObject(ArraySerializable $object): ArraySerializable
    {
        return $this->sendRequestForEntity(
            $this->createRequest(self::POST, $this->urlRender->prepareCreateUrl($object->toArray()), [], $object->toArray())
        );
    }
277035
protected function bindContext($object = NULL)
	{
		if($object !== NULL && !is_object($object))
		{
			throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
		}
	
		$previous = $this->context;
		$this->context = $object;
	
		if($object === NULL)
		{
			$this->proxies = new \SplObjectStorage();
			
			return $previous;
		}
		
		if($this->contextualInstances->offsetExists($object))
		{
			$this->proxies = $this->contextualInstances[$object];
		}
		else
		{
			$this->proxies = new \SplObjectStorage();
			$this->contextualInstances[$object] = $this->proxies;
		}
	
		return $previous;
	}
37394
public function writeObject($object)
    {
        // Loop each element and write the name of the property.
        foreach ($object as $key => &$value) {
            // skip variables starting with an _ private transient
            if( $key[0] == "_") continue;
            $this->_stream->writeUTF($key);
            $this->writeTypeMarker($value);
        }

        // Write the end object flag
        $this->_stream->writeInt(0);
        $this->_stream->writeByte(Zend_Amf_Constants::AMF0_OBJECTTERM);
        return $this;
    }
546957
protected function doAdd($object)
    {
        $this->notifyAccess();
        $this->objectsArray[$this->total] = $object;
        $this->total++;
    }
139738
public function prepareObject($object)
    {
        $tokenList = $this->getMethodTokenList();

        for ($i = 0, $c = count($tokenList); $i < $c; $i++) {
            if ($this->reflection->hasMethod(self::SETTER_PREFIX . ucfirst($tokenList[$i]['property']))) {
                $m = self::SETTER_PREFIX . ucfirst($tokenList[$i]['property']);
                if ($tokenList[$i]['type'] == RouteMethodAnnotaionParser::TYPE_CLASS) {
                    $value = new $tokenList[$i]['value']();
                } else {
                    $value = $tokenList[$i]['value'];
                }
                $object->$m($value);
            }
        }

        return $object;
    }
948437
public static function buildArray($object) {
        $array = array();

        foreach ($object as $key => $value) {
            if (is_object($value) || is_array($value)) {
                $array[$key] = static::buildArray($value);
            } else {
                $array[$key] = static::autobox($value);
            }
        }

        return $array;
    }
379281
protected function beforeObjectIsStored($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException(sprintf('You must only pass object to this container (%s), "%s" passed as parameter!', get_called_class(), gettype($object)), __LINE__);
        }
        $instanceOf = $this->objectClass();
        if (get_class($object) !== $this->objectClass() && !$object instanceof $instanceOf) {
            throw new \InvalidArgumentException(sprintf('Model of type "%s" does not match the object contained by this class: "%s"', get_class($object), $this->objectClass()), __LINE__);
        }
    }
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;
    }
780810
static function addInstance($object){
		$name = str_replace(DS,'.',get_class($object));
		self::$instance[$name] = $object;
	}
266503
public static function set($object, $key = null) {
        if (!is_object($object)) {
            throw new InvalidObjectException('The object to register must be instantiated');
        }

        if (!$key) {
            $key = get_class($object);
        }

        static::$_registered[$key] = $object;

        return $object;
    }
725587
private function initializeFromHardcodedObject($object)
    {
        //Typecast arrays to objects
        if (is_array($object)) $object = (object)$object;

        if (!empty($object->path)) {
            $this->path = $object->path;
        }

        if (!empty($object->name)) {
            $this->name = $object->name;
        }

        if (!empty($object->class)) {
            $this->class = $object->class;
        }

        if (!empty($object->priority)) {
            $this->priority = $object->priority;
        }

        if (!empty($object->pattern)) {
            if ($object->pattern instanceof Pattern)
            {
                $this->patternString = $object->pattern->getPatternString();
                $this->pattern = $object->pattern;
            }
            else
            {
                $this->patternString = $object->pattern;
                $this->pattern = new Pattern($this->path, $this->patternString);
            }
        }

        if (!empty($object->parameters)) {
            if (is_array($object->parameters)) {
                $this->parameters = (object)$object->parameters;
            } else {
                $this->parameters = $object->parameters;
            }
        }
    }
493552
public function setObject($object)
    {
        if ( ! is_object($object))
        {
            throw new InvalidArgumentException(
                'Expected an object, but got '.gettype($object)
            );
        }

        $this->object = new ReflectionClass($object);
    }
987704
private function buildDataFromObject($object)
    {
        $result = array();

        $stack = new \SplStack();
        $stack->push($object);

        while (!$stack->isEmpty()) {
            $current = $stack->pop();
            if (is_object($current)) {
                array_push($result, $current);
            }

            foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
                if (is_object($propertyValue) || is_array($propertyValue)) {
                    $stack->push($propertyValue);
                }
            }
        }

        return $result;
    }
1047680
public function toObject(array $data, $object)
    {
        $className = $this->getFullClassName($object);
        $metadata = $this->metadataFactory->getMetadataForClass($className);
        $unserializedProperties = 0;
        foreach ($metadata->getProperties() as $property) {
            if (!$property->isExpose() || $this->propertySkipper->shouldSkip($property)) {
                if ($this->isMediumStrictUnserializeMode() && array_key_exists($property->getSerializedName(), $data)) {
                    throw new InvalidArgumentException(sprintf('%s extra field', $property->getSerializedName()));
                }
                continue;
            }

            if (!array_key_exists($property->getSerializedName(), $data)) {
                if ($this->isStrictUnserializeMode()) {
                    throw new InvalidArgumentException(sprintf('%s field is lost', $property->getSerializedName()));
                }
                continue;
            }
            $value = $this->handleValue($data[$property->getSerializedName()], $property, self::DIRECTION_UNSERIALIZE, $object);

            if ($value === $object) {
                throw new RecursionException(sprintf('Invalid self reference detected. %s::%s', $className, $property->getName()));
            }

            $this->involveValue($object, $property, $value);
            $unserializedProperties ++;
        }

        if ($this->isMediumStrictUnserializeMode() && $unserializedProperties !== count($data)) {
            throw new InvalidArgumentException('Wrong number of fields in the deserialized data');
        }

        return $object;
    }
757723
private static function objectToArrayRecursive($object) {
        if (is_object($object))
            $object = (array) $object;
        if (is_array($object)) {
            $new = array();
            foreach ($object as $key => $val) {
                $new[$key] = self::objectToArrayRecursive($val);
            }
        } else
            $new = $object;
        return $new;
    }
1055608
private function doCreateProxy($object)
    {
        $proxy = $this->factory->createProxy($object);
        /* $this in closures does not work with PHP 5.3
         * so we have to pass the object explicitely
         * with its private properties */
        $_this = $this;
        $securityContext = $this->services['security.context'];

        foreach($this->protected_classes[ClassUtils::getRealClass($object)]['methods'] as $method => $options) {
            $attribute = isset($options['attribute']) ? $options['attribute'] : false;
            $expression = isset($options['expression']) ? $options['expression'] : false;
            $returnProxy = isset($options['return_proxy']) ? $options['return_proxy'] : false;
            $denyValue = isset($options['deny_value']) ? $options['deny_value'] : null;

            if($attribute != false && $expression != false) {
                $proxy->setMethodPrefixInterceptor($method,
                    function($proxy, $instance, $methodName, $params, & $returnEarly) use ($expression, $attribute, $denyValue, $securityContext)
                    {
                        if (!($securityContext->isGranted(new Expression($expression), $instance) && $securityContext->isGranted($attribute, $instance)))  {
                            $returnEarly = true;
                            return $denyValue;
                        } else {
                            $returnEarly = false;
                            return;
                        }
                    }
                );
                continue;
            }

            if($attribute != false) {
                $proxy->setMethodPrefixInterceptor($method,
                    function($proxy, $instance, $methodName, $params, & $returnEarly) use ($attribute, $denyValue, $securityContext)
                    {
                        if (!$securityContext->isGranted($attribute, $instance)) {
                            $returnEarly = true;
                            return $denyValue;
                        } else {
                            $returnEarly = false;
                            return;
                        }
                    }
                );
                continue;
            }

            if($expression != false) {
                $proxy->setMethodPrefixInterceptor($method,
                    function($proxy, $instance, $methodName, $params, & $returnEarly) use ($expression, $denyValue, $securityContext)
                    {
                        if (!$securityContext->isGranted(new Expression($expression), $instance)) {
                            $returnEarly = true;
                            return $denyValue;
                        } else {
                            $returnEarly = false;
                            return;
                        }
                    }
                );
            }

            if($returnProxy) {
                $proxy->setMethodSuffixInterceptor($method,
                    function ($proxy, $instance, $methodName, $params, $returnValue, & $returnEarly) use ($_this)
                    {
                        if(is_object($returnValue) && $returnValue === $proxy) {
                            $returnEarly = false;
                            return;
                        } else if ($_this->isProtected($returnValue)) {
                            $returnEarly = true;
                            return $_this->getProxy($returnValue);
                        } else if (is_array($returnValue)
                            || $returnValue instanceof \Traversable
                            || $returnValue instanceof \ArrayAccess
                        ) {
                            $return = array();
                            foreach($returnValue as $element) {
                                if($_this->isProtected($element)) {
                                    $return[] = $_this->getProxy($element);
                                } else {
                                    $return[] = $element;
                                }
                            }
                            $returnEarly = true;
                            return $return;
                        }
                    }
                );
            }
        } // end foreach

        return $proxy;
    }