Parses the data for this element

@param mixed $object The data

@throws ValidationException
338916
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Meta has to be an object, "' . gettype($object) . '" given.');
        }

        $object_vars = get_object_vars($object);

        if (count($object_vars) === 0) {
            return;
        }

        foreach ($object_vars as $name => $value) {
            $this->set($name, $value);
        }
    }
386638
private function validateUnderlyingObjectType($object)
    {
        if (count($this->mustBeInstanceOf) == 0) {
            return true;
        }
        foreach ($this->mustBeInstanceOf as $instance) {
            if ($object instanceof $instance) { //|| $object->asa($instance) !== null
                return true;
            }
        }
        Yii::error('Got invalid underlying object type! (' . $object->className() . ')');
        return false;
    }
1018430
public function isValueObject($object)
    {
        if (!is_string($object)) {
            $object = get_class($object);
        }

        return array_key_exists($object, $this->valueClasses);
    }
300284
protected function validateAttribute($object, $attribute)
    {
        $value = $object->{$attribute};
        if ($this->isEmpty($value)) {
            $this->validateEmpty($object, $attribute);
            return;
        }
        if (
            (!$this->strict && $value != $this->trueValue && $value != $this->falseValue)
            || ($this->strict && $value !== $this->trueValue && $value !== $this->falseValue)
        ) {
            $this->addError($object, $attribute, $this->message, [
                '{true}' => $this->trueValue,
                '{false}' => $this->falseValue,
            ]);
        }
    }
1009892
public static function validate_object($object) {
		$pattern = '/^\//';
		if (empty ( $object ) || ! preg_match ( $pattern, $object )) {
			return false;
		}
		return true;
	}
1000692
private static function validateArray(array $object): bool
    {
        return (count($object) === 2)
            && (isset($object[0]))
            && (is_object($object[0]))
            && (isset($object[1]))
            && (is_string($object[1]))
            && ($object[0] instanceof $object[1]);
    }
955500
private function validateDataType($object, string $path)
    {
        if (!is_object($object)) {
            $exception = SerializerLogicException::createWrongDataType(gettype($object), $path);

            $this->logger->error('serialize: {exception}', ['exception' => $exception->getMessage()]);

            throw $exception;
        }
    }
585808
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Relationship has to be an object, "' . gettype($object) . '" given.');
        }

        if (! property_exists($object, 'links') and ! property_exists($object, 'data') and ! property_exists($object, 'meta')) {
            throw new ValidationException('A Relationship object MUST contain at least one of the following properties: links, data, meta');
        }

        if (property_exists($object, 'data')) {
            if ($object->data === null) {
                $this->set('data', $object->data);
            } elseif (is_array($object->data)) {
                $this->set('data', $this->create('ResourceIdentifierCollection', $object->data));
            } else {
                $this->set('data', $this->create('ResourceIdentifier', $object->data));
            }
        }

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }

        // Parse 'links' after 'data'
        if (property_exists($object, 'links')) {
            $this->set('links', $this->create('RelationshipLink', $object->links));
        }
    }
604497
public function extract($object)
    {
        if (!$object instanceof DownloadList) {
            throw new Exception('$object must be an instance of Downloadlist');
        }
        /* @var $object DownloadList */
        $data = parent::extract($object);

        return $data;
    }
1329506
private function isValidObjectInstance($object)
    {
        if (!is_null($this->classname) && !$this->isInstanceOrSubclassOf($object)) {
            return false;
        }

        return true;
    }
882655
private function parseResource($data)
    {
        if (! is_object($data)) {
            throw new ValidationException('Resources inside a collection MUST be objects, "' . gettype($data) . '" given.');
        }

        $object_vars = get_object_vars($data);

        // the 2 properties must be type and id
        // or the 3 properties must be type, id and meta
        if (count($object_vars) === 2 or (count($object_vars) === 3 and property_exists($data, 'meta'))) {
            $resource = $this->create('ResourceIdentifier', $data);
        } else {
            $resource = $this->create('ResourceItem', $data);
        }

        return $resource;
    }
259313
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException(
                'Error has to be an object, "' . gettype($object) . '" given.'
            );
        }

        if (property_exists($object, 'id')) {
            if (! is_string($object->id)) {
                throw new ValidationException(
                    'property "id" has to be a string, "' .
                    gettype($object->id) . '" given.'
                );
            }

            $this->set('id', strval($object->id));
        }

        if (property_exists($object, 'links')) {
            $this->set('links', $this->create('ErrorLink', $object->links));
        }

        if (property_exists($object, 'status')) {
            if (! is_string($object->status)) {
                throw new ValidationException(
                    'property "status" has to be a string, "' .
                    gettype($object->status) . '" given.'
                );
            }

            $this->set('status', strval($object->status));
        }

        if (property_exists($object, 'code')) {
            if (! is_string($object->code)) {
                throw new ValidationException(
                    'property "code" has to be a string, "' .
                    gettype($object->code) . '" given.'
                );
            }

            $this->set('code', strval($object->code));
        }

        if (property_exists($object, 'title')) {
            if (! is_string($object->title)) {
                throw new ValidationException(
                    'property "title" has to be a string, "' .
                    gettype($object->title) . '" given.'
                );
            }

            $this->set('title', strval($object->title));
        }

        if (property_exists($object, 'detail')) {
            if (! is_string($object->detail)) {
                throw new ValidationException(
                    'property "detail" has to be a string, "' .
                    gettype($object->detail) . '" given.'
                );
            }

            $this->set('detail', strval($object->detail));
        }

        if (property_exists($object, 'source')) {
            $this->set('source', $this->create('ErrorSource', $object->source));
        }

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }
    }
519478
public function getObjectValidator($object)
    {
        $class = get_class($object);
        if (!isset($this->validators[ $class ])) {
            $this->validators[ $class ] = $this->reader->getObjectValidator($object);
        }

        return $this->validators[ $class ];
    }
695793
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Resource has to be an object, "' . gettype($object) . '" given.');
        }

        if (! property_exists($object, 'type')) {
            throw new ValidationException('A resource object MUST contain a type');
        }

        if (! property_exists($object, 'id')) {
            throw new ValidationException('A resource object MUST contain an id');
        }

        if (is_object($object->type) or is_array($object->type)) {
            throw new ValidationException('Resource type cannot be an array or object');
        }

        if (is_object($object->id) or is_array($object->id)) {
            throw new ValidationException('Resource Id cannot be an array or object');
        }

        $this->set('type', strval($object->type));
        $this->set('id', strval($object->id));

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }
    }
444878
protected function checkRules($object)
    {
        $this->assertTrue(property_exists($object, 'rules'));

        $this->assertInternalType('array', $object->rules);

        foreach ($object->rules as $rule) {
            $this->checkRule($rule);
        }
    }
1242006
public static function parse_object_id( $object ) {
		if ( is_numeric( $object ) && $object > 0 ) {
			return (int) $object;
		} elseif ( ! empty( $object->ID ) ) {
			return (int) $object->ID;
		} elseif ( ! empty( $object->term_id ) ) {
			return (int) $object->term_id;
		} elseif ( $object instanceof WP_Object ) {
			return $object->get_id();
		}
	}
760144
protected function validate($object): void
    {
        $needType = $this->type();

        if (!$object instanceof $needType) {
            throw new \InvalidArgumentException("Element " . get_class($object) . " must be instance of " . $needType);
        }
    }