public static function mapKey($origin, $map = [])
    {
        $result = is_array($origin) ? [] : new \stdClass();

        foreach ((array) $origin as $key => $val) {
            $newKey = self::getValue($map, $key);

            if ($newKey) {
                self::setValue($result, $newKey, $val);
            } else {
                self::setValue($result, $key, $val);
            }
        }

        return $result;
    }