本文整理汇总了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());
}
示例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();
}
示例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());
}
示例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);
}
}
示例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;
}