It's basically as simple as a buck converter that reduces the incoming voltage.
Phone batteries need either 4.2V or 4.35V to charge fully, so whatever voltage comes in (5-20V typically) at whatever current, gets reduced down to the correct voltage and current to charge the battery.
Phone batteries need either 4.2V or 4.35V to charge fully, so whatever voltage comes in (5-20V typically) at whatever current, gets reduced down to the correct voltage and current to charge the battery.