If I wanted to rebuild a form in Drupal 7, conditional on the state of the form, I would do something like this:
if (isset($form_state['values']['foo'])) {
$form['...
}
Now, $form_state
is an object in Drupal 8. What would be the best equivalent?