@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
25 | 25 | $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion'); |
26 | 26 | |
27 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
27 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
28 | 28 | return new \common\components\Time('America/Los_Angeles'); |
29 | 29 | }); |
30 | 30 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function testGetLocalTime() |
42 | 42 | { |
43 | - $this->specify('getLocalTime should function correctly', function () { |
|
43 | + $this->specify('getLocalTime should function correctly', function() { |
|
44 | 44 | expect("getLocalTime should work with user's set time", $this->assertEquals($this->time->getLocalTime(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"))); |
45 | 45 | expect('getLocalTime should work with a custom timezone', $this->assertEquals($this->time->getLocalTime("UTC"), (new DateTime("now"))->format("Y-m-d H:i:s"))); |
46 | 46 | }); |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | |
49 | 49 | public function testConvertLocalToUTC() |
50 | 50 | { |
51 | - $this->specify('convertLocalToUTC should function correctly', function () { |
|
51 | + $this->specify('convertLocalToUTC should function correctly', function() { |
|
52 | 52 | $la_tz = (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"); |
53 | 53 | |
54 | 54 | expect('convertLocalToUTC should convert a Los Angeles tz to UTC with the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz), (new DateTime("now"))->format("Y-m-d H:i:s"))); |
55 | 55 | expect('convertLocalToUTC should convert a Los Angeles tz to UTC without the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz, false), (new DateTime("now"))->format("Y-m-d"))); |
56 | 56 | // with UTC |
57 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
57 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
58 | 58 | return new \common\components\Time('UTC'); |
59 | 59 | }); |
60 | 60 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | |
68 | 68 | public function testConvertUTCToLocal() |
69 | 69 | { |
70 | - $this->specify('convertUTCToLocal should function correctly', function () { |
|
70 | + $this->specify('convertUTCToLocal should function correctly', function() { |
|
71 | 71 | $utc_tz = (new DateTime("now"))->format("Y-m-d H:i:s"); |
72 | 72 | |
73 | 73 | expect('convertUTCToLocal should convert a UTC tz to Los Angeles with the included timezone', $this->assertEquals((new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format(DateTime::ATOM), $this->time->convertUTCToLocal($utc_tz))); |
74 | 74 | expect('convertUTCToLocal should convert a UTC tz to Los Angeles without the included timezone', $this->assertEquals($this->time->convertUTCToLocal($utc_tz, false), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"))); |
75 | 75 | |
76 | 76 | // with UTC |
77 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
77 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
78 | 78 | return new \common\components\Time('UTC'); |
79 | 79 | }); |
80 | 80 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function testGetLocalDate() |
89 | 89 | { |
90 | - $this->specify('getLocalDate should function correctly', function () { |
|
90 | + $this->specify('getLocalDate should function correctly', function() { |
|
91 | 91 | expect("getLocalDate should correctly get the user's local date", $this->assertEquals($this->time->getLocalDate(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d"))); |
92 | 92 | expect("getLocalDate should correctly get the local date of a specified timezone", $this->assertEquals($this->time->getLocalDate("UTC"), (new DateTime("now", new DateTimeZone("UTC")))->format("Y-m-d"))); |
93 | 93 | }); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | expect('getUTCBookends should return false if there is a space at the end of the time string', $this->assertFalse($this->time->getUTCBookends('2016-05-30 00:00:00 '))); |
110 | 110 | expect('getUTCBookends should return UTC bookend times from the Los_Angeles tz', $this->assertEquals($this->time->getUTCBookends('2016-05-30'), ['2016-05-30 07:00:00', '2016-05-31 06:59:59'])); |
111 | 111 | // with UTC |
112 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
112 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
113 | 113 | return new \common\components\Time('UTC'); |
114 | 114 | }); |
115 | 115 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -10,8 +10,8 @@ |
||
10 | 10 | 'common\interfaces\QuestionInterface' => \common\models\Question::class, |
11 | 11 | 'common\interfaces\BehaviorInterface' => \common\models\Behavior::class, |
12 | 12 | 'common\interfaces\CategoryInterface' => \common\models\Category::class, |
13 | - 'common\interfaces\TimeInterface' => function () { |
|
14 | - if(Yii::$app->user->getIsGuest()) { |
|
13 | + 'common\interfaces\TimeInterface' => function() { |
|
14 | + if (Yii::$app->user->getIsGuest()) { |
|
15 | 15 | return new \common\components\Time('UTC'); |
16 | 16 | } else { |
17 | 17 | return new \common\components\Time(Yii::$app->user->identity->timezone); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | // check that the desired_email is not already the email of another user |
49 | 49 | $user = $this->user->findByEmail($this->desired_email); |
50 | 50 | // if it is, we do nothing and return true, don't leak the data |
51 | - if(!$user) { |
|
51 | + if (!$user) { |
|
52 | 52 | $this->user->desired_email = $this->desired_email; |
53 | 53 | $this->user->generateChangeEmailToken(); |
54 | 54 | $this->user->save(); |
@@ -14,103 +14,103 @@ discard block |
||
14 | 14 | class Behavior extends \yii\base\BaseObject implements BehaviorInterface |
15 | 15 | { |
16 | 16 | public static $behaviors = [ |
17 | - ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | - ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | - ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | - ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | - ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | - ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | - ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | - ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | - ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | - ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | - ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | - ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | - ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | - ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | - ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | - ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | - ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | - ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | - ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | - ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | - ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | - ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | - ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | - ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | - ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | - ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | - ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | - ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | - ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | - ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | - ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | - ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | - ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | - ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | - ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | - ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | - ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | - ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | - ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | - ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | - ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | - ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | - ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | - ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | - ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | - ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | - ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | - ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | - ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | - ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | - ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | - ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | - ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | - ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | - ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | - ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | - ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | - ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | - ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | - ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | - ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | - ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | - ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | - ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | - ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | - ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | - ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | - ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | - ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | - ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | - ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | - ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | - ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | - ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | - ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | - ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | - ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | - ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | - ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | - ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | - ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | - ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | - ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | - ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | - ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | - ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | - ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | - ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | - ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | - ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | - ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | - ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | - ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | - ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | - ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | - ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | - ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
17 | + ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | + ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | + ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | + ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | + ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | + ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | + ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | + ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | + ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | + ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | + ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | + ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | + ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | + ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | + ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | + ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | + ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | + ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | + ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | + ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | + ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | + ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | + ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | + ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | + ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | + ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | + ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | + ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | + ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | + ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | + ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | + ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | + ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | + ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | + ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | + ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | + ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | + ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | + ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | + ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | + ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | + ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | + ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | + ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | + ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | + ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | + ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | + ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | + ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | + ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | + ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | + ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | + ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | + ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | + ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | + ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | + ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | + ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | + ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | + ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | + ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | + ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | + ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | + ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | + ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | + ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | + ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | + ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | + ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | + ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | + ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | + ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | + ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | + ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | + ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | + ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | + ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | + ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | + ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | + ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | + ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | + ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | + ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | + ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | + ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | + ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | + ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | + ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | + ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | + ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | + ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | + ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | + ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | + ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | + ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | + ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | + ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
114 | 114 | ['id' => 100, 'name' => 'overwhelmed', 'category_id' => 6], |
115 | 115 | ['id' => 101, 'name' => 'crying for "no reason"', 'category_id' => 6], |
116 | 116 | ['id' => 102, 'name' => 'can\'t think', 'category_id' => 6], |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | $bhvrs_by_cat = AH::index(self::$behaviors, null, 'category_id'); |
182 | 182 | $cats = AH::index(\common\models\Category::$categories, "id"); |
183 | 183 | $weights_sum = array_sum(array_column($cats, 'weight')); |
184 | - foreach($cats as $id => &$cat) { |
|
184 | + foreach ($cats as $id => &$cat) { |
|
185 | 185 | $cat['behavior_count'] = count($bhvrs_by_cat[$id]); // add count of behaviors |
186 | 186 | $cat['category_id'] = $cat['id']; // rename id to category_id |
187 | - $cat['weight'] = (100 * $cat['weight']) / $weights_sum; // normalize weight |
|
187 | + $cat['weight'] = (100*$cat['weight'])/$weights_sum; // normalize weight |
|
188 | 188 | unset($cat['id']); |
189 | 189 | } |
190 | 190 | return $cats; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | <?= $form->field($model, 'subject') ?> |
58 | 58 | <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?> |
59 | 59 | |
60 | - <?php if(Yii::$app->user->isGuest) { |
|
60 | + <?php if (Yii::$app->user->isGuest) { |
|
61 | 61 | // only show captcha if user is not logged in |
62 | 62 | print $form->field($model, 'verifyCode')->widget(Captcha::class, [ |
63 | 63 | 'template' => '<div class="row"><div class="col-md-4">{image}</div><div class="col-md-8">{input}</div></div>', |
@@ -70,11 +70,11 @@ |
||
70 | 70 | ]); ?> |
71 | 71 | <?= $form->field($profile, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?> |
72 | 72 | <?= $form->field($profile, 'expose_graph')->checkbox() ?> |
73 | - <?php if($profile->expose_graph): ?> |
|
73 | + <?php if ($profile->expose_graph): ?> |
|
74 | 74 | <div class='alert alert-success score-graph-info'>Your score graph can be found at:<br /> <a id="score-graph-link" target="_blank" href="<?=$graph_url?>"><?=$graph_url?></a></div> |
75 | 75 | <?php endif; ?> |
76 | 76 | <?= $form->field($profile, 'send_email')->checkbox() ?> |
77 | - <div id='email_threshold_fields' <?php if(!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
77 | + <div id='email_threshold_fields' <?php if (!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
78 | 78 | <?= $form->field($profile, 'email_threshold')->textInput(['class'=>'form-control', 'style'=>'width: 50px;'])->input('number', ['min' => 0, 'max' => 1000]) ?> |
79 | 79 | <?= $form->field($profile, 'partner_email1')->input('email'); ?> |
80 | 80 | <?= $form->field($profile, 'partner_email2')->input('email'); ?> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if ($form->load(Yii::$app->request->post()) && $form->validate()) { |
40 | 40 | $form->compiled_behaviors = $form->compileBehaviors(); |
41 | 41 | |
42 | - if(sizeof($form->compiled_behaviors) === 0) { |
|
42 | + if (sizeof($form->compiled_behaviors) === 0) { |
|
43 | 43 | return $this->redirect(['view']); |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | return $this->redirect(['questions']); |
51 | 51 | } else { |
52 | - $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
52 | + $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
53 | 53 | return $this->render('index', [ |
54 | 54 | 'categories' => Yii::$container->get(CategoryInterface::class)::$categories, |
55 | 55 | 'model' => $form, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $date = Yii::$container->get(TimeInterface::class)->getLocalDate(); |
65 | 65 | |
66 | 66 | $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date); |
67 | - if(count($user_behaviors) === 0) { |
|
67 | + if (count($user_behaviors) === 0) { |
|
68 | 68 | return $this->redirect(['view']); |
69 | 69 | } |
70 | 70 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $form->deleteToday(); |
75 | 75 | |
76 | 76 | $behaviors = $user_behavior->findAll($form->getUserBehaviorIds()); |
77 | - if($result = $form->saveAnswers($behaviors)) { |
|
77 | + if ($result = $form->saveAnswers($behaviors)) { |
|
78 | 78 | |
79 | 79 | $score = $user_behavior->getDailyScore(); |
80 | - if(Yii::$app->user->identity->isOverThreshold($score)) { |
|
80 | + if (Yii::$app->user->identity->isOverThreshold($score)) { |
|
81 | 81 | Yii::$app->user->identity->sendEmailReport($date); |
82 | 82 | Yii::$app->session->setFlash('warning', 'Your check-in is complete. A notification has been sent to your report partners because of your high score. Reach out to them!'); |
83 | 83 | } else { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $graph = Yii::$container |
82 | 82 | ->get(\common\components\Graph::class, [$this->user]); |
83 | 83 | |
84 | - if($this->timezone) { |
|
84 | + if ($this->timezone) { |
|
85 | 85 | $user->timezone = $this->timezone; |
86 | 86 | } |
87 | - if($this->expose_graph) { |
|
87 | + if ($this->expose_graph) { |
|
88 | 88 | $user->expose_graph = true; |
89 | 89 | |
90 | 90 | // generate scores graph image |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // if they haven't done a check-in in the last month this |
93 | 93 | // will explode because $scores_last_month is an empty |
94 | 94 | // array |
95 | - if($scores_last_month) { |
|
95 | + if ($scores_last_month) { |
|
96 | 96 | $graph->create($scores_last_month, true); |
97 | 97 | } |
98 | 98 | } else { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // remove scores graph image |
101 | 101 | $graph->destroy(); |
102 | 102 | } |
103 | - if($this->send_email) { |
|
103 | + if ($this->send_email) { |
|
104 | 104 | $user->email_threshold = $this->email_threshold; |
105 | 105 | $user->partner_email1 = $this->partner_email1; |
106 | 106 | $user->partner_email2 = $this->partner_email2; |
@@ -59,8 +59,8 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * @codeCoverageIgnore |
|
63 | - */ |
|
62 | + * @codeCoverageIgnore |
|
63 | + */ |
|
64 | 64 | public function attributeLabels() { |
65 | 65 | return [ |
66 | 66 | 'partner_email1' => "Partner Email #1", |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $exception = Yii::$app->errorHandler->exception; |
17 | 17 | |
18 | -if($exception instanceof \yii\web\NotFoundHttpException): |
|
18 | +if ($exception instanceof \yii\web\NotFoundHttpException): |
|
19 | 19 | $this->title = "The Faster Scale App | Page Not Found"; |
20 | 20 | ?> |
21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | <p>Otherwise, please ensure your attempted url is correct.</p> |
26 | 26 | |
27 | 27 | <?php |
28 | -elseif($exception instanceof \yii\web\ServerErrorHttpException): |
|
28 | +elseif ($exception instanceof \yii\web\ServerErrorHttpException): |
|
29 | 29 | $this->title = "The Faster Scale App | Oops"; |
30 | 30 | ?> |
31 | 31 |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | <div class="alert alert-danger"><?= nl2br(Html::encode($name)) ?></div> |
34 | 34 | <p>Well this is embarrassing...we're having an error on our side. So sorry for the annoyance. If you'd like to help, please send us a message on our <a href='<?=Url::to(['site/contact'])?>'>contact form</a>.</p> |
35 | 35 | |
36 | -<?php else: ?> |
|
36 | +<?php else { |
|
37 | + : ?> |
|
37 | 38 | |
38 | 39 | <div class="site-error"> |
39 | 40 | <h1><?= Html::encode($name) ?></h1> |
@@ -41,4 +42,6 @@ discard block |
||
41 | 42 | <p>The above error occurred while the Web server was processing your request.</p> |
42 | 43 | <p>Please contact us if you think this is a server error. Thank you.</p> |
43 | 44 | </div> |
44 | -<?php endif; ?> |
|
45 | +<?php endif; |
|
46 | +} |
|
47 | +?> |