@param mixed $object

@throws \InvalidArgumentException
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);
        }
    }
1304742
public static function reset($object)
	{
		if (!($object instanceof Location)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\SourceCodeInfo\Location.');
		}
		$object->path = NULL;
		$object->span = NULL;
		$object->leadingComments = NULL;
		$object->trailingComments = NULL;
		$object->leadingDetachedComments = NULL;
	}
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
204474
public function extract($object)
    {
        if (!$object instanceof TicketSubject) {
            throw new \InvalidArgumentException('$object must be an instance of TicketSubject');
        }
        /* @var $object TicketSubject */
        $data = parent::extract($object);

        return $data;
    }
535942
public function offsetGet($object)
    {
        if (!$object instanceof AnObjectHandlable) {
            throw new InvalidArgumentException('Object needs to implement AnObjectHandlable');
        }

        return $this->_object_set->offsetGet($object->getHandle());
    }
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;
    }
921028
public function preparePersistChangeSet($object) : array
    {
        if (! $object instanceof PersistableInterface) {
            throw new InvalidArgumentException(
                sprintf('%s must implement PersistableInterface.', get_class($object))
            );
        }

        return $object->preparePersistChangeSet();
    }
727708
public function transform($object)
    {
        if (null === $object) {
            return;
        }

        if (!(is_array($object) || $object instanceof \Traversable)) {
            throw new \InvalidArgumentException(sprintf(
                'Traversable element expected, %s given',
                is_object($object) ? get_class($object) : gettype($object)
            ));
        }

        $result = [];
        foreach ($object as $key => $item) {
            $result[$key] = $this->transformer->transform($item);
        }

        return $result;
    }
649488
public function remove($object) : void
    {
        $hash = spl_object_hash($object);

        unset($this->objects[$hash]);
        unset($this->data[$hash]);
    }
819536
public function attach($object)
    {
        $this->checkType($object);

        if (gettype($object) !== 'object') {
            $msg = "You can only attach 'objects' into an AbstractCollection, '" . gettype($object) . "' given";
            throw new InvalidArgumentException($msg);
        } elseif (!$this->contains($object)) {
            $this->offsetSet(null, $object);
        }
    }
106588
public function setParent($object) {
		
		if (! is_object($object)) {
			throw new \InvalidArgumentException("Expecting object, given: ".gettype($object));
		}
		
		$this->parent = $object;
		return $this;
	}
646921
public function populate($object, array $data)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('The first param should be a object.');
        }

        if ($object instanceof Array2ObjectInterface) {
            $object->__populate($data);
        } else {
            //this static cache is helpful when populate
            //many objects of the same type in a loop
            static $matcherCache = [];
            static $writerCache = [];

            $objectClass = get_class($object);
            $properties = Utils::getClassProperties($objectClass);
            foreach ($properties as $property) {
                //save in cache if the property is writable
                $writableCacheHash = $objectClass.$property->getName();
                if (!isset($writerCache[$writableCacheHash])) {
                    $writerCache[$writableCacheHash] = $this->context->getWriter()->isWritable($object, $property->getName());
                }
                foreach ($data as $key => $value) {
                    //save in cache if the property name match with key
                    $propHash = $objectClass.$property->getName().$key;
                    if (!isset($matcherCache[$propHash])) {
                        $matcherCache[$propHash] = $this->context->getMatcher()->match($property, $key);
                    }

                    if ($writerCache[$writableCacheHash] && $matcherCache[$propHash]) {
                        $types = Utils::getPropertyTypes($property);
                        $value = $this->parseValue($value, $types, $property, $object);
                        $this->context->getWriter()->setValue($object, $property->getName(), $value);
                    }
                }
            }
        }
    }
830022
public static function reset($object)
	{
		if (!($object instanceof NamePart)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\UninterpretedOption\NamePart.');
		}
		$object->namePart = NULL;
		$object->isExtension = NULL;
	}
480651
public static function reset($object)
	{
		if (!($object instanceof CodeGeneratorRequest)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\Compiler\CodeGeneratorRequest.');
		}
		$object->fileToGenerate = NULL;
		$object->parameter = NULL;
		$object->protoFile = NULL;
	}
991235
public static function reset($object)
	{
		if (!($object instanceof ServiceOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\ServiceOptions.');
		}
		$object->deprecated = NULL;
		$object->uninterpretedOption = NULL;
	}
1198671
public function registerInstance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('registerInstance(): Cannot pass primitive types, can only register an object instance; use registerVariable() instead');
        }

        $reflectionObject = new \ReflectionObject($object);
        $className = $reflectionObject->getName();

        // Register strong link in $instance
        $this->instances[$className] = $object;

        // Recursively determine and register weak links
        $determineParent = function (\ReflectionClass $class) use ($className, &$determineParent) {
            $parentClass = $class->getParentClass();

            if (!empty($parentClass)) {
                $this->weakLinks[$parentClass->getName()] = $className;
                $determineParent($parentClass);
            }
        };

        $determineParent($reflectionObject);
    }
664516
public function setContentObject($contentObject)
    {
        if (!is_object($contentObject)) {
            throw new \InvalidArgumentException('Argument must be an object, ' . \gettype($contentObject) . ' given.', 1283522467);
        }
        if ($this->contentObjectProxy === null || $this->contentObjectProxy->getObject() !== $contentObject) {
            $this->contentObjectProxy = new ContentObjectProxy($contentObject);
            $this->addOrUpdate();
        }
    }