We should avoid nesting too much. Do it the other way, say:

if ($origin === null) {
    return;
}

This avoid a large number of nesting.