Direct metaphor is: “Denmark’s a prison.”
Implied metaphor is: In Act 1, Scene 5, Hamlet urges ghost to let him know quickly so that he could avenge upon his father’s murderer and thus acts as an avenging angel. His words “wings as swift” and “sweep to my revenge” he imagines like an angel taking revenge of his father’s death.
Extended metaphor is: “Tis an unweeded garden that grows to seed. Things rank and gross in nature possess it merely.”
In the following lines, Hamlet sees the kingdom as decaying garden due to corrupt reign of Claudius and “weeds” start sprouting due to neglect and impotent husbandry and incompetent ruling.