Fix warnings in case of incorrect data

If somebody pass incorrect input array to `format`, php will raise several notices, because no any checks performed before access to array indexes.
Please review.
Could you add a DocBlock here?