当前位置: 首页>>代码示例>>PHP>>正文


PHP Questionnaire::getEating方法代码示例

本文整理汇总了PHP中TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::getEating方法的典型用法代码示例。如果您正苦于以下问题:PHP Questionnaire::getEating方法的具体用法?PHP Questionnaire::getEating怎么用?PHP Questionnaire::getEating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire的用法示例。


在下文中一共展示了Questionnaire::getEating方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->builder = new NarrativeBuilder();
     $person = new Person();
     $person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
     $this->questionnaire = new Questionnaire($person);
     $this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
     $this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(35)->setCompletedDate(new \DateTime());
     $this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
     $this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
     $this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DRINK_TWO_TO_FOUR_TIMES_A_MONTH)->setBingingFrequency(Drinking::BINGE_L_T_MONTHLY)->setCompletedDate(new \DateTime());
     $moving = array('mon' => 30, 'wed' => 30, 'fri' => 30, 'sun' => 30);
     $this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:14,代码来源:IGetAGreenNarrativeWithAScoreOfEightTest.php

示例2: setUp

 public function setUp()
 {
     $this->builder = new NarrativeBuilder();
     $person = new Person();
     $person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
     $this->questionnaire = new Questionnaire($person);
     $this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
     $this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(80)->setCompletedDate(new \DateTime());
     $this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
     $this->questionnaire->getSmoking()->setDoYouSmoke('yes')->setCompletedDate(new \DateTime());
     $this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DO_NOT_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed, thur, fri, sat, sun')->setCompletedDate(new \DateTime());
     $moving = array('mon' => 30, 'tue' => 30, 'wed' => 30, 'thur' => 30, 'fri' => 30, 'sat' => 30, 'sun' => 30);
     $this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:14,代码来源:IGetARedRagAndScoreOfThreeBecauseISmokeTest.php

示例3: setUp

 public function setUp()
 {
     $this->builder = new NarrativeBuilder();
     $person = new Person();
     $person->setGender('female')->setAge('40')->setFirstName(uniqid('FN_'));
     $this->questionnaire = new Questionnaire($person);
     $this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
     $this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(35)->setCompletedDate(new \DateTime());
     $this->questionnaire->getEating()->setDrinksChoice('sugary drink')->setBreakfastChoice('sugary cereal')->setCheeseChoice('hard cheese')->setProteinChoice('ham')->setFruitAndVegChoice('0')->setPotatoesChoice('chips')->setDailySnackChoice('sweets, crisps, cake, biscuits')->setCompletedDate(new \DateTime());
     $this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
     $drinks = (new Drinks())->setBeerCiderPintAmount(5)->setBeerCiderBottleAmount(5);
     $this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('thur, fri, sat')->setWeekendDrinks($drinks)->setWeekdayDrinks($drinks)->setCompletedDate(new \DateTime());
     $moving = array('mon' => 40, 'tue' => 40, 'wed' => 40, 'sun' => 40);
     $this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:IGetAnAmberNarrativeWithAScoreOfFiveTest.php

示例4: setUp

 public function setUp()
 {
     $this->builder = new NarrativeBuilder();
     $person = new Person();
     $person->setGender('female')->setAge('40')->setFirstName(uniqid('FN_'));
     $this->questionnaire = new Questionnaire($person);
     $this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
     $this->questionnaire->getAboutYou()->getFeelings()->setWeight(0)->setCompletedDate(new \DateTime());
     $this->questionnaire->getEating()->setDrinksChoice('sugary drink')->setBreakfastChoice('sugary cereals')->setCheeseChoice('hard cheese')->setProteinChoice('ham')->setFruitAndVegChoice('0')->setPotatoesChoice('chips')->setDailySnackChoice('cake, biscuits, crisps, sweets')->setCompletedDate(new \DateTime());
     $this->questionnaire->getSmoking()->setDoYouSmoke('yes')->setCompletedDate(new \DateTime());
     $drinks = new Drinks();
     $drinks->setBeerCiderPintAmount(5)->setWineAmount(3)->setSpiritsAmount(5)->setCompletedDate(new \DateTime());
     $this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed, thur, fri, sat, sun')->setWeekendDrinks($drinks)->setWeekdayDrinks($drinks)->setCompletedDate(new \DateTime());
     $this->questionnaire->getMoving()->setCompletedDate(new \DateTime());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:IGetARedNarrativeWithAScoreOfOneTest.php

示例5: setUp

 public function setUp()
 {
     $this->builder = new NarrativeBuilder();
     $person = new Person();
     $person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
     $this->questionnaire = new Questionnaire($person);
     $this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
     $this->questionnaire->getAboutYou()->getFeelings()->setEnergy(30)->setFatigue(30)->setMood(30)->setFitness(30)->setStress(30)->setWeight(0)->setCompletedDate(new \DateTime());
     $this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
     $this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
     $drinks = new Drinks();
     $drinks->setBeerCiderPintAmount(2);
     $this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWeekdayDrinks($drinks)->setWeekendDrinks($drinks)->setWhichDaysDoYouDrink('mon,  wed, fri, sun')->setCompletedDate(new \DateTime());
     $this->questionnaire->getMoving()->setCompletedDate(new \DateTime());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:IGetAnAmberNarrativeWithAScoreOfSevenTest.php

示例6: testCompletedSectionsButNoQuestionnaireDate

 public function testCompletedSectionsButNoQuestionnaireDate()
 {
     $this->instance->getDrinking()->setCompletedDate(new \DateTime());
     $this->instance->getEating()->setCompletedDate(new \DateTime());
     $this->instance->getMoving()->setCompletedDate(new \DateTime());
     $this->instance->getSmoking()->setCompletedDate(new \DateTime());
     $this->assertTrue($this->instance->isCompleted());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:8,代码来源:QuestionnaireTest.php

示例7: testIGetARedMessageWithSnacksWarningEating

 public function testIGetARedMessageWithSnacksWarningEating()
 {
     $questionnaire = new Questionnaire(new Person());
     $questionnaire->getEating()->setProteinChoice('ham')->setCheeseChoice('hard cheese')->setPotatoesChoice('chips')->setDailySnackChoice('sweets, crisps, biscuits, cake')->setCompletedDate(new \DateTime());
     $questionnaire->getAboutYou()->getFeelings()->setWeight(25);
     $expected = array('eating' => array('eating_red', 'eating_red_low_weight'));
     $this->assertEquals($expected, $this->instance->buildNarrative($questionnaire)->getMessages());
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:8,代码来源:EatingNarrativeBuilderTest.php

示例8: testExtractEating

 public function testExtractEating()
 {
     $expectedKeys = array("eatingProteinChoice", "eatingDrinksChoice", "eatingPotatoesChoice", "eatingBreakfastChoice", "eatingCheeseChoice", "eatingFruitAndVegChoice", "eatingDailySnackChoice", "eatingComplete", "eatingRag");
     $questionnaire = new Questionnaire(new Person());
     $export = EatingHelper::extractEating($questionnaire->getEating());
     foreach ($expectedKeys as $key) {
         $this->assertArrayHasKey($key, $export);
     }
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:9,代码来源:EatingHelperTest.php

示例9: testIGetAnGreenRagWithMaxVeg

 public function testIGetAnGreenRagWithMaxVeg()
 {
     $person = new Person();
     $questionnaire = new Questionnaire($person);
     $eating = $questionnaire->getEating();
     $eating->setFruitAndVegChoice(5)->setCompletedDate(new \DateTime());
     $rag = $this->instance->calculateScore($questionnaire);
     $this->assertEquals(EatingScore::RAG_GREEN, $rag['rag']);
     $this->assertEquals(EatingScore::SCORE_GREEN, $rag['value']);
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:10,代码来源:EatingScoreTest.php

示例10: extractEatingChoices

 /**
  * @param Questionnaire $questionnaire
  */
 protected function extractEatingChoices(Questionnaire $questionnaire)
 {
     $score = 0;
     $score += $this->calculateProteinChoice($questionnaire->getEating());
     $score += $this->calculateDrinksChoice($questionnaire->getEating());
     $score += $this->calculatePotatoesChoice($questionnaire->getEating());
     $score += $this->calculateBreakfastChoice($questionnaire->getEating());
     $score += $this->calculateCheeseChoice($questionnaire->getEating());
     $score += $this->calculateFruitAndVegChoice($questionnaire->getEating());
     $score += $this->calculateSnacksChoice($questionnaire->getEating());
     $this->generateScore($score);
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:EatingScore.php

示例11: generateScore

 /**
  * @param Questionnaire $questionnaire
  * @return int
  */
 protected function generateScore(Questionnaire $questionnaire)
 {
     $result = 0;
     $result += $questionnaire->getDrinking()->getRagScore()['value'];
     $result += $questionnaire->getMoving()->getRagScore()['value'];
     $result += $questionnaire->getEating()->getRagScore()['value'];
     $result += $questionnaire->getSmoking()->getRagScore()['value'];
     if ($questionnaire->getSmoking()->getRagScore()['rag'] === RagScore::RAG_RED) {
         if ($result > self::RED_CUTOFF) {
             return self::RED_CUTOFF;
         }
     }
     return $result;
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:18,代码来源:QuestionnaireScore.php

示例12: testIGetANonEmptyResultsNarrativeOnACompleteQuiz

 public function testIGetANonEmptyResultsNarrativeOnACompleteQuiz()
 {
     $person = (new Person())->setFirstName('test')->setGender('female');
     $completedDate = new \DateTime();
     $questionnaire = new Questionnaire($person);
     $aboutYou = $questionnaire->getAboutYou();
     $aboutYou->getFeelings()->setCompletedDate($completedDate);
     $aboutYou->getHindrances()->setCompletedDate($completedDate);
     $aboutYou->getMotivations()->setCompletedDate($completedDate);
     $aboutYou->getDependants()->setCompletedDate($completedDate);
     $questionnaire->setAboutYou($aboutYou->setCompletedDate($completedDate));
     $questionnaire->getDrinking()->setCompletedDate($completedDate);
     $questionnaire->getEating()->setCompletedDate($completedDate);
     $questionnaire->getMoving()->setCompletedDate($completedDate);
     $questionnaire->getSmoking()->setCompletedDate($completedDate);
     $results = ResultsNarrativeHelper::extractResultsNarrative($questionnaire, $this->translator);
     foreach ($results as $result) {
         $this->assertEquals(base64_encode(self::TRANS_STRING), $result);
     }
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:20,代码来源:ResultsNarrativeHelperTest.php

示例13: isSatisfiedBy

 /**
  * @inheritDoc
  */
 public static function isSatisfiedBy(Questionnaire $questionnaire)
 {
     return $questionnaire->getEating()->getRagScore()['rag'] === RagScore::RAG_RED;
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:7,代码来源:EatingRagIsRed.php

示例14: isSatisfiedBy

 /**
  * @inheritDoc
  */
 public static function isSatisfiedBy(Questionnaire $questionnaire)
 {
     return $questionnaire->getEating()->isCompleted();
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:7,代码来源:EatingSpecification.php

示例15: testSubstitutionOfThreeOrMoreMotivations

 public function testSubstitutionOfThreeOrMoreMotivations()
 {
     $questionnaire = new Questionnaire(new Person());
     $questionnaire->getPerson()->setGender('male');
     $questionnaire->getMoving()->setCompletedDate(new \DateTime());
     $questionnaire->getEating()->setCompletedDate(new \DateTime());
     $questionnaire->getDrinking()->setCompletedDate(new \DateTime());
     $questionnaire->getSmoking()->setCompletedDate(new \DateTime());
     $questionnaire->getAboutYou()->getMotivations()->setAlertness(true)->setAppearance(true)->setWeight(true)->setEnergy(true);
     $priorityCopy = $this->instance->buildNarrative($questionnaire)->getSubstitutions()['{{PRIORITY_COPY}}'];
     $this->assertEquals(1, substr_count($priorityCopy, 'and'));
     $this->assertEquals(1, substr_count($priorityCopy, ', '));
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:13,代码来源:ResultsNarrativeBuilderTest.php


注:本文中的TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::getEating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。