very quick and simplified answer :
maybe the info you have are not accurate,
maybe this song as a lot of song nowadays use paralell borrowing, modal intechanges, tritonic substitutions…
or other tricks that doesn’t play by classical harmony textbook rules.
which means for exemple : you are in E, ( = the key center is E ( the bass note that feels like “home” ) )
but to create interest / entertainement, they’ll replace ( borrow) some chords by some chords from other scales.
Pharell harmony style is heavily influenced by funk / gospel, Jazz type of harmony, which make use ( or even invented ) a lot of those tricks
Having played a lot with chord pad because i do a lot of jazzy stuff and i’m a bad piano player…
i end up very frustrated, because it is very a 1Dimension view of basic classical harmony.
if you want something that can handle this kind of chord progressions and help you undestand them better, there is a vst plugin called scaler.
in version 2, which is coming in may ( check the videos ) it is really aimed as an advanced composition tool that can handle all those “pro level” harmony tricks.
in the meantime with V1.8 ( actual version), it will at least tell you all the most likely scale that could contain this chord set
and indicates you the ones that fit perfectly and the ones that are borrowed.
but to approach this pharrel type of music ( think stevie wonder, soul funk… ) you may check some more jazz harmony theory