Class in php to detecting mime and extension