original_string: public function isValid(HTML_QuickForm2_Controller_Page $reference = null)
      {
          $container = $this->getSessionContainer();
          foreach ($this->pages as $id => $page) {
              if ($reference === $page) {
                  return true;
              }
              if (!$container->getValidationStatus($id)) {
                  // We should handle the possible situation when the user has never
                  // seen a page of a non-modal multipage form
                  if (!$this->isWizard()
                      && null === $container->getValidationStatus($id)
                  ) {
                      // Empty Session datasource makes the form look submitted
                      $page->getForm()->setDatasources(array_merge(
                          $container->getDatasources(),
                          array(new HTML_QuickForm2_DataSource_Session(array()))
                      ));
                      // This will store the "submitted" values in session and
                      // return validation status
                      if ($page->storeValues()) {
                          continue;
                      }
                  }
                  return false;
              }
          }
          return true;
      }
code: public function isValid(HTML_QuickForm2_Controller_Page $reference = null)
      {
          $container = $this->getSessionContainer();
          foreach ($this->pages as $id => $page) {
              if ($reference === $page) {
                  return true;
              }
              if (!$container->getValidationStatus($id)) {
                  // We should handle the possible situation when the user has never
                  // seen a page of a non-modal multipage form
                  if (!$this->isWizard()
                      && null === $container->getValidationStatus($id)
                  ) {
                      // Empty Session datasource makes the form look submitted
                      $page->getForm()->setDatasources(array_merge(
                          $container->getDatasources(),
                          array(new HTML_QuickForm2_DataSource_Session(array()))
                      ));
                      // This will store the "submitted" values in session and
                      // return validation status
                      if ($page->storeValues()) {
                          continue;
                      }
                  }
                  return false;
              }
          }
          return true;
      }
code_tokens: public function isValid ( HTML_QuickForm2_Controller_Page $ reference = null ) { $ container = $ this -> getSessionContainer ( ) ; foreach ( $ this -> pages as $ id => $ page ) { if ( $ reference === $ page ) { return true ; } if ( ! $ container -> getValidationStatus ( $ id ) ) { // We should handle the possible situation when the user has never // seen a page of a non-modal multipage form if ( ! $ this -> isWizard ( ) && null === $ container -> getValidationStatus ( $ id ) ) { // Empty Session datasource makes the form look submitted $ page -> getForm ( ) -> setDatasources ( array_merge ( $ container -> getDatasources ( ) , array ( new HTML_QuickForm2_DataSource_Session ( array ( ) ) ) ) ) ; // This will store the "submitted" values in session and // return validation status if ( $ page -> storeValues ( ) ) { continue ; } } return false ; } } return true ; }
docstring: Checks whether the pages of the controller are valid
  
  @param  HTML_QuickForm2_Controller_Page   If given, check only the pages
  before (not including) that page
  @return bool
docstring_tokens: Checks whether the pages of the controller are valid