Section 5. If the commissioner refuses to issue a license, he shall notify the applicant of the denial, and within twenty days thereafter he shall enter upon his records a written decision and findings containing the reasons supporting the denial, and shall forthwith give written notice thereof by registered mail to the applicant. Within thirty days after the date of such notice the applicant may appeal from such denial to the superior court for the county of Suffolk, sitting in equity. The court shall hear all pertinent evidence and determine the facts, and upon the facts as so determined review said denial and, as justice and equity may require, affirm the same or order the commissioner to issue such license.