src/TypedClass.php
public function assign($in)
	{
		$this->_massageBlockInput($in);

		if (empty($in)) {
			foreach ($this->_publicNames as $publicName) {
				$this->__unset($publicName);
			}
		}
		elseif (is_object($in)) {
			foreach ($this->_publicNames as $publicName) {
				if (isset($in->{$publicName})) {
					$this->_setByName($publicName, $in->{$publicName});
				}
				else {
					$this->__unset($publicName);
				}
			}
		}
		else {
			foreach ($this->_publicNames as $publicName) {
				if (isset($in[$publicName])) {
					$this->_setByName($publicName, $in[$publicName]);
				}
				else {
					$this->__unset($publicName);
				}
			}
		}

		$this->_checkRelatedProperties();
	}
public function assign($in)
	{
		$this->_massageBlockInput($in);

		if (empty($in)) {
			foreach ($this->_publicNames as $publicName) {
				$this->__unset($publicName);
			}
		}
		elseif (is_object($in)) {
			foreach ($this->_publicNames as $publicName) {
				if (isset($in->{$publicName})) {
					$this->_setByName($publicName, $in->{$publicName});
				}
				else {
					$this->__unset($publicName);
				}
			}
		}
		else {
			foreach ($this->_publicNames as $publicName) {
				if (isset($in[$publicName])) {
					$this->_setByName($publicName, $in[$publicName]);
				}
				else {
					$this->__unset($publicName);
				}
			}
		}

		$this->_checkRelatedProperties();
	}
Assign matching values to local keys resetting unmatched local keys.

Copies all matching property names while maintaining original types and
doing a deep copy where appropriate.
This method silently ignores extra properties in $input,
resets unmatched local properties, and
skips names starting with an underscore.

Input can be an object, or an indexed or associative array.

@param object|array|string|bool|null $in -OPTIONAL