src/SellerLabs/Nucleus/Support/Std.php
public static function callSetters(
        $object,
        array $input,
        array $allowed = null
    ) {
        $filtered = ArrayMap::of($input);

        if ($allowed !== null) {
            $filtered = $filtered->only($allowed);
        }

        $filtered->each(function ($value, $key) use (&$object) {
            $setterName = 'set' . Str::studly($key);

            $object->$setterName($value);
        });
    }
public static function callSetters(
        $object,
        array $input,
        array $allowed = null
    ) {
        $filtered = ArrayMap::of($input);

        if ($allowed !== null) {
            $filtered = $filtered->only($allowed);
        }

        $filtered->each(function ($value, $key) use (&$object) {
            $setterName = 'set' . Str::studly($key);

            $object->$setterName($value);
        });
    }
public static function callSetters ( $ object , array $ input , array $ allowed = null ) { $ filtered = ArrayMap :: of ( $ input ) ; if ( $ allowed !== null ) { $ filtered = $ filtered -> only ( $ allowed ) ; } $ filtered -> each ( function ( $ value , $ key ) use ( & $ object ) { $ setterName = 'set' . Str :: studly ( $ key ) ; $ object -> $ setterName ( $ value ) ; } ) ; }
Set properties of an object by only calling setters of array keys that
are set in the input array. Useful for parsing API responses into
entities.

@param object $object
@param array $input
@param string[]|null $allowed
Set properties of an object by only calling setters of array keys that are set in the input array . Useful for parsing API responses into entities .