@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
22 | - * @var null|\helper_plugin_swarmwebhook $helper |
|
22 | + * @var null|\helper_plugin_swarmwebhook $helper |
|
23 | 23 | */ |
24 | 24 | $helper = plugin_load('helper', 'swarmwebhook'); |
25 | 25 | if (!$helper) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | protected function verifyRequest(array $webhookData) |
59 | 59 | { |
60 | 60 | /** |
61 | - * @var null|\helper_plugin_swarmwebhook $helper |
|
61 | + * @var null|\helper_plugin_swarmwebhook $helper |
|
62 | 62 | */ |
63 | 63 | $helper = plugin_load('helper', 'swarmwebhook'); |
64 | 64 | $storedSecret = $helper->getConf('hook secret'); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | |
93 | 93 | /** |
94 | - * @var \helper_plugin_swarmwebhook $helper |
|
94 | + * @var \helper_plugin_swarmwebhook $helper |
|
95 | 95 | */ |
96 | 96 | $helper = plugin_load('helper', 'swarmwebhook'); |
97 | 97 | try { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | global $conf, $INPUT; |
16 | 16 | |
17 | - if ($conf[ 'allowdebug' ]) { |
|
17 | + if ($conf['allowdebug']) { |
|
18 | 18 | dbglog($_SERVER); |
19 | 19 | } |
20 | 20 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | return true; |
67 | 67 | } |
68 | 68 | |
69 | - if (empty($webhookData[ 'secret' ])) { |
|
69 | + if (empty($webhookData['secret'])) { |
|
70 | 70 | return new Response(401, 'Header X_HOOK_SECRET missing!'); |
71 | 71 | } |
72 | 72 | |
73 | - if ($webhookData[ 'secret' ] !== $storedSecret) { |
|
73 | + if ($webhookData['secret'] !== $storedSecret) { |
|
74 | 74 | return new Response(403, 'Header X_HOOK_SECRET not identical with configured secret!'); |
75 | 75 | } |
76 | 76 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | protected function handleWebhookPayload(array $webhookData, $json) |
87 | 87 | { |
88 | 88 | $lookupData = $this->extractDataFromPayload($webhookData); |
89 | - $lookupData[ 'json' ] = $json; |
|
90 | - $lookupData[ 'service' ] = 'IFTTT'; |
|
89 | + $lookupData['json'] = $json; |
|
90 | + $lookupData['service'] = 'IFTTT'; |
|
91 | 91 | |
92 | 92 | |
93 | 93 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $helper->createNewSwarmSchema(); |
101 | 101 | } |
102 | 102 | |
103 | - $helper->deleteCheckinFromLookup($lookupData[ 'checkinid' ]); |
|
103 | + $helper->deleteCheckinFromLookup($lookupData['checkinid']); |
|
104 | 104 | $helper->saveDataToLookup($lookupData); |
105 | 105 | } catch (\Exception $e) { // FIXME: catch more specific exceptions! |
106 | 106 | $errorMessage = $e->getMessage(); |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function extractDataFromPayload(array $data) |
122 | 122 | { |
123 | - $checkinID = $data[ 'ts' ]; |
|
124 | - $locationName = $data[ 'VenueName' ]; |
|
123 | + $checkinID = $data['ts']; |
|
124 | + $locationName = $data['VenueName']; |
|
125 | 125 | |
126 | 126 | // gues time zone |
127 | 127 | $nowTS = time(); |
128 | 128 | |
129 | - $dateTime = $this->parseTimeIntoDateTime($data[ 'ts' ], $nowTS); |
|
129 | + $dateTime = $this->parseTimeIntoDateTime($data['ts'], $nowTS); |
|
130 | 130 | |
131 | 131 | $lookupData = [ |
132 | 132 | 'date' => $dateTime->format('Y-m-d'), |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | 'checkinid' => $checkinID, |
135 | 135 | 'locname' => $locationName, |
136 | 136 | ]; |
137 | - if (!empty($data[ 'shout' ])) { |
|
138 | - $lookupData[ 'shout' ] = $data[ 'shout' ]; |
|
137 | + if (!empty($data['shout'])) { |
|
138 | + $lookupData['shout'] = $data['shout']; |
|
139 | 139 | } |
140 | 140 | return $lookupData; |
141 | 141 | } |
@@ -171,6 +171,6 @@ discard block |
||
171 | 171 | $guessedOffset = round(($dateTime->getTimestamp() - $nowTS) / 3600) * 100; |
172 | 172 | $sign = $guessedOffset > 0 ? '+' : ''; |
173 | 173 | |
174 | - return $sign . (string)$guessedOffset; |
|
174 | + return $sign . (string) $guessedOffset; |
|
175 | 175 | } |
176 | 176 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $webhook->run($inputJSON); |
36 | 36 | |
37 | 37 | /** |
38 | - * @var \remote_plugin_struct $remote |
|
38 | + * @var \remote_plugin_struct $remote |
|
39 | 39 | */ |
40 | 40 | $remote = plugin_load('remote', 'struct'); |
41 | 41 | $rows = $remote->getAggregationData( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $actualOK = $actualOK && $webhook->handleWebhookPayload($inputJSON); |
69 | 69 | |
70 | 70 | /** |
71 | - * @var \remote_plugin_struct $remote |
|
71 | + * @var \remote_plugin_struct $remote |
|
72 | 72 | */ |
73 | 73 | $remote = plugin_load('remote', 'struct'); |
74 | 74 | $rows = $remote->getAggregationData( |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | parent::setUp(); |
23 | 23 | |
24 | - $conf [ 'plugin' ][ 'swarmwebhook' ][ 'service' ] = 'Zapier'; |
|
24 | + $conf ['plugin']['swarmwebhook']['service'] = 'Zapier'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'swarm.service' => 'Zapier', |
54 | 54 | ]; |
55 | 55 | |
56 | - $this->assertEquals($rows[ 0 ], $expectedRows, 'single event, initially creating the schema'); |
|
56 | + $this->assertEquals($rows[0], $expectedRows, 'single event, initially creating the schema'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -88,6 +88,6 @@ discard block |
||
88 | 88 | |
89 | 89 | $this->assertTrue($actualOK, 'single event, initially creating the schema'); |
90 | 90 | $this->assertCount(1, $rows, 'saving a payload twice should only create one row'); |
91 | - $this->assertEquals($rows[ 0 ], $expectedRows); |
|
91 | + $this->assertEquals($rows[0], $expectedRows); |
|
92 | 92 | } |
93 | 93 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $IFTTT->run($inputJSON); |
31 | 31 | |
32 | 32 | /** |
33 | - * @var \remote_plugin_struct $remote |
|
33 | + * @var \remote_plugin_struct $remote |
|
34 | 34 | */ |
35 | 35 | $remote = plugin_load('remote', 'struct'); |
36 | 36 | $rows = $remote->getAggregationData( |
@@ -49,6 +49,6 @@ |
||
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // $this->assertTrue($actualOK, 'single event, initially creating the schema'); |
52 | - $this->assertEquals($rows[ 0 ], $expectedRows); |
|
52 | + $this->assertEquals($rows[0], $expectedRows); |
|
53 | 53 | } |
54 | 54 | } |
@@ -27,11 +27,11 @@ |
||
27 | 27 | $this->assertArrayHasKey('desc', $info); |
28 | 28 | $this->assertArrayHasKey('url', $info); |
29 | 29 | |
30 | - $this->assertEquals('swarmwebhook', $info[ 'base' ]); |
|
31 | - $this->assertRegExp('/^https?:\/\//', $info[ 'url' ]); |
|
32 | - $this->assertTrue(mail_isvalid($info[ 'email' ])); |
|
33 | - $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info[ 'date' ]); |
|
34 | - $this->assertTrue(false !== strtotime($info[ 'date' ])); |
|
30 | + $this->assertEquals('swarmwebhook', $info['base']); |
|
31 | + $this->assertRegExp('/^https?:\/\//', $info['url']); |
|
32 | + $this->assertTrue(mail_isvalid($info['email'])); |
|
33 | + $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
34 | + $this->assertTrue(false !== strtotime($info['date'])); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function saveDataToLookup(array $data) |
39 | 39 | { |
40 | 40 | /** |
41 | - * @var helper_plugin_struct $structHelper |
|
41 | + * @var helper_plugin_struct $structHelper |
|
42 | 42 | */ |
43 | 43 | $structHelper = plugin_load('helper', 'struct'); |
44 | 44 | $access = AccessTable::byTableName('swarm', 0, 0); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $tablename = 'swarm'; |
73 | 73 | |
74 | 74 | /** |
75 | - * @var remote_plugin_struct $remote |
|
75 | + * @var remote_plugin_struct $remote |
|
76 | 76 | */ |
77 | 77 | $remote = plugin_load('remote', 'struct'); |
78 | 78 | $rows = $remote->getAggregationData( |