/** * Assign Properties * * Set/Update properties on the object using a key/value array * * @example * Object::assign(['value' => 'hi!'], new stdClass); * // object(stdClass)#1 (1) { * // ["value"]=> * // string(3) "hi!" * // } * * @type array props -> Object objOriginal -> Object objUpdated * * @param $props * @param $objOriginal * @return mixed */ protected static function __assign($props, $objOriginal) { $obj = clone $objOriginal; /** @noinspection PhpParamsInspection */ return Arrays::foldl(function ($obj, $setter) { return $setter($obj); }, $obj, Arrays::mapIndexed(Lambda::flip(self::setProp()), $props)); }
/** * Any * * Returns true given any values are truthy * * @example * Logic::any(true, false); // True * * @example * Logic::any(false, false); // False * * @type array -> Bool * * @param array $arr Values to test * @return Bool are any values truthy */ protected static function __any($arr) { /** @noinspection PhpParamsInspection */ return Arrays::foldl(self::logicalOr(), false, $arr); }