Whenever the Mayor shall deem it necessary for the protection and welfare of the inhabitants of the city, he or she shall issue an order requiring all dogs kept within the city to be effectively muzzled for such length of time as may be specified in the order, to prevent them from biting or injuring persons or animals. Such order shall be published in the official newspaper of the city for such period of time as the Mayor may deem necessary.