Theorem 1.17 of Emily Riehl's Factorization Systems says that given a class of maps $\mathcal M$, $\mathcal M^\perp$ is closed under limits and dually $^\perp\mathcal M$ is closed under colimits.
The argument for the former is as follows.
Given two arrows $e,m$, the square below always commutes.
$$\require{AMScd} \begin{CD} \mathsf{Hom}(B,X) @>{e^\ast}>> \mathsf{Hom}(A,X)\\ @V{m_\ast}VV @VV{m_\ast}V\\ \mathsf{Hom}(B,Y) @>>{e^\ast}> \mathsf{Hom}(A,Y) \end{CD}$$
This assignment is functorial in $e,m$, yielding a functor
$$S:(\mathsf C^\text{op})^2\times \mathsf C^2\longrightarrow \mathsf{Set}^{2\times 2}$$
that is continuous in each variable. $m\in \mathcal M^\perp$ iff $S(e,m)$ is a pullback for all $e\in M$. The full subcategory of the codomain spanned by pullback squares is closed under limits, completing the proof.
Why is $S$ continuous in each variable? Why is the stated full subcategory closed under limits?
I'm guessing the former has to do with Yoneda and the latter is simply commutation of limits with limits, but I'd like to make sure.
Added. Having already received an answer (which conflicts with the stated theorem), I asked to have this question migrated to MO in order to receive more input. I'm hesitant to accept the author has stated a false theorem, but do not see why $S$ is continuous in each variable.
Added. Am I correct in saying moreover that Theorem 1.17 holds in prefactorization systems in general?