Because $type isn't reused, more succinct to use switch(get_class($resource)) and saves an extra varable