public function execute(UserSessionInterface $userSession)
    {
        foreach ($userSession->getConfiguration()->getQuestions() as $key => $question) {
            /** @var TemplateInterface $template */
            $template = new $this->answerTemplate;
            $template->setQuestion($question);

            if (is_null($data = $userSession->getConfiguration()->getAnswers()->get($key))) {
                $this->score->addNotValid();
                $this->data->add($template);
                continue;
            }

            $template->setFlag(isset($data['flag']) ? $data['flag'] : false);
            unset($data['flag']);
            $isValid = $this->checker->get($question->getType())->validate($data, $question, $this->score);
            $template->setValid($isValid);

            $this->data->add($template);
        }

        return $this;
    }
public function execute(UserSessionInterface $userSession)
    {
        foreach ($userSession->getConfiguration()->getQuestions() as $key => $question) {
            /** @var TemplateInterface $template */
            $template = new $this->answerTemplate;
            $template->setQuestion($question);

            if (is_null($data = $userSession->getConfiguration()->getAnswers()->get($key))) {
                $this->score->addNotValid();
                $this->data->add($template);
                continue;
            }

            $template->setFlag(isset($data['flag']) ? $data['flag'] : false);
            unset($data['flag']);
            $isValid = $this->checker->get($question->getType())->validate($data, $question, $this->score);
            $template->setValid($isValid);

            $this->data->add($template);
        }

        return $this;
    }
public function execute ( UserSessionInterface $ userSession ) { foreach ( $ userSession -> getConfiguration ( ) -> getQuestions ( ) as $ key => $ question ) { /** @var TemplateInterface $template */ $ template = new $ this -> answerTemplate ; $ template -> setQuestion ( $ question ) ; if ( is_null ( $ data = $ userSession -> getConfiguration ( ) -> getAnswers ( ) -> get ( $ key ) ) ) { $ this -> score -> addNotValid ( ) ; $ this -> data -> add ( $ template ) ; continue ; } $ template -> setFlag ( isset ( $ data [ 'flag' ] ) ? $ data [ 'flag' ] : false ) ; unset ( $ data [ 'flag' ] ) ; $ isValid = $ this -> checker -> get ( $ question -> getType ( ) ) -> validate ( $ data , $ question , $ this -> score ) ; $ template -> setValid ( $ isValid ) ; $ this -> data -> add ( $ template ) ; } return $ this ; }
Parse questionnaire results

@param UserSessionInterface $userSession

@return $this
Parse questionnaire results