Populate target object properties from source object
If $targetObject is a class name then the method first instantiates it
@param stdClass $sourceObject
@param mixed $targetObject
@param array $targetObjectCtorArgs
@return object
345809
protected function populateObject($sourceObject, $targetObject, array $targetObjectCtorArgs = array()) {
		if (is_object($targetObject)) {
			$resultObject = $targetObject;
		}
		else {
			$ref = new ReflectionClass($targetObject);
			$resultObject = $ref->newInstanceArgs($targetObjectCtorArgs);
		}

		$ref = new ReflectionClass($sourceObject);
		foreach ($ref->getProperties() as $property) {
			$name=$property->getName();
			$resultObject->$name = $sourceObject->$name;
		}

		return $resultObject;
	}
619045
public static function extend($target, $source) 
    {
        switch($target) {
        case 'phpQueryObject':
            $targetRef = &self::$extendMethods;
            $targetRef2 = &self::$pluginsMethods;
            break;
        case 'phpQuery':
            $targetRef = &self::$extendStaticMethods;
            $targetRef2 = &self::$pluginsStaticMethods;
            break;
        default:
            throw new Exception("Unsupported \$target type");
        }
        if (is_string($source)) {
            $source = array($source => $source);
        }
        foreach($source as $method => $callback) {
            if (isset($targetRef[$method])) {
                //                throw new Exception
                self::debug("Duplicate method '{$method}', can\'t extend '{$target}'");
                continue;
            }
            if (isset($targetRef2[$method])) {
                //                throw new Exception
                self::debug(
                    "Duplicate method '{$method}' from plugin '{$targetRef2[$method]}',"
                    ." can\'t extend '{$target}'"
                );
                continue;
            }
            $targetRef[$method] = $callback;
        }
        return true;
    }
797201
protected function fetchObjectFromPersistence($identity, $targetType)
    {
        if ($targetType === Thumbnail::class) {
            $object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
        } elseif (is_string($identity)) {
            $object = $this->assetRepository->findByIdentifier($identity);
        } else {
            throw new InvalidSourceException('The identity property "' . $identity . '" is not a string.', 1415817618);
        }

        return $object;
    }
84386
public function populateObject($object, \stdClass $mapped, $meta=null)
    {
        if (!$meta instanceof Meta) {
            $meta = $this->getMeta($meta ?: get_class($object));
            if (!$meta) {
                throw new \InvalidArgumentException();
            }
        }

        $properties = $meta->getProperties();
        foreach ($mapped as $prop=>$value) {
            if (!isset($properties[$prop])) {
                throw new \UnexpectedValueException("Property $prop does not exist on class {$meta->class}");
            }
            $property = $properties[$prop];
            if (!isset($property['setter'])) {
                $object->{$prop} = $value;
            }
            else {
                // false setter means read only
                if ($property['setter'] !== false) {
                    call_user_func(array($object, $property['setter']), $value);
                }
            }
        }
    }
526698
protected function find($identifiers, $targetClass)
    {
        if ($identifiers instanceof $targetClass) {
            return $identifiers;
        }

        if ($this->isNullIdentifier($identifiers)) {
            return null;
        }

        return $this->objectManager->find($targetClass, $identifiers);
    }
1336456
public function postLoad($eventArgs)
    {
        if (!method_exists($eventArgs, 'getObject')) {
            throw new \InvalidArgumentException('$eventArgs must implement a `getObject` method');
        }

        $object = $eventArgs->getObject();

        $classList = array_keys($this->externalAssociationList);
        foreach ($classList as $className) {
            if (is_a($object, $className)) {
                $blendList = $this->externalAssociationList[$className];
                foreach ($blendList as $blend) {
                    $identifier = $object->{$blend->getReferenceIdGetter()}();

                    if ($identifier) {

                        $setter = $blend->getReferenceSetter();

                        if (is_array($identifier) || $identifier instanceof Traversable) {
                            $referenceList = [];
                            foreach ($identifier as $scalarIdentifier) {
                                $referenceList[] = $blend->getReferenceManager()
                                ->getReference($blend->getReferenceClassName(), $scalarIdentifier);
                            }
                            $object->{$setter}($referenceList);

                        } else {
                            $reference = $blend->getReferenceManager()
                                ->getReference($blend->getReferenceClassName(), $identifier);

                            $object->{$setter}($reference);
                        }
                    }
                }
            }
        }
    }
791831
protected function findTargetByArguments($targetOrEvent)
    {

        if ($targetOrEvent instanceof Bus) {
            return $targetOrEvent;
        }

        if ($this->target instanceof Bus) {
            return $this->target;
        }

        if ($this->source instanceof Bus) {
            return $this->source;
        }

        throw new LogicException('No suitable source found to map event. No target passed, no target setted, source is no Bus. Giving up.');
    }
1303719
public <T> T inject(Class<T> targetClass, T targetObject) {
		try {
			doInject(targetClass, targetObject);
			return targetObject;
		} catch (ReflectiveOperationException e) {
			throw new RuntimeException(e);
		}
	}
1181822
function Object_assign(target               // @arg Object
                       /* sources ... */) { // @var_args Object - sources objects
                                            // @ret Object - return target
                                            // @desc mixin
    // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

    var args = arguments;

    for (var i = 1, iz = args.length; i < iz; ++i) {
        var source = args[i];

        if (source) {
            var keys = Object.keys(source);

            for (var k = 0, kz = keys.length; k < kz; ++k) {
                var key  = keys[k];
                var desc = Object.getOwnPropertyDescriptor(source, key);

                if (desc && desc["enumerable"]) {
                    target[key] = source[key];
                }
            }
        }
    }
    return target;
}
22947
public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL) {
		$object = $this->buildObject($convertedChildProperties, $targetType);
		foreach ($convertedChildProperties as $propertyName => $propertyValue) {
			ObjectAccess::setProperty($object, $propertyName, $propertyValue);
		}

		return $object;
	}
1163091
public function fillObjectWithRawData($targetObject, stdClass $rawData)
	{
		$this->filler->fillObjectWithRawData($targetObject, $rawData);

		return $targetObject;
	}
939511
function (source, target) {
        var tmp;
        target = target || {};
        for (var i in source) {
            if (source.hasOwnProperty(i)) {
                tmp = source[i];
                if (typeof tmp == 'object') {
                    target[i] = utils.isArray(tmp) ? [] : {};
                    utils.clone(source[i], target[i])
                } else {
                    target[i] = tmp;
                }
            }
        }
        return target;
    }
1133020
public function bindTo(string $valueObjectClass)
    {
        /** @var string|TypedObject $valueObjectClass */
        if (!is_subclass_of($valueObjectClass, IValueObject::class, true)) {
            throw InvalidArgumentException::format(
                'Invalid value object class supplied to %s: expecting subclass of %s, %s given',
                __METHOD__, IValueObject::class, $valueObjectClass
            );
        }

        $this->class = $valueObjectClass::definition();
    }
202694
public static Object getTranslatedObject(Object value, Class<?> sourceClass, Class<?> targetClass)
    {
        if (sourceClass.isAssignableFrom(Date.class))
        {
            value = PropertyAccessorHelper.fromDate(targetClass, sourceClass, value);
        }
        else
        {
            value = PropertyAccessorHelper.fromSourceToTargetClass(targetClass, sourceClass, value);
        }
        return value;
    }
345311
public static Object[] convertParams(Object[] source, Class<?>[] target) throws ConversionException {
        Object[] converted = new Object[target.length];
        for (int i = 0; i < target.length; i++) {
            converted[i] = convert(source[i], target[i]);
        }
        return converted;
    }
999962
public function getMappingFor(string $tables, string $sourceLanguage, string $targetLanguage): MappingInterface
    {
        switch ($tables) {
            case 'tl_page':
                return $this->getPageMap($sourceLanguage, $targetLanguage);
            case 'tl_article':
                return $this->getArticleMap($sourceLanguage, $targetLanguage);
            case 'tl_article.tl_content':
                return $this->getArticleContentMap($sourceLanguage, $targetLanguage);
            default:
        }
        throw new \InvalidArgumentException('Unknown table ' . $tables);
    }
1268202
public static <OriginObject, TargetObject> void append(OriginObject originObject, TargetObject targetObject) {
        if (originObject == null) {
            return;
        }
        if (targetObject == null) {
            throw new IllegalArgumentException("targetClass can't be null");
        }
        @SuppressWarnings("unchecked")
        Class<TargetObject> targetClass = (Class<TargetObject>) targetObject.getClass();
        setValue(originObject, targetObject, targetClass);

    }