Solve: $$u_t=ku_{xx}, \text{ for } t>0,x>0$$ $$u(x,0)=\phi(x)\text{ for }x>0$$ $$u_x(0,t)-hu(0,t)=0 \text{ for }x=0$$, where $h$ is constant.
When $\phi(x)$ is $x$, and $h$ is $2$, we can define $f(x)=x$ for $x>0$, and $x+1-e^{2x}$ for $x<0$. And convolute it with the source function to get our solution on the whole line and restrict it on the half line. And we can check it satisfies the conditions. But what should we do when $\phi(x)$ is random functions? It is an exercise from Strauss's PDE book, section 3.1, question 5.
Recall the various kinds of reflection, all of which are based on the fact that odd functions vanish at $0$.
So, for $x<0$ you should solve the ODE $$ \phi'(x)-h\phi(x) = -\phi'(-x) + h\phi(-x), \quad x<0 $$ Integrating factor $e^{-hx}$: $$ (e^{-hx}\phi(x))' = -e^{-hx}(\phi'(-x)-h\phi(-x)),\quad x<0 $$ hence $$ \phi(x) = Ce^{hx} +e^{hx}\int_x^0 e^{-hs}(\phi'(-s)-h\phi(-s))\,ds,\quad x<0$$ Choose $C$ so that the extended function $\phi$ is continuous at $0$, that is $C=\phi(0)$. That's all there is to be done; the solution $u(x,t)$ is obtained by convolving $\phi$ with the fundamental solution in the usual way.
Sanity check: try the above approach on the specific example from exercise 4: $\phi(x)=x$ for positive $x$, $h=2$. Here $$ \phi(x) = \phi(0) e^{2x} +e^{2x}\int_x^0 e^{-2s}(1+2s)\,ds = x+1-e^{2x}, \quad x<0 $$ which agrees with exercise 4.