and delivered him out of all his afflictions, and gave him favor and wisdom before Pharaoh, king of Egypt; and he made him ruler over Egypt and all his house.