@@ -12,7 +12,7 @@ |
||
12 | 12 | * @return void |
13 | 13 | */ |
14 | 14 | spl_autoload_register( |
15 | - function ($class) { |
|
15 | + function($class) { |
|
16 | 16 | |
17 | 17 | // project-specific namespace prefix |
18 | 18 | //$prefix = 'Foo\\Bar\\'; |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * An example of a project-specific implementation. |
|
4 | - * |
|
5 | - * After registering this autoload function with SPL, the following line |
|
6 | - * would cause the function to attempt to load the \Foo\Bar\Baz\Qux class |
|
7 | - * from /path/to/project/src/Baz/Qux.php: |
|
8 | - * |
|
9 | - * new \Foo\Bar\Baz\Qux; |
|
10 | - * |
|
11 | - * @param string $class The fully-qualified class name. |
|
12 | - * @return void |
|
13 | - */ |
|
3 | + * An example of a project-specific implementation. |
|
4 | + * |
|
5 | + * After registering this autoload function with SPL, the following line |
|
6 | + * would cause the function to attempt to load the \Foo\Bar\Baz\Qux class |
|
7 | + * from /path/to/project/src/Baz/Qux.php: |
|
8 | + * |
|
9 | + * new \Foo\Bar\Baz\Qux; |
|
10 | + * |
|
11 | + * @param string $class The fully-qualified class name. |
|
12 | + * @return void |
|
13 | + */ |
|
14 | 14 | spl_autoload_register( |
15 | 15 | function ($class) { |
16 | 16 |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | ] |
38 | 38 | ]; |
39 | 39 | |
40 | - foreach($params as $key => $value) { |
|
40 | + foreach ($params as $key => $value) { |
|
41 | 41 | if (is_array($value)) { |
42 | - foreach($value as $subKey => $subValue) { |
|
42 | + foreach ($value as $subKey => $subValue) { |
|
43 | 43 | $options[$key][$subKey] = $subValue; |
44 | 44 | } |
45 | 45 | } else { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->dbOptions['driver_options'] |
81 | 81 | ); |
82 | 82 | |
83 | - } catch(\Exception $e) { |
|
83 | + } catch (\Exception $e) { |
|
84 | 84 | //Change to true to debug database connection |
85 | 85 | if (true) { |
86 | 86 | // For debug purpose, shows all connection details |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function insertRSS($input = []) |
203 | 203 | { |
204 | - $stmt = $this->db->prepare("INSERT INTO ". $this->table ." (TITLE, LINK, DESCRIPTION, CREATED) VALUES (?, ?, ?, datetime('now', 'localtime'))"); |
|
204 | + $stmt = $this->db->prepare("INSERT INTO " . $this->table . " (TITLE, LINK, DESCRIPTION, CREATED) VALUES (?, ?, ?, datetime('now', 'localtime'))"); |
|
205 | 205 | $stmt->execute([$input['TITLE'], $input['LINK'], $input['DESCRIPTION']]); |
206 | 206 | } |
207 | 207 | } |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | private $newsCount; |
14 | 14 | private $feedDescription; |
15 | 15 | |
16 | - /** |
|
17 | - * Initiates the class, takes parameters as input but should work with standard settings. |
|
18 | - * Connects to the DB and makes sure the table exists. |
|
19 | - * @param $params is the input to adjust standard settings. I recommend to change only the 'feedDescription' part. |
|
20 | - */ |
|
16 | + /** |
|
17 | + * Initiates the class, takes parameters as input but should work with standard settings. |
|
18 | + * Connects to the DB and makes sure the table exists. |
|
19 | + * @param $params is the input to adjust standard settings. I recommend to change only the 'feedDescription' part. |
|
20 | + */ |
|
21 | 21 | public function __construct($params = []) |
22 | 22 | { |
23 | 23 | $options = [ |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | $this->createDB(); |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Internal function for connecting to the database |
|
70 | - * |
|
71 | - * @return void |
|
72 | - */ |
|
68 | + /** |
|
69 | + * Internal function for connecting to the database |
|
70 | + * |
|
71 | + * @return void |
|
72 | + */ |
|
73 | 73 | private function connect() |
74 | 74 | { |
75 | 75 | try { |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | $stmt->execute(); |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Compares RSS file created timestamp and database timestamp to judge if new RSS file is needed |
|
103 | - * |
|
104 | - * Sets internal variable $this->valid to true/false depending if new file needs to be generate |
|
105 | - * @return void |
|
106 | - */ |
|
101 | + /** |
|
102 | + * Compares RSS file created timestamp and database timestamp to judge if new RSS file is needed |
|
103 | + * |
|
104 | + * Sets internal variable $this->valid to true/false depending if new file needs to be generate |
|
105 | + * @return void |
|
106 | + */ |
|
107 | 107 | private function checkValidity() |
108 | 108 | { |
109 | 109 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - /** |
|
136 | - * Creates a new RSS File with information from the database. Max amount of news is configured in the initiation. |
|
137 | - * |
|
138 | - * @return void |
|
139 | - */ |
|
135 | + /** |
|
136 | + * Creates a new RSS File with information from the database. Max amount of news is configured in the initiation. |
|
137 | + * |
|
138 | + * @return void |
|
139 | + */ |
|
140 | 140 | private function createRSS() |
141 | 141 | { |
142 | 142 | $file = fopen($this->rssFile, "w+"); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | </rss>'); |
177 | 177 | } |
178 | 178 | |
179 | - /** |
|
180 | - * Function that should be called to receive the RSS feed. |
|
181 | - * Checks if the latest RSS File is up to date, if not, generates a new one. |
|
182 | - * @return void |
|
183 | - */ |
|
179 | + /** |
|
180 | + * Function that should be called to receive the RSS feed. |
|
181 | + * Checks if the latest RSS File is up to date, if not, generates a new one. |
|
182 | + * @return void |
|
183 | + */ |
|
184 | 184 | public function getRSS() |
185 | 185 | { |
186 | 186 | $this->checkValidity(); |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | readfile($this->rssFile); |
194 | 194 | } |
195 | 195 | |
196 | - /** |
|
197 | - * Inserts information to RSS database |
|
198 | - * @param $input should be an associative array with three pars TITLE, LINK, DESCRIPTION |
|
199 | - * |
|
200 | - * @return void |
|
201 | - */ |
|
196 | + /** |
|
197 | + * Inserts information to RSS database |
|
198 | + * @param $input should be an associative array with three pars TITLE, LINK, DESCRIPTION |
|
199 | + * |
|
200 | + * @return void |
|
201 | + */ |
|
202 | 202 | public function insertRSS($input = []) |
203 | 203 | { |
204 | 204 | $stmt = $this->db->prepare("INSERT INTO ". $this->table ." (TITLE, LINK, DESCRIPTION, CREATED) VALUES (?, ?, ?, datetime('now', 'localtime'))"); |