Let $A\subset X$ be a subspace. Then the inclusion $i:A\to X$ is a cofibration iff $(A\times I) \cup (X\times \{0\})$ is a retract of $X\times I$.
I've proved the "$\implies$" direction.
“$\impliedby$“: Suppose that $H: X\times I \to Y = (A\times I) \cup (X\times \{0\}$ is a retraction.
We want to show that $i:A\to X$ is a cofibration. It suffices to show that $i$ has the HEP w.r.t. the mapping cylinder $S(i) = \left( A\times I \sqcup X \right)/(a,0)\sim i(a)$. But $S(i)$ is precisely the space $Y$. So we want to verify that $i$ has the HEP w.r.t. $Y$.
Let $f:X\to Y$ be some map and $h:A\times I \to Y$ some homotopy such that $h_0 = f \circ i$. Our retraction $H$ might be a good candidate to fulfil the required conditions, namely that $H(x,0) = f(x)$ and $H(a,t) = h(a,t)$. Since $H$ restricts to the identity on $Y$, we require that $f(x) = (x,0)$ and $h(a,t) = (a,t)$. I don’t see why this requirement would be fulfilled.
What else can we do?