Planetary Formation Theory