-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexemple.php
More file actions
53 lines (48 loc) · 2.48 KB
/
Copy pathexemple.php
File metadata and controls
53 lines (48 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace App;
require_once "bootstrap.php";
/**
* Создаётся Пулл вопросов и Пулл Алгоритмов зависящих от Пула вопросов, проверяется объектом Test
*/
//Создаём сущность вопрос
$qustion = new QestionBuilder();
$qustion->setQuestion("Любите ли вы выпекать пироги?");
$qustion->setAnswerAndPoint(["Люблю", "Думаю только об этом, не могу спать."], [1, 2]);
//Можно и по 1
$qustion->addAnswerAndPoint("Нет.", 3);
$qustion->setQuestion("Любите ли вы выпекать пироги?");
///2 вопрос
$qustion2 = new QestionBuilder();
$qustion2->setQuestion("Как вы относитесь к еде?");
$qustion2->setAnswerAndPoint(["Очень люблю вкусно поесть.", "Отношусь спокойно.", "Я - дизайнер блюд в ресторане."], [3, 2, 1]);
//Добавляем в пулл совместных вопросов
$qustions_pool = new QuestionsPool();
$qustions_pool->addQuestion($qustion);
$qustions_pool->addQuestion($qustion2);
/**
* Создаём алгоритмы которые должны считать результат исходя из вапросов
*/
$algorithm_povar = new AlgorithmBuilder($qustions_pool);
$algorithm_povar->setNameAlgorithm("Повар");
$algorithm_povar->setAlgorithm("Некий алгоритм или внутренняя реализация");
$algorithm_gurman = new AlgorithmBuilder($qustions_pool);
$algorithm_gurman->setNameAlgorithm("Гурман");
$algorithm_gurman->setAlgorithm("Некий алгоритм2 или внутренняя реализация2");
//Создаём пул для алгоритмов, внутри сравниваем пулл вопросов, они должны быть одинаковые
$algorithm_pool = new AlgorithmsPool($qustions_pool);
$algorithm_pool->addAlgoritmh($algorithm_povar);
$algorithm_pool->addAlgoritmh($algorithm_gurman);
/**
* Создаём тест который будет всё контраливароть
*/
$test = new Test($qustions_pool, $algorithm_pool);
$test->setSubmitClient(FALSE);
//Если нажата кнопка. Проверять?
if ($test->getSubmitClient === TRUE) {
//считаем результат
$test->Result();
$test->viewResultTest();
} else {
// Отображает вопросы, ошибки и т.д
$test->viewTest();
}