當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Questionnaire::getDrinking方法代碼示例

本文整理匯總了PHP中TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::getDrinking方法的典型用法代碼示例。如果您正苦於以下問題:PHP Questionnaire::getDrinking方法的具體用法?PHP Questionnaire::getDrinking怎麽用?PHP Questionnaire::getDrinking使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire的用法示例。


在下文中一共展示了Questionnaire::getDrinking方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSpecificationIsTrue

 public function testSpecificationIsTrue()
 {
     $questionnaire = new Questionnaire(new Person());
     $drinks = $questionnaire->getDrinking()->getWeekdayDrinks()->setBeerCiderBottleAmount(1);
     $questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tues')->setBingingFrequency(Drinking::BINGE_NEVER)->setWeekdayDrinks($drinks);
     $this->assertTrue(DrinkingLTE2DaysLTE3UnitsSpecification::isSatisfiedBy($questionnaire));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingLTE2DaysLTE3UnitsSpecificationTest.php

示例2: testSpecificationIsTrue

 public function testSpecificationIsTrue()
 {
     $questionnaire = new Questionnaire(new Person());
     $questionnaire->getDrinking()->setWhichDaysDoYouDrink('sat, sun');
     $questionnaire->getDrinking()->getWeekendDrinks()->setBeerCiderPintAmount(2);
     $this->assertTrue(DrinkingExceedsThreeUnitsSpecification::isSatisfiedBy($questionnaire));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingExceedsThreeUnitsSpecificationTest.php

示例3: testSpecificationIsFalse

 public function testSpecificationIsFalse()
 {
     $questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_FEMALE));
     $questionnaire->getDrinking()->setWhichDaysDoYouDrink('mon');
     $questionnaire->getDrinking()->getWeekdayDrinks()->setSpiritsAmount(8);
     $this->assertFalse(DrinkingDoesNotExceedDailyLimitsForGenderSpecification::isSatisfiedBy($questionnaire));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingDoesNotExceedDailyLimitsForGenderSpecificationTest.php

示例4: testSpecificationIsTrue

 public function testSpecificationIsTrue()
 {
     $questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_MALE));
     $drinks = $questionnaire->getDrinking()->getWeekdayDrinks()->setBeerCiderBottleAmount(2);
     $questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tues, wed, thur')->setBingingFrequency(Drinking::BINGE_NEVER)->setWeekdayDrinks($drinks);
     $this->assertTrue(DrinkingBetween3And5DaysWithinSuggestedLimitsSpecification::isSatisfiedBy($questionnaire));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingBetween3And5DaysWithinSuggestedLimitsSpecificationTest.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(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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: testSpecificationIsFalseAndIAmMale

 public function testSpecificationIsFalseAndIAmMale()
 {
     $questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_MALE));
     $drinks = (new Drinks())->setBeerCiderPintAmount(3);
     $questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed')->setWeekdayDrinks($drinks);
     $this->assertFalse(DrinkingUnitsInLowerRiskForGenderSpecification::isSatisfiedBy($questionnaire));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingUnitsInLowerRiskForGenderSpecificationTest.php

示例11: calculateScore

 /**
  * @inheritDoc
  */
 public function calculateScore(Questionnaire $questionnaire)
 {
     if ($questionnaire->getDrinking()->isCompleted()) {
         $this->extractDrinkingScore($questionnaire);
     }
     return $this->getRag();
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:10,代碼來源:DrinkingScore.php

示例12: 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

示例13: testGetDrinking

 public function testGetDrinking()
 {
     $expectedKeys = array("drinkingDoYouDrink", "drinkingFrequency", "weekdayDrinksBeerCiderPintAmount", "weekdayDrinksBeerCiderBottleAmount", "weekdayDrinksWineAmount", "weekdayDrinksSpiritsPintAmount", "weekdayDrinksCompleted", "weekendDrinksBeerCiderPintAmount", "weekendDrinksBeerCiderBottleAmount", "weekendDrinksWineAmount", "weekendDrinksSpiritsPintAmount", "weekendDrinksCompleted", "occasionalDrinksBeerCiderPintAmount", "occasionalDrinksBeerCiderBottleAmount", "occasionalDrinksWineAmount", "occasionalDrinksSpiritsPintAmount", "occasionalDrinksCompleted", "hasBinged", "drinkingCompleted", "drinkingRag");
     $questionnaire = new Questionnaire(new Person());
     $export = DrinkingHelper::extractDrinking($questionnaire->getDrinking());
     foreach ($expectedKeys as $key) {
         $this->assertArrayHasKey($key, $export);
     }
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:9,代碼來源:DrinkingHelperTest.php

示例14: isSatisfiedBy

 /**
  * @inheritDoc
  */
 public static function isSatisfiedBy(Questionnaire $questionnaire)
 {
     $maxUnits = DrinkingScore::getDailyMaxUnits($questionnaire->getDrinking());
     $gender = $questionnaire->getPerson()->getGender();
     switch ($gender) {
         case Person::GENDER_FEMALE:
             return $maxUnits > DrinkingScore::DAILY_CUTOFF_UNITS_FEMALE;
         case Person::GENDER_MALE:
             return $maxUnits > DrinkingScore::DAILY_CUTOFF_UNITS_MALE;
     }
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:14,代碼來源:DrinkingExceedsDailyLimitsForGenderSpecification.php

示例15: 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


注:本文中的TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::getDrinking方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。