GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#145)
by
unknown
09:16 queued 03:08
created
myth/Events/Events.php 3 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -36,176 +36,176 @@
 block discarded – undo
36 36
 
37 37
 class Events {
38 38
 
39
-    /**
40
-     * The list of listeners.
41
-     *
42
-     * @var array
43
-     */
44
-    protected static $listeners = [];
45
-
46
-    /**
47
-     * Flag to let us know if we've read from the config file
48
-     * and have all of the defined events.
49
-     *
50
-     * @var bool
51
-     */
52
-    protected static $have_read_from_file = false;
53
-
54
-    //--------------------------------------------------------------------
55
-
56
-    /**
57
-     * Registers an action to happen on an event. The action can be any sort
58
-     * of callable:
59
-     *
60
-     *  Events::on('create', 'myFunction');               // procedural function
61
-     *  Events::on('create', ['myClass', 'myMethod']);    // Class::method
62
-     *  Events::on('create', [$myInstance, 'myMethod']);  // Method on an existing instance
63
-     *  Events::on('create', function() {});              // Closure
64
-     *
65
-     * @param $event_name
66
-     * @param callable $callback
67
-     * @param int $priority
68
-     */
69
-    public static function on($event_name, callable $callback, $priority=EVENTS_PRIORITY_NORMAL)
70
-    {
71
-        if (! isset(self::$listeners[$event_name]))
72
-        {
73
-            self::$listeners[$event_name] = [
74
-                true,   // If there's only 1 item, it's sorted.
75
-                [$priority],
76
-                [$callback]
77
-            ];
78
-        }
79
-        else
80
-        {
81
-            self::$listeners[$event_name][0] = false; // Not sorted
82
-            self::$listeners[$event_name][1][] = $priority;
83
-            self::$listeners[$event_name][2][] = $callback;
84
-        }
85
-    }
39
+	/**
40
+	 * The list of listeners.
41
+	 *
42
+	 * @var array
43
+	 */
44
+	protected static $listeners = [];
45
+
46
+	/**
47
+	 * Flag to let us know if we've read from the config file
48
+	 * and have all of the defined events.
49
+	 *
50
+	 * @var bool
51
+	 */
52
+	protected static $have_read_from_file = false;
53
+
54
+	//--------------------------------------------------------------------
55
+
56
+	/**
57
+	 * Registers an action to happen on an event. The action can be any sort
58
+	 * of callable:
59
+	 *
60
+	 *  Events::on('create', 'myFunction');               // procedural function
61
+	 *  Events::on('create', ['myClass', 'myMethod']);    // Class::method
62
+	 *  Events::on('create', [$myInstance, 'myMethod']);  // Method on an existing instance
63
+	 *  Events::on('create', function() {});              // Closure
64
+	 *
65
+	 * @param $event_name
66
+	 * @param callable $callback
67
+	 * @param int $priority
68
+	 */
69
+	public static function on($event_name, callable $callback, $priority=EVENTS_PRIORITY_NORMAL)
70
+	{
71
+		if (! isset(self::$listeners[$event_name]))
72
+		{
73
+			self::$listeners[$event_name] = [
74
+				true,   // If there's only 1 item, it's sorted.
75
+				[$priority],
76
+				[$callback]
77
+			];
78
+		}
79
+		else
80
+		{
81
+			self::$listeners[$event_name][0] = false; // Not sorted
82
+			self::$listeners[$event_name][1][] = $priority;
83
+			self::$listeners[$event_name][2][] = $callback;
84
+		}
85
+	}
86 86
     
87
-    //--------------------------------------------------------------------
88
-
89
-    /**
90
-     * Runs through all subscribed methods running them one at a time,
91
-     * until either:
92
-     *  a) All subscribers have finished or
93
-     *  b) a method returns false, at which point execution of subscribers stops.
94
-     *
95
-     * @param $event_name
96
-     * @return bool
97
-     */
98
-    public static function trigger($event_name, array $arguments = [])
99
-    {
100
-        // Read in our config/events file so that we have them all!
101
-        if (! self::$have_read_from_file)
102
-        {
103
-            if (is_file(APPPATH .'config/events.php'))
104
-            {
105
-                include APPPATH .'config/events.php';
106
-            }
107
-            self::$have_read_from_file = true;
108
-        }
109
-
110
-        foreach (self::listeners($event_name) as $listener)
111
-        {
112
-            $result = call_user_func_array($listener, $arguments);
113
-
114
-            if ($result === false)
115
-            {
116
-                return false;
117
-            }
118
-        }
119
-
120
-        return true;
121
-    }
87
+	//--------------------------------------------------------------------
88
+
89
+	/**
90
+	 * Runs through all subscribed methods running them one at a time,
91
+	 * until either:
92
+	 *  a) All subscribers have finished or
93
+	 *  b) a method returns false, at which point execution of subscribers stops.
94
+	 *
95
+	 * @param $event_name
96
+	 * @return bool
97
+	 */
98
+	public static function trigger($event_name, array $arguments = [])
99
+	{
100
+		// Read in our config/events file so that we have them all!
101
+		if (! self::$have_read_from_file)
102
+		{
103
+			if (is_file(APPPATH .'config/events.php'))
104
+			{
105
+				include APPPATH .'config/events.php';
106
+			}
107
+			self::$have_read_from_file = true;
108
+		}
109
+
110
+		foreach (self::listeners($event_name) as $listener)
111
+		{
112
+			$result = call_user_func_array($listener, $arguments);
113
+
114
+			if ($result === false)
115
+			{
116
+				return false;
117
+			}
118
+		}
119
+
120
+		return true;
121
+	}
122 122
     
123
-    //--------------------------------------------------------------------
124
-
125
-    /**
126
-     * Returns an array of listeners for a single event. They are
127
-     * sorted by priority.
128
-     *
129
-     * If the listener could not be found, returns FALSE, or TRUE if
130
-     * it was removed.
131
-     *
132
-     * @param $event_name
133
-     * @return array
134
-     */
135
-    public static function listeners($event_name)
136
-    {
137
-        if (! isset(self::$listeners[$event_name]))
138
-        {
139
-            return [];
140
-        }
141
-
142
-        // The list is not sorted
143
-        if (! self::$listeners[$event_name][0])
144
-        {
145
-            // Sort it!
146
-            array_multisort(self::$listeners[$event_name][1], SORT_NUMERIC, self::$listeners[$event_name][2]);
147
-
148
-            // Mark it as sorted already!
149
-            self::$listeners[$event_name][0] = true;
150
-        }
151
-
152
-        return self::$listeners[$event_name][2];
153
-    }
154
-
155
-    //--------------------------------------------------------------------
156
-
157
-    /**
158
-     * Removes a single listener from an event.
159
-     *
160
-     * If the listener couldn't be found, returns FALSE, else TRUE if
161
-     * it was removed.
162
-     *
163
-     * @param $event_name
164
-     * @param callable $listener
165
-     * @return bool
166
-     */
167
-    public static function removeListener($event_name, callable $listener)
168
-    {
169
-        if (! isset(self::$listeners[$event_name]))
170
-        {
171
-            return false;
172
-        }
173
-
174
-        foreach (self::$listeners[$event_name][2] as $index => $check)
175
-        {
176
-            if ($check === $listener)
177
-            {
178
-                unset(self::$listeners[$event_name][1][$index]);
179
-                unset(self::$listeners[$event_name][2][$index]);
180
-
181
-                return true;
182
-            }
183
-        }
184
-
185
-        return false;
186
-    }
187
-
188
-    //--------------------------------------------------------------------
189
-
190
-    /**
191
-     * Removes all listeners.
192
-     *
193
-     * If the event_name is specified, only listeners for that event will be
194
-     * removed, otherwise all listeners for all events are removed.
195
-     *
196
-     * @param null $event_name
197
-     */
198
-    public static function removeAllListeners($event_name=null)
199
-    {
200
-        if (! is_null($event_name))
201
-        {
202
-            unset(self::$listeners[$event_name]);
203
-        }
204
-        else {
205
-            self::$listeners = [];
206
-        }
207
-    }
208
-
209
-    //--------------------------------------------------------------------
123
+	//--------------------------------------------------------------------
124
+
125
+	/**
126
+	 * Returns an array of listeners for a single event. They are
127
+	 * sorted by priority.
128
+	 *
129
+	 * If the listener could not be found, returns FALSE, or TRUE if
130
+	 * it was removed.
131
+	 *
132
+	 * @param $event_name
133
+	 * @return array
134
+	 */
135
+	public static function listeners($event_name)
136
+	{
137
+		if (! isset(self::$listeners[$event_name]))
138
+		{
139
+			return [];
140
+		}
141
+
142
+		// The list is not sorted
143
+		if (! self::$listeners[$event_name][0])
144
+		{
145
+			// Sort it!
146
+			array_multisort(self::$listeners[$event_name][1], SORT_NUMERIC, self::$listeners[$event_name][2]);
147
+
148
+			// Mark it as sorted already!
149
+			self::$listeners[$event_name][0] = true;
150
+		}
151
+
152
+		return self::$listeners[$event_name][2];
153
+	}
154
+
155
+	//--------------------------------------------------------------------
156
+
157
+	/**
158
+	 * Removes a single listener from an event.
159
+	 *
160
+	 * If the listener couldn't be found, returns FALSE, else TRUE if
161
+	 * it was removed.
162
+	 *
163
+	 * @param $event_name
164
+	 * @param callable $listener
165
+	 * @return bool
166
+	 */
167
+	public static function removeListener($event_name, callable $listener)
168
+	{
169
+		if (! isset(self::$listeners[$event_name]))
170
+		{
171
+			return false;
172
+		}
173
+
174
+		foreach (self::$listeners[$event_name][2] as $index => $check)
175
+		{
176
+			if ($check === $listener)
177
+			{
178
+				unset(self::$listeners[$event_name][1][$index]);
179
+				unset(self::$listeners[$event_name][2][$index]);
180
+
181
+				return true;
182
+			}
183
+		}
184
+
185
+		return false;
186
+	}
187
+
188
+	//--------------------------------------------------------------------
189
+
190
+	/**
191
+	 * Removes all listeners.
192
+	 *
193
+	 * If the event_name is specified, only listeners for that event will be
194
+	 * removed, otherwise all listeners for all events are removed.
195
+	 *
196
+	 * @param null $event_name
197
+	 */
198
+	public static function removeAllListeners($event_name=null)
199
+	{
200
+		if (! is_null($event_name))
201
+		{
202
+			unset(self::$listeners[$event_name]);
203
+		}
204
+		else {
205
+			self::$listeners = [];
206
+		}
207
+	}
208
+
209
+	//--------------------------------------------------------------------
210 210
 
211 211
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
      * @param callable $callback
67 67
      * @param int $priority
68 68
      */
69
-    public static function on($event_name, callable $callback, $priority=EVENTS_PRIORITY_NORMAL)
69
+    public static function on($event_name, callable $callback, $priority = EVENTS_PRIORITY_NORMAL)
70 70
     {
71
-        if (! isset(self::$listeners[$event_name]))
71
+        if ( ! isset(self::$listeners[$event_name]))
72 72
         {
73 73
             self::$listeners[$event_name] = [
74
-                true,   // If there's only 1 item, it's sorted.
74
+                true, // If there's only 1 item, it's sorted.
75 75
                 [$priority],
76 76
                 [$callback]
77 77
             ];
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
     public static function trigger($event_name, array $arguments = [])
99 99
     {
100 100
         // Read in our config/events file so that we have them all!
101
-        if (! self::$have_read_from_file)
101
+        if ( ! self::$have_read_from_file)
102 102
         {
103
-            if (is_file(APPPATH .'config/events.php'))
103
+            if (is_file(APPPATH.'config/events.php'))
104 104
             {
105
-                include APPPATH .'config/events.php';
105
+                include APPPATH.'config/events.php';
106 106
             }
107 107
             self::$have_read_from_file = true;
108 108
         }
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public static function listeners($event_name)
136 136
     {
137
-        if (! isset(self::$listeners[$event_name]))
137
+        if ( ! isset(self::$listeners[$event_name]))
138 138
         {
139 139
             return [];
140 140
         }
141 141
 
142 142
         // The list is not sorted
143
-        if (! self::$listeners[$event_name][0])
143
+        if ( ! self::$listeners[$event_name][0])
144 144
         {
145 145
             // Sort it!
146 146
             array_multisort(self::$listeners[$event_name][1], SORT_NUMERIC, self::$listeners[$event_name][2]);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public static function removeListener($event_name, callable $listener)
168 168
     {
169
-        if (! isset(self::$listeners[$event_name]))
169
+        if ( ! isset(self::$listeners[$event_name]))
170 170
         {
171 171
             return false;
172 172
         }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
      *
196 196
      * @param null $event_name
197 197
      */
198
-    public static function removeAllListeners($event_name=null)
198
+    public static function removeAllListeners($event_name = null)
199 199
     {
200
-        if (! is_null($event_name))
200
+        if ( ! is_null($event_name))
201 201
         {
202 202
             unset(self::$listeners[$event_name]);
203 203
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
                 [$priority],
76 76
                 [$callback]
77 77
             ];
78
-        }
79
-        else
78
+        } else
80 79
         {
81 80
             self::$listeners[$event_name][0] = false; // Not sorted
82 81
             self::$listeners[$event_name][1][] = $priority;
@@ -200,8 +199,7 @@  discard block
 block discarded – undo
200 199
         if (! is_null($event_name))
201 200
         {
202 201
             unset(self::$listeners[$event_name]);
203
-        }
204
-        else {
202
+        } else {
205 203
             self::$listeners = [];
206 204
         }
207 205
     }
Please login to merge, or discard this patch.
myth/Forensics/Console.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -167,11 +167,11 @@
 block discarded – undo
167 167
 
168 168
 	public function reset()
169 169
 	{
170
-	    self::$logs = array(
171
-		    'console'		=> array(),
172
-		    'log_count'		=> 0,
173
-		    'memory_count'	=> 0,
174
-	    );
170
+		self::$logs = array(
171
+			'console'		=> array(),
172
+			'log_count'		=> 0,
173
+			'memory_count'	=> 0,
174
+		);
175 175
 	}
176 176
 
177 177
 	//--------------------------------------------------------------------
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	*/
93 93
 	public static function init() 
94 94
 	{
95
-		self::$ci =& get_instance();
95
+		self::$ci = & get_instance();
96 96
 	}
97 97
 	
98 98
 	//--------------------------------------------------------------------
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		Parameters:
106 106
 			$data	- The variable to log.
107 107
 	*/
108
-	public static function log($data=null) 
108
+	public static function log($data = null) 
109 109
 	{
110 110
 		if ($data !== 0 && empty($data)) 
111 111
 		{ 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			$object	- The object to store the memory usage of.
132 132
 			$name	- The name to be displayed in the console.
133 133
 	*/
134
-	public static function logMemory($object=false, $name='PHP')
134
+	public static function logMemory($object = false, $name = 'PHP')
135 135
 	{
136 136
 		$memory = memory_get_usage();
137 137
 		
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	// !PRIVATE METHODS
183 183
 	//--------------------------------------------------------------------
184 184
 	
185
-	protected static function addToConsole($log=null, $item=null)
185
+	protected static function addToConsole($log = null, $item = null)
186 186
 	{
187 187
 		if (empty($log) || empty($item)) 
188 188
 		{ 
189 189
 			return;
190 190
 		}
191 191
 		
192
-		self::$logs['console'][]	= $item;
193
-		self::$logs[$log] 			+= 1;
192
+		self::$logs['console'][] = $item;
193
+		self::$logs[$log] += 1;
194 194
 	}
195 195
 	
196 196
 	//--------------------------------------------------------------------
Please login to merge, or discard this patch.
myth/Forensics/views/profiler_template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				Load Time
197 197
 			</a>
198 198
 			<a href="#" id="ci-profiler-menu-memory" onclick="ci_profiler_bar.show('ci-profiler-memory', 'ci-profiler-menu-memory'); return false;">
199
-				<span><?php echo (! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).' MB' ?></span>
199
+				<span><?php echo ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage() / 1024 / 1024, 2).' MB' ?></span>
200 200
 				Memory Used
201 201
 			</a>
202 202
 		<?php endif; ?>
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 					<?php $append = ($section == 'get' || $section == 'post') ? '_data' : '' ?>
386 386
 					<a href="#" onclick="ci_profiler_bar.toggle_data_table('<?php echo $section ?>'); return false;">
387
-						<h2><?php echo lang('profiler_' . $section . $append) ?></h2>
387
+						<h2><?php echo lang('profiler_'.$section.$append) ?></h2>
388 388
 					</a>
389 389
 
390 390
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -14 removed lines patch added patch discarded remove patch
@@ -257,9 +257,12 @@  discard block
 block discarded – undo
257 257
 				<?php endforeach; ?>
258 258
 				</table>
259 259
 
260
-			<?php else : ?>
260
+			<?php else {
261
+	: ?>
261 262
 
262
-				<?php echo $sections['console']; ?>
263
+				<?php echo $sections['console'];
264
+}
265
+?>
263 266
 
264 267
 			<?php endif; ?>
265 268
 		</div>
@@ -288,9 +291,12 @@  discard block
 block discarded – undo
288 291
 				<?php endforeach; ?>
289 292
 				</table>
290 293
 
291
-			<?php else : ?>
294
+			<?php else {
295
+	: ?>
292 296
 
293
-				<?php echo $sections['console']; ?>
297
+				<?php echo $sections['console'];
298
+}
299
+?>
294 300
 
295 301
 			<?php endif; ?>
296 302
 		</div>
@@ -309,9 +315,12 @@  discard block
 block discarded – undo
309 315
 				<?php endforeach; ?>
310 316
 				</table>
311 317
 
312
-			<?php else : ?>
318
+			<?php else {
319
+	: ?>
313 320
 
314
-				<?php echo $sections['benchmarks']; ?>
321
+				<?php echo $sections['benchmarks'];
322
+}
323
+?>
315 324
 
316 325
 			<?php endif; ?>
317 326
 		</div>
@@ -332,9 +341,12 @@  discard block
 block discarded – undo
332 341
 				<?php endforeach; ?>
333 342
 				</table>
334 343
 
335
-			<?php else : ?>
344
+			<?php else {
345
+	: ?>
336 346
 
337
-				<?php echo $sections['queries']; ?>
347
+				<?php echo $sections['queries'];
348
+}
349
+?>
338 350
 
339 351
 			<?php endif; ?>
340 352
 		</div>
@@ -394,8 +406,11 @@  discard block
 block discarded – undo
394 406
 						<?php foreach ($sections[$section] as $key => $val) : ?>
395 407
 							<tr><td class="hilight"><?php echo $key ?></td><td><?php echo htmlspecialchars($val) ?></td></tr>
396 408
 						<?php endforeach; ?>
397
-						<?php else : ?>
398
-							<tr><td><?php echo $sections[$section]; ?></td></tr>
409
+						<?php else {
410
+	: ?>
411
+							<tr><td><?php echo $sections[$section];
412
+}
413
+?></td></tr>
399 414
 						<?php endif; ?>
400 415
 						</table>
401 416
 				<?php endif; ?>
@@ -422,19 +437,25 @@  discard block
 block discarded – undo
422 437
 				<?php endforeach; ?>
423 438
 				</table>
424 439
 
425
-			<?php else : ?>
440
+			<?php else {
441
+	: ?>
426 442
 
427
-				<?php echo $sections['files']; ?>
443
+				<?php echo $sections['files'];
444
+}
445
+?>
428 446
 
429 447
 			<?php endif; ?>
430 448
 		</div>
431 449
 	<?php endif; ?>
432 450
 
433 451
 
434
-<?php else: ?>
452
+<?php else {
453
+	: ?>
435 454
 
436 455
 	<p class="ci-profiler-box"><?php echo lang('profiler_no_profiles') ?></p>
437 456
 
438
-<?php endif; ?>
457
+<?php endif;
458
+}
459
+?>
439 460
 
440 461
 </div>	<!-- /codeigniter_profiler -->
Please login to merge, or discard this patch.
myth/Forge/FileKit.php 2 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -32,206 +32,206 @@
 block discarded – undo
32 32
 
33 33
 class FileKit {
34 34
 
35
-    /**
36
-     * Appends data to the end of a file.
37
-     *
38
-     * @param $file
39
-     * @param $content
40
-     * @return bool|int
41
-     */
42
-    public function append($file, $content)
43
-    {
44
-        if (empty($content))
45
-        {
46
-            return true;
47
-        }
48
-
49
-        // Ensure that $content has a newline at the end
50
-        $content = rtrim($content) ."\n";
51
-
52
-        $fh = fopen($file, 'a');
53
-        $result = fwrite($fh, $content);
54
-        fclose($fh);
55
-
56
-        return $result;
57
-    }
58
-
59
-    //--------------------------------------------------------------------
60
-
61
-    /**
62
-     * Prepends string content to a file. For very large files
63
-     * this method could have memory issues, but the primary usage
64
-     * of source files shouldn't ever get large enough to cause issues.
65
-     *
66
-     * @param $file
67
-     * @param $content
68
-     * @return bool|int
69
-     */
70
-    public function prepend($file, $content)
71
-    {
72
-        if (empty($content))
73
-        {
74
-            return true;
75
-        }
76
-
77
-        // Ensure that $content has a newline at the end
78
-        $content = rtrim($content) ."\n";
79
-
80
-        $file_contents = file_get_contents($file);
81
-
82
-        if ($file_contents === false)
83
-        {
84
-            throw new \RuntimeException( sprintf(lang('errors.reading_file'), $file));
85
-        }
86
-
87
-        $result = file_put_contents($file, $content . $file_contents);
88
-
89
-        return (bool)$result;
90
-    }
91
-
92
-    //--------------------------------------------------------------------
93
-
94
-    /**
95
-     * Inserts $content before the line that matches $before. NOT case-
96
-     * sensitive.
97
-     *
98
-     * @param $file
99
-     * @param $before
100
-     * @param $content
101
-     * @return int
102
-     */
103
-    public function before($file, $before, $content)
104
-    {
105
-        if (empty($content))
106
-        {
107
-            return true;
108
-        }
109
-
110
-        // Ensure that $content has a newline at the end
111
-        $content = rtrim($content) ."\n";
112
-
113
-        $lines = file($file);
114
-
115
-        if ($lines === false)
116
-        {
117
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ));
118
-        }
119
-
120
-        // Where to insert the row.
121
-        $location = null;
122
-
123
-        foreach ($lines as $index => $line)
124
-        {
125
-            if (strtolower($line) == strtolower($before) )
126
-            {
127
-                $location = $index;
128
-                break;
129
-            }
130
-        }
131
-
132
-        array_splice($lines, $location, 0, $content);
133
-
134
-        $result = file_put_contents($file, $lines);
135
-
136
-        return (bool)$result;
137
-    }
138
-
139
-    //--------------------------------------------------------------------
140
-
141
-    public function after($file, $after, $content)
142
-    {
143
-        if (empty($content))
144
-        {
145
-            return true;
146
-        }
147
-
148
-        // Ensure that $content has a newline at the end
149
-        $content = rtrim($content) ."\n";
150
-
151
-        $lines = file($file);
152
-
153
-        if ($lines === false)
154
-        {
155
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ) );
156
-        }
157
-
158
-        // Where to insert the row.
159
-        $location = null;
160
-
161
-        foreach ($lines as $index => $line)
162
-        {
163
-            if (strtolower($line) == strtolower($after) )
164
-            {
165
-                $location = $index;
166
-                break;
167
-            }
168
-        }
169
-
170
-        array_splice($lines, $location +1, 0, $content);
171
-
172
-        $result = file_put_contents($file, $lines);
173
-
174
-        return (bool)$result;
175
-    }
176
-
177
-    //--------------------------------------------------------------------
178
-
179
-    /**
180
-     * Replaces all instances of $search in the file with $replace.
181
-     *
182
-     * @param $file
183
-     * @param $search
184
-     * @param $replace
185
-     * @return int
186
-     */
187
-    public function replaceIn($file, $search, $replace)
188
-    {
189
-        $file_contents = file_get_contents($file);
190
-
191
-        if ($file_contents === false)
192
-        {
193
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
194
-        }
195
-
196
-        $file_contents = str_replace($search, $replace, $file_contents);
197
-
198
-        $result = file_put_contents($file, $file_contents);
199
-
200
-        return (bool)$result;
201
-    }
202
-
203
-    //--------------------------------------------------------------------
204
-
205
-    /**
206
-     * Uses preg_replace to replace content within the file.
207
-     *
208
-     * @param $file
209
-     * @param $pattern
210
-     * @param $replace
211
-     * @return int
212
-     */
213
-    public function replaceWithRegex($file, $pattern, $replace)
214
-    {
215
-        $file_contents = file_get_contents($file);
216
-
217
-        if ($file_contents === false)
218
-        {
219
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
220
-        }
35
+	/**
36
+	 * Appends data to the end of a file.
37
+	 *
38
+	 * @param $file
39
+	 * @param $content
40
+	 * @return bool|int
41
+	 */
42
+	public function append($file, $content)
43
+	{
44
+		if (empty($content))
45
+		{
46
+			return true;
47
+		}
48
+
49
+		// Ensure that $content has a newline at the end
50
+		$content = rtrim($content) ."\n";
51
+
52
+		$fh = fopen($file, 'a');
53
+		$result = fwrite($fh, $content);
54
+		fclose($fh);
55
+
56
+		return $result;
57
+	}
58
+
59
+	//--------------------------------------------------------------------
60
+
61
+	/**
62
+	 * Prepends string content to a file. For very large files
63
+	 * this method could have memory issues, but the primary usage
64
+	 * of source files shouldn't ever get large enough to cause issues.
65
+	 *
66
+	 * @param $file
67
+	 * @param $content
68
+	 * @return bool|int
69
+	 */
70
+	public function prepend($file, $content)
71
+	{
72
+		if (empty($content))
73
+		{
74
+			return true;
75
+		}
76
+
77
+		// Ensure that $content has a newline at the end
78
+		$content = rtrim($content) ."\n";
79
+
80
+		$file_contents = file_get_contents($file);
81
+
82
+		if ($file_contents === false)
83
+		{
84
+			throw new \RuntimeException( sprintf(lang('errors.reading_file'), $file));
85
+		}
86
+
87
+		$result = file_put_contents($file, $content . $file_contents);
88
+
89
+		return (bool)$result;
90
+	}
91
+
92
+	//--------------------------------------------------------------------
93
+
94
+	/**
95
+	 * Inserts $content before the line that matches $before. NOT case-
96
+	 * sensitive.
97
+	 *
98
+	 * @param $file
99
+	 * @param $before
100
+	 * @param $content
101
+	 * @return int
102
+	 */
103
+	public function before($file, $before, $content)
104
+	{
105
+		if (empty($content))
106
+		{
107
+			return true;
108
+		}
109
+
110
+		// Ensure that $content has a newline at the end
111
+		$content = rtrim($content) ."\n";
112
+
113
+		$lines = file($file);
114
+
115
+		if ($lines === false)
116
+		{
117
+			throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ));
118
+		}
119
+
120
+		// Where to insert the row.
121
+		$location = null;
122
+
123
+		foreach ($lines as $index => $line)
124
+		{
125
+			if (strtolower($line) == strtolower($before) )
126
+			{
127
+				$location = $index;
128
+				break;
129
+			}
130
+		}
131
+
132
+		array_splice($lines, $location, 0, $content);
133
+
134
+		$result = file_put_contents($file, $lines);
135
+
136
+		return (bool)$result;
137
+	}
138
+
139
+	//--------------------------------------------------------------------
140
+
141
+	public function after($file, $after, $content)
142
+	{
143
+		if (empty($content))
144
+		{
145
+			return true;
146
+		}
147
+
148
+		// Ensure that $content has a newline at the end
149
+		$content = rtrim($content) ."\n";
150
+
151
+		$lines = file($file);
152
+
153
+		if ($lines === false)
154
+		{
155
+			throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ) );
156
+		}
157
+
158
+		// Where to insert the row.
159
+		$location = null;
160
+
161
+		foreach ($lines as $index => $line)
162
+		{
163
+			if (strtolower($line) == strtolower($after) )
164
+			{
165
+				$location = $index;
166
+				break;
167
+			}
168
+		}
169
+
170
+		array_splice($lines, $location +1, 0, $content);
171
+
172
+		$result = file_put_contents($file, $lines);
173
+
174
+		return (bool)$result;
175
+	}
176
+
177
+	//--------------------------------------------------------------------
178
+
179
+	/**
180
+	 * Replaces all instances of $search in the file with $replace.
181
+	 *
182
+	 * @param $file
183
+	 * @param $search
184
+	 * @param $replace
185
+	 * @return int
186
+	 */
187
+	public function replaceIn($file, $search, $replace)
188
+	{
189
+		$file_contents = file_get_contents($file);
190
+
191
+		if ($file_contents === false)
192
+		{
193
+			throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
194
+		}
195
+
196
+		$file_contents = str_replace($search, $replace, $file_contents);
197
+
198
+		$result = file_put_contents($file, $file_contents);
199
+
200
+		return (bool)$result;
201
+	}
202
+
203
+	//--------------------------------------------------------------------
204
+
205
+	/**
206
+	 * Uses preg_replace to replace content within the file.
207
+	 *
208
+	 * @param $file
209
+	 * @param $pattern
210
+	 * @param $replace
211
+	 * @return int
212
+	 */
213
+	public function replaceWithRegex($file, $pattern, $replace)
214
+	{
215
+		$file_contents = file_get_contents($file);
216
+
217
+		if ($file_contents === false)
218
+		{
219
+			throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
220
+		}
221 221
 
222
-        $file_contents = preg_replace($pattern, $replace, $file_contents);
223
-
224
-        $result = false;
222
+		$file_contents = preg_replace($pattern, $replace, $file_contents);
223
+
224
+		$result = false;
225 225
 
226
-        // Don't let us erase a file!
227
-        if (! empty($file_contents))
228
-        {
229
-            $result = file_put_contents( $file, $file_contents );
230
-        }
226
+		// Don't let us erase a file!
227
+		if (! empty($file_contents))
228
+		{
229
+			$result = file_put_contents( $file, $file_contents );
230
+		}
231 231
 
232
-        return (bool)$result;
233
-    }
232
+		return (bool)$result;
233
+	}
234 234
 
235
-    //--------------------------------------------------------------------
235
+	//--------------------------------------------------------------------
236 236
 
237 237
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         }
48 48
 
49 49
         // Ensure that $content has a newline at the end
50
-        $content = rtrim($content) ."\n";
50
+        $content = rtrim($content)."\n";
51 51
 
52 52
         $fh = fopen($file, 'a');
53 53
         $result = fwrite($fh, $content);
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
         }
76 76
 
77 77
         // Ensure that $content has a newline at the end
78
-        $content = rtrim($content) ."\n";
78
+        $content = rtrim($content)."\n";
79 79
 
80 80
         $file_contents = file_get_contents($file);
81 81
 
82 82
         if ($file_contents === false)
83 83
         {
84
-            throw new \RuntimeException( sprintf(lang('errors.reading_file'), $file));
84
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
85 85
         }
86 86
 
87
-        $result = file_put_contents($file, $content . $file_contents);
87
+        $result = file_put_contents($file, $content.$file_contents);
88 88
 
89
-        return (bool)$result;
89
+        return (bool) $result;
90 90
     }
91 91
 
92 92
     //--------------------------------------------------------------------
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         // Ensure that $content has a newline at the end
111
-        $content = rtrim($content) ."\n";
111
+        $content = rtrim($content)."\n";
112 112
 
113 113
         $lines = file($file);
114 114
 
115 115
         if ($lines === false)
116 116
         {
117
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ));
117
+            throw new \RuntimeException(sprintf(lang('errors.file_not_found'), $file));
118 118
         }
119 119
 
120 120
         // Where to insert the row.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
         foreach ($lines as $index => $line)
124 124
         {
125
-            if (strtolower($line) == strtolower($before) )
125
+            if (strtolower($line) == strtolower($before))
126 126
             {
127 127
                 $location = $index;
128 128
                 break;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
         $result = file_put_contents($file, $lines);
135 135
 
136
-        return (bool)$result;
136
+        return (bool) $result;
137 137
     }
138 138
 
139 139
     //--------------------------------------------------------------------
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
         // Ensure that $content has a newline at the end
149
-        $content = rtrim($content) ."\n";
149
+        $content = rtrim($content)."\n";
150 150
 
151 151
         $lines = file($file);
152 152
 
153 153
         if ($lines === false)
154 154
         {
155
-            throw new \RuntimeException( sprintf( lang('errors.file_not_found'), $file ) );
155
+            throw new \RuntimeException(sprintf(lang('errors.file_not_found'), $file));
156 156
         }
157 157
 
158 158
         // Where to insert the row.
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 
161 161
         foreach ($lines as $index => $line)
162 162
         {
163
-            if (strtolower($line) == strtolower($after) )
163
+            if (strtolower($line) == strtolower($after))
164 164
             {
165 165
                 $location = $index;
166 166
                 break;
167 167
             }
168 168
         }
169 169
 
170
-        array_splice($lines, $location +1, 0, $content);
170
+        array_splice($lines, $location + 1, 0, $content);
171 171
 
172 172
         $result = file_put_contents($file, $lines);
173 173
 
174
-        return (bool)$result;
174
+        return (bool) $result;
175 175
     }
176 176
 
177 177
     //--------------------------------------------------------------------
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 
191 191
         if ($file_contents === false)
192 192
         {
193
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
193
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
194 194
         }
195 195
 
196 196
         $file_contents = str_replace($search, $replace, $file_contents);
197 197
 
198 198
         $result = file_put_contents($file, $file_contents);
199 199
 
200
-        return (bool)$result;
200
+        return (bool) $result;
201 201
     }
202 202
 
203 203
     //--------------------------------------------------------------------
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         if ($file_contents === false)
218 218
         {
219
-            throw new \RuntimeException( sprintf( lang('errors.reading_file'), $file ) );
219
+            throw new \RuntimeException(sprintf(lang('errors.reading_file'), $file));
220 220
         }
221 221
 
222 222
         $file_contents = preg_replace($pattern, $replace, $file_contents);
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
         $result = false;
225 225
 
226 226
         // Don't let us erase a file!
227
-        if (! empty($file_contents))
227
+        if ( ! empty($file_contents))
228 228
         {
229
-            $result = file_put_contents( $file, $file_contents );
229
+            $result = file_put_contents($file, $file_contents);
230 230
         }
231 231
 
232
-        return (bool)$result;
232
+        return (bool) $result;
233 233
     }
234 234
 
235 235
     //--------------------------------------------------------------------
Please login to merge, or discard this patch.
myth/Mail/BaseMailer.php 3 patches
Indentation   +283 added lines, -283 removed lines patch added patch discarded remove patch
@@ -40,290 +40,290 @@
 block discarded – undo
40 40
  */
41 41
 class BaseMailer {
42 42
 
43
-    /**
44
-     * How the email is delivered.
45
-     * Either 'send' or 'queue'.
46
-     * @var string
47
-     */
48
-    protected $action = 'send';
49
-
50
-    protected $from     = null;
51
-    protected $to       = null;
52
-    protected $reply_to = null;
53
-    protected $cc       = null;
54
-    protected $bcc      = null;
55
-
56
-    protected $message  = null;
57
-
58
-    protected $theme    = 'email';
59
-    protected $layout   = 'index';
60
-    protected $view     = null;
61
-
62
-    /**
63
-     * The MailService to use. If NULL
64
-     * will use the system default.
65
-     * @var null
66
-     */
67
-    protected $service_name  = null;
68
-
69
-    protected $service = null;
70
-
71
-    /**
72
-     * Used for theming the email messages.
73
-     * @var null
74
-     */
75
-    protected $themer = null;
76
-
77
-    //--------------------------------------------------------------------
78
-
79
-    /**
80
-     * Constructor
81
-     *
82
-     * Simply allows us to override the default settings for this mailer.
83
-     *
84
-     * @param null $options
85
-     */
86
-    public function __construct($options=null)
87
-    {
88
-        if (! empty($options))
89
-        {
90
-            $this->setOptions($options);
91
-        }
92
-    }
93
-
94
-    //--------------------------------------------------------------------
95
-
96
-    /**
97
-     * Sets the basic options available to the mailer, like 'from', 'to',
98
-     * 'cc', 'bcc', etc.
99
-     *
100
-     * @param $options
101
-     */
102
-    public function setOptions($options)
103
-    {
104
-        if (is_array($options))
105
-        {
106
-            foreach ($options as $key => $value)
107
-            {
108
-                if ($key == 'service')
109
-                {
110
-                    $this->service =& $value;
111
-                    continue;
112
-                }
113
-
114
-                if (property_exists($this, $key))
115
-                {
116
-                    $this->$key = $value;
117
-                }
118
-            }
119
-        }
120
-    }
121
-
122
-    //--------------------------------------------------------------------
123
-
124
-
125
-
126
-    /**
127
-     * Sends an email immediately using the system-defined MailService.
128
-     *
129
-     * @param string $to // Who the email is being sent to.
130
-     * @param string $subject // The subject line for the email
131
-     * @param strign $data // the key/value pairs to send to the views.
132
-     * @param string $view // You can override the view used for the email here.
133
-     *                          // You can change themes by prepending theme name
134
-     *                          // like: 'newtheme:newview'
135
-     *
136
-     * @return bool
137
-     */
138
-    public function send($to, $subject, $data=[], $view=null)
139
-    {
140
-        // Are we pretending to send?
141
-        if (config_item('mail.pretend') === true)
142
-        {
143
-            return true;
144
-        }
145
-
146
-        $this->startMailService();
147
-
148
-        $this->service->to($to);
149
-        $this->service->subject($subject);
150
-
151
-        if (is_array($this->from)) {
152
-            $this->service->from($this->from[0], $this->from[1]);
153
-        }
154
-        else
155
-        {
156
-            $this->service->from($this->from);
157
-        }
158
-
159
-        if (! empty($this->cc))         $this->service->cc($this->cc);
160
-        if (! empty($this->bcc))        $this->service->bcc($this->bcc);
161
-
162
-        if (is_array($this->reply_to)) {
163
-            $this->service->reply_to($this->reply_to[0], $this->reply_to[1]);
164
-        }
165
-        else
166
-        {
167
-            $this->service->reply_to($this->reply_to);
168
-        }
169
-
170
-
171
-        // Determine the view to use. We have to hack this a bit with
172
-        // the debug_backtrace, though, to make it all function in the background.
173
-        list(, $method) = debug_backtrace(false);
174
-
175
-        $view = 'emails/'. strtolower( (new \ReflectionClass($this))->getShortName() ) .'/'. $method['function'];
176
-
177
-        // Get our message's text and html versions based on which files exist...
178
-        $basepath = APPPATH .'views/'. $view;
179
-
180
-        // Is a text version available?
181
-        if (file_exists($basepath .'.text.php'))
182
-        {
183
-            $text = $this->load->view($view .'.text.php', $data, true);
184
-            $this->service->text_message($text);
185
-        }
186
-
187
-        // If an html version is around, we need to theme it out
188
-        if (file_exists($basepath .'.html.php'))
189
-        {
190
-            $this->startThemer();
191
-
192
-            $this->themer->setTheme($this->theme);
193
-
194
-            // Determine the correct layout to use
195
-            $layout = ! empty($this->layout) ? $this->layout : NULL;
196
-            $this->themer->setLayout($layout);
197
-
198
-            $this->themer->set($data);
199
-
200
-            // Render the view into a var we can pass to the layout.
201
-            $content = $this->themer->display($view .'.html.php');
202
-
203
-            $this->themer->set('content', $content);
204
-
205
-            $this->service->html_message( $this->themer->display($this->theme .':'. $layout) );
206
-        }
207
-
208
-        if (! $this->service->send() )
209
-        {
210
-            // todo do something here
211
-            return false;
212
-        }
213
-
214
-        return true;
215
-    }
216
-
217
-    //--------------------------------------------------------------------
218
-
219
-    /**
220
-     * Allows you to customize the headers sent with the email. You can
221
-     * do them one at a time by passing $field and $value, or pass an array
222
-     * of $field => $value pairs as the first parameter.
223
-     *
224
-     * @param string|array  $field
225
-     * @param string        $value
226
-     */
227
-    public function header($field, $value=null)
228
-    {
229
-        $this->startMailService();
230
-
231
-        $this->service->setHeader($field, $value);
232
-    }
233
-
234
-    //--------------------------------------------------------------------
235
-
236
-    /**
237
-     * Adds an attachment to the current email that is being built.
238
-     *
239
-     * @param string    $filename
240
-     * @param string    $disposition    like 'inline'. Default is 'attachment'
241
-     * @param string    $newname        If you'd like to rename the file for delivery
242
-     * @param string    $mime           Custom defined mime type.
243
-     */
244
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
245
-    {
246
-        $this->startMailService();
247
-
248
-        $this->service->attach($filename, $disposition, $newname, $mime);
249
-    }
250
-
251
-    //--------------------------------------------------------------------
252
-
253
-    //--------------------------------------------------------------------
254
-    // Private Methods
255
-    //--------------------------------------------------------------------
256
-
257
-    /**
258
-     * Starts up the service name specified in $service_name.
259
-     *
260
-     * @param $service_name
261
-     */
262
-    protected function startMailService()
263
-    {
264
-        // Only once!
265
-        if (! empty($this->service) && is_object($this->service))
266
-        {
267
-            return;
268
-        }
269
-
270
-        $service_name = ! empty($this->service_name) ? $this->service_name : config_item('mail.default_service');
271
-
272
-        if (! class_exists($service_name))
273
-        {
274
-            throw new \RuntimeException( sprintf( lang('mail.invalid_service'), $service_name) );
275
-        }
276
-
277
-        $this->service = new $service_name();
278
-    }
279
-
280
-    //--------------------------------------------------------------------
281
-
282
-    /**
283
-     * Fires up the default themer so we can use it to theme our HTML messages.
284
-     */
285
-    protected function startThemer()
286
-    {
287
-        /*
43
+	/**
44
+	 * How the email is delivered.
45
+	 * Either 'send' or 'queue'.
46
+	 * @var string
47
+	 */
48
+	protected $action = 'send';
49
+
50
+	protected $from     = null;
51
+	protected $to       = null;
52
+	protected $reply_to = null;
53
+	protected $cc       = null;
54
+	protected $bcc      = null;
55
+
56
+	protected $message  = null;
57
+
58
+	protected $theme    = 'email';
59
+	protected $layout   = 'index';
60
+	protected $view     = null;
61
+
62
+	/**
63
+	 * The MailService to use. If NULL
64
+	 * will use the system default.
65
+	 * @var null
66
+	 */
67
+	protected $service_name  = null;
68
+
69
+	protected $service = null;
70
+
71
+	/**
72
+	 * Used for theming the email messages.
73
+	 * @var null
74
+	 */
75
+	protected $themer = null;
76
+
77
+	//--------------------------------------------------------------------
78
+
79
+	/**
80
+	 * Constructor
81
+	 *
82
+	 * Simply allows us to override the default settings for this mailer.
83
+	 *
84
+	 * @param null $options
85
+	 */
86
+	public function __construct($options=null)
87
+	{
88
+		if (! empty($options))
89
+		{
90
+			$this->setOptions($options);
91
+		}
92
+	}
93
+
94
+	//--------------------------------------------------------------------
95
+
96
+	/**
97
+	 * Sets the basic options available to the mailer, like 'from', 'to',
98
+	 * 'cc', 'bcc', etc.
99
+	 *
100
+	 * @param $options
101
+	 */
102
+	public function setOptions($options)
103
+	{
104
+		if (is_array($options))
105
+		{
106
+			foreach ($options as $key => $value)
107
+			{
108
+				if ($key == 'service')
109
+				{
110
+					$this->service =& $value;
111
+					continue;
112
+				}
113
+
114
+				if (property_exists($this, $key))
115
+				{
116
+					$this->$key = $value;
117
+				}
118
+			}
119
+		}
120
+	}
121
+
122
+	//--------------------------------------------------------------------
123
+
124
+
125
+
126
+	/**
127
+	 * Sends an email immediately using the system-defined MailService.
128
+	 *
129
+	 * @param string $to // Who the email is being sent to.
130
+	 * @param string $subject // The subject line for the email
131
+	 * @param strign $data // the key/value pairs to send to the views.
132
+	 * @param string $view // You can override the view used for the email here.
133
+	 *                          // You can change themes by prepending theme name
134
+	 *                          // like: 'newtheme:newview'
135
+	 *
136
+	 * @return bool
137
+	 */
138
+	public function send($to, $subject, $data=[], $view=null)
139
+	{
140
+		// Are we pretending to send?
141
+		if (config_item('mail.pretend') === true)
142
+		{
143
+			return true;
144
+		}
145
+
146
+		$this->startMailService();
147
+
148
+		$this->service->to($to);
149
+		$this->service->subject($subject);
150
+
151
+		if (is_array($this->from)) {
152
+			$this->service->from($this->from[0], $this->from[1]);
153
+		}
154
+		else
155
+		{
156
+			$this->service->from($this->from);
157
+		}
158
+
159
+		if (! empty($this->cc))         $this->service->cc($this->cc);
160
+		if (! empty($this->bcc))        $this->service->bcc($this->bcc);
161
+
162
+		if (is_array($this->reply_to)) {
163
+			$this->service->reply_to($this->reply_to[0], $this->reply_to[1]);
164
+		}
165
+		else
166
+		{
167
+			$this->service->reply_to($this->reply_to);
168
+		}
169
+
170
+
171
+		// Determine the view to use. We have to hack this a bit with
172
+		// the debug_backtrace, though, to make it all function in the background.
173
+		list(, $method) = debug_backtrace(false);
174
+
175
+		$view = 'emails/'. strtolower( (new \ReflectionClass($this))->getShortName() ) .'/'. $method['function'];
176
+
177
+		// Get our message's text and html versions based on which files exist...
178
+		$basepath = APPPATH .'views/'. $view;
179
+
180
+		// Is a text version available?
181
+		if (file_exists($basepath .'.text.php'))
182
+		{
183
+			$text = $this->load->view($view .'.text.php', $data, true);
184
+			$this->service->text_message($text);
185
+		}
186
+
187
+		// If an html version is around, we need to theme it out
188
+		if (file_exists($basepath .'.html.php'))
189
+		{
190
+			$this->startThemer();
191
+
192
+			$this->themer->setTheme($this->theme);
193
+
194
+			// Determine the correct layout to use
195
+			$layout = ! empty($this->layout) ? $this->layout : NULL;
196
+			$this->themer->setLayout($layout);
197
+
198
+			$this->themer->set($data);
199
+
200
+			// Render the view into a var we can pass to the layout.
201
+			$content = $this->themer->display($view .'.html.php');
202
+
203
+			$this->themer->set('content', $content);
204
+
205
+			$this->service->html_message( $this->themer->display($this->theme .':'. $layout) );
206
+		}
207
+
208
+		if (! $this->service->send() )
209
+		{
210
+			// todo do something here
211
+			return false;
212
+		}
213
+
214
+		return true;
215
+	}
216
+
217
+	//--------------------------------------------------------------------
218
+
219
+	/**
220
+	 * Allows you to customize the headers sent with the email. You can
221
+	 * do them one at a time by passing $field and $value, or pass an array
222
+	 * of $field => $value pairs as the first parameter.
223
+	 *
224
+	 * @param string|array  $field
225
+	 * @param string        $value
226
+	 */
227
+	public function header($field, $value=null)
228
+	{
229
+		$this->startMailService();
230
+
231
+		$this->service->setHeader($field, $value);
232
+	}
233
+
234
+	//--------------------------------------------------------------------
235
+
236
+	/**
237
+	 * Adds an attachment to the current email that is being built.
238
+	 *
239
+	 * @param string    $filename
240
+	 * @param string    $disposition    like 'inline'. Default is 'attachment'
241
+	 * @param string    $newname        If you'd like to rename the file for delivery
242
+	 * @param string    $mime           Custom defined mime type.
243
+	 */
244
+	public function attach($filename, $disposition=null, $newname=null, $mime=null)
245
+	{
246
+		$this->startMailService();
247
+
248
+		$this->service->attach($filename, $disposition, $newname, $mime);
249
+	}
250
+
251
+	//--------------------------------------------------------------------
252
+
253
+	//--------------------------------------------------------------------
254
+	// Private Methods
255
+	//--------------------------------------------------------------------
256
+
257
+	/**
258
+	 * Starts up the service name specified in $service_name.
259
+	 *
260
+	 * @param $service_name
261
+	 */
262
+	protected function startMailService()
263
+	{
264
+		// Only once!
265
+		if (! empty($this->service) && is_object($this->service))
266
+		{
267
+			return;
268
+		}
269
+
270
+		$service_name = ! empty($this->service_name) ? $this->service_name : config_item('mail.default_service');
271
+
272
+		if (! class_exists($service_name))
273
+		{
274
+			throw new \RuntimeException( sprintf( lang('mail.invalid_service'), $service_name) );
275
+		}
276
+
277
+		$this->service = new $service_name();
278
+	}
279
+
280
+	//--------------------------------------------------------------------
281
+
282
+	/**
283
+	 * Fires up the default themer so we can use it to theme our HTML messages.
284
+	 */
285
+	protected function startThemer()
286
+	{
287
+		/*
288 288
          * Setup our Template Engine
289 289
          */
290
-        $themer = config_item('active_themer');
291
-
292
-        if (empty($themer)) {
293
-            throw new \RuntimeException( lang('no_themer') );
294
-        }
295
-
296
-        if (empty($this->themer))
297
-        {
298
-            $this->themer = new $themer( get_instance() );
299
-        }
300
-
301
-        // Register our paths with the themer
302
-        $paths = config_item('theme.paths');
303
-
304
-        foreach ($paths as $key => $path) {
305
-            $this->themer->addThemePath($key, $path);
306
-        }
307
-
308
-        // Set our default theme.
309
-        $this->themer->setDefaultTheme( 'email' );
310
-    }
311
-
312
-    //--------------------------------------------------------------------
313
-
314
-    /**
315
-     * __get magic
316
-     *
317
-     * Allows models to access CI's loaded classes using the same
318
-     * syntax as controllers.
319
-     *
320
-     * @param	string	$key
321
-     */
322
-    public function __get($key)
323
-    {
324
-        return get_instance()->$key;
325
-    }
326
-
327
-    //--------------------------------------------------------------------
290
+		$themer = config_item('active_themer');
291
+
292
+		if (empty($themer)) {
293
+			throw new \RuntimeException( lang('no_themer') );
294
+		}
295
+
296
+		if (empty($this->themer))
297
+		{
298
+			$this->themer = new $themer( get_instance() );
299
+		}
300
+
301
+		// Register our paths with the themer
302
+		$paths = config_item('theme.paths');
303
+
304
+		foreach ($paths as $key => $path) {
305
+			$this->themer->addThemePath($key, $path);
306
+		}
307
+
308
+		// Set our default theme.
309
+		$this->themer->setDefaultTheme( 'email' );
310
+	}
311
+
312
+	//--------------------------------------------------------------------
313
+
314
+	/**
315
+	 * __get magic
316
+	 *
317
+	 * Allows models to access CI's loaded classes using the same
318
+	 * syntax as controllers.
319
+	 *
320
+	 * @param	string	$key
321
+	 */
322
+	public function __get($key)
323
+	{
324
+		return get_instance()->$key;
325
+	}
326
+
327
+	//--------------------------------------------------------------------
328 328
 
329 329
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * will use the system default.
65 65
      * @var null
66 66
      */
67
-    protected $service_name  = null;
67
+    protected $service_name = null;
68 68
 
69 69
     protected $service = null;
70 70
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @param null $options
85 85
      */
86
-    public function __construct($options=null)
86
+    public function __construct($options = null)
87 87
     {
88
-        if (! empty($options))
88
+        if ( ! empty($options))
89 89
         {
90 90
             $this->setOptions($options);
91 91
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             {
108 108
                 if ($key == 'service')
109 109
                 {
110
-                    $this->service =& $value;
110
+                    $this->service = & $value;
111 111
                     continue;
112 112
                 }
113 113
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      *
136 136
      * @return bool
137 137
      */
138
-    public function send($to, $subject, $data=[], $view=null)
138
+    public function send($to, $subject, $data = [], $view = null)
139 139
     {
140 140
         // Are we pretending to send?
141 141
         if (config_item('mail.pretend') === true)
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
             $this->service->from($this->from);
157 157
         }
158 158
 
159
-        if (! empty($this->cc))         $this->service->cc($this->cc);
160
-        if (! empty($this->bcc))        $this->service->bcc($this->bcc);
159
+        if ( ! empty($this->cc))         $this->service->cc($this->cc);
160
+        if ( ! empty($this->bcc))        $this->service->bcc($this->bcc);
161 161
 
162 162
         if (is_array($this->reply_to)) {
163 163
             $this->service->reply_to($this->reply_to[0], $this->reply_to[1]);
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         // the debug_backtrace, though, to make it all function in the background.
173 173
         list(, $method) = debug_backtrace(false);
174 174
 
175
-        $view = 'emails/'. strtolower( (new \ReflectionClass($this))->getShortName() ) .'/'. $method['function'];
175
+        $view = 'emails/'.strtolower((new \ReflectionClass($this))->getShortName()).'/'.$method['function'];
176 176
 
177 177
         // Get our message's text and html versions based on which files exist...
178
-        $basepath = APPPATH .'views/'. $view;
178
+        $basepath = APPPATH.'views/'.$view;
179 179
 
180 180
         // Is a text version available?
181
-        if (file_exists($basepath .'.text.php'))
181
+        if (file_exists($basepath.'.text.php'))
182 182
         {
183
-            $text = $this->load->view($view .'.text.php', $data, true);
183
+            $text = $this->load->view($view.'.text.php', $data, true);
184 184
             $this->service->text_message($text);
185 185
         }
186 186
 
187 187
         // If an html version is around, we need to theme it out
188
-        if (file_exists($basepath .'.html.php'))
188
+        if (file_exists($basepath.'.html.php'))
189 189
         {
190 190
             $this->startThemer();
191 191
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
             $this->themer->set($data);
199 199
 
200 200
             // Render the view into a var we can pass to the layout.
201
-            $content = $this->themer->display($view .'.html.php');
201
+            $content = $this->themer->display($view.'.html.php');
202 202
 
203 203
             $this->themer->set('content', $content);
204 204
 
205
-            $this->service->html_message( $this->themer->display($this->theme .':'. $layout) );
205
+            $this->service->html_message($this->themer->display($this->theme.':'.$layout));
206 206
         }
207 207
 
208
-        if (! $this->service->send() )
208
+        if ( ! $this->service->send())
209 209
         {
210 210
             // todo do something here
211 211
             return false;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param string|array  $field
225 225
      * @param string        $value
226 226
      */
227
-    public function header($field, $value=null)
227
+    public function header($field, $value = null)
228 228
     {
229 229
         $this->startMailService();
230 230
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      * @param string    $newname        If you'd like to rename the file for delivery
242 242
      * @param string    $mime           Custom defined mime type.
243 243
      */
244
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
244
+    public function attach($filename, $disposition = null, $newname = null, $mime = null)
245 245
     {
246 246
         $this->startMailService();
247 247
 
@@ -262,16 +262,16 @@  discard block
 block discarded – undo
262 262
     protected function startMailService()
263 263
     {
264 264
         // Only once!
265
-        if (! empty($this->service) && is_object($this->service))
265
+        if ( ! empty($this->service) && is_object($this->service))
266 266
         {
267 267
             return;
268 268
         }
269 269
 
270 270
         $service_name = ! empty($this->service_name) ? $this->service_name : config_item('mail.default_service');
271 271
 
272
-        if (! class_exists($service_name))
272
+        if ( ! class_exists($service_name))
273 273
         {
274
-            throw new \RuntimeException( sprintf( lang('mail.invalid_service'), $service_name) );
274
+            throw new \RuntimeException(sprintf(lang('mail.invalid_service'), $service_name));
275 275
         }
276 276
 
277 277
         $this->service = new $service_name();
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
         $themer = config_item('active_themer');
291 291
 
292 292
         if (empty($themer)) {
293
-            throw new \RuntimeException( lang('no_themer') );
293
+            throw new \RuntimeException(lang('no_themer'));
294 294
         }
295 295
 
296 296
         if (empty($this->themer))
297 297
         {
298
-            $this->themer = new $themer( get_instance() );
298
+            $this->themer = new $themer(get_instance());
299 299
         }
300 300
 
301 301
         // Register our paths with the themer
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         }
307 307
 
308 308
         // Set our default theme.
309
-        $this->themer->setDefaultTheme( 'email' );
309
+        $this->themer->setDefaultTheme('email');
310 310
     }
311 311
 
312 312
     //--------------------------------------------------------------------
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -150,19 +150,21 @@
 block discarded – undo
150 150
 
151 151
         if (is_array($this->from)) {
152 152
             $this->service->from($this->from[0], $this->from[1]);
153
-        }
154
-        else
153
+        } else
155 154
         {
156 155
             $this->service->from($this->from);
157 156
         }
158 157
 
159
-        if (! empty($this->cc))         $this->service->cc($this->cc);
160
-        if (! empty($this->bcc))        $this->service->bcc($this->bcc);
158
+        if (! empty($this->cc)) {
159
+        	$this->service->cc($this->cc);
160
+        }
161
+        if (! empty($this->bcc)) {
162
+        	$this->service->bcc($this->bcc);
163
+        }
161 164
 
162 165
         if (is_array($this->reply_to)) {
163 166
             $this->service->reply_to($this->reply_to[0], $this->reply_to[1]);
164
-        }
165
-        else
167
+        } else
166 168
         {
167 169
             $this->service->reply_to($this->reply_to);
168 170
         }
Please login to merge, or discard this patch.
myth/Mail/CIMailService.php 2 patches
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -40,226 +40,226 @@
 block discarded – undo
40 40
  */
41 41
 class CIMailService implements MailServiceInterface {
42 42
 
43
-    protected $ci = null;
44
-
45
-    protected $format = 'html';
46
-
47
-    //--------------------------------------------------------------------
48
-
49
-    public function __construct()
50
-    {
51
-        $this->ci =& get_instance();
52
-
53
-        $this->ci->load->library('email');
54
-    }
55
-
56
-    //--------------------------------------------------------------------
57
-
58
-
59
-    /**
60
-     * Does the actual delivery of a message.
61
-     *
62
-     * @param bool  $clear_after    If TRUE, will reset the class after sending.
63
-     *
64
-     * @return mixed
65
-     */
66
-    public function send($clear_after=true)
67
-    {
68
-        $this->ci->email->mailtype = $this->format;
69
-
70
-        $result = $this->ci->email->send(false);
71
-
72
-        return $result;
73
-    }
74
-
75
-    //--------------------------------------------------------------------
76
-
77
-    /**
78
-     * Adds an attachment to the current email that is being built.
79
-     *
80
-     * @param string    $filename
81
-     * @param string    $disposition    like 'inline'. Default is 'attachment'
82
-     * @param string    $newname        If you'd like to rename the file for delivery
83
-     * @param string    $mime           Custom defined mime type.
84
-     */
85
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
86
-    {
87
-        $this->ci->email->attach($filename, $disposition, $newname, $mime);
88
-    }
89
-
90
-    //--------------------------------------------------------------------
91
-
92
-    /**
93
-     * Sets a header value for the email. Not every service will provide this.
94
-     *
95
-     * @param $field
96
-     * @param $value
97
-     * @return mixed
98
-     */
99
-    public function setHeader($field, $value)
100
-    {
101
-        $this->ci->email->set_header($field, $value);
102
-
103
-        return $this;
104
-    }
105
-
106
-    //--------------------------------------------------------------------
107
-
108
-    //--------------------------------------------------------------------
109
-    // Options
110
-    //--------------------------------------------------------------------
111
-
112
-    /**
113
-     * Sets the email address to send the email to.
114
-     *
115
-     * @param $email
116
-     * @return mixed
117
-     */
118
-    public function to($email)
119
-    {
120
-        $this->ci->email->to($email);
121
-
122
-        return $this;
123
-    }
124
-
125
-    //--------------------------------------------------------------------
126
-
127
-    /**
128
-     * Sets who the email is coming from.
129
-     *
130
-     * @param $email
131
-     * @param null $name
132
-     * @return mixed
133
-     */
134
-    public function from($email, $name=null)
135
-    {
136
-        $this->ci->email->from($email, $name);
137
-
138
-        return $this;
139
-    }
140
-
141
-    //--------------------------------------------------------------------
142
-
143
-    /**
144
-     * Sets a single additional email address to 'cc'.
145
-     *
146
-     * @param $email
147
-     * @return mixed
148
-     */
149
-    public function cc($email)
150
-    {
151
-        $this->ci->email->cc($email);
152
-
153
-        return $this;
154
-    }
155
-
156
-    //--------------------------------------------------------------------
157
-
158
-    /**
159
-     * Sets a single email address to 'bcc' to.
160
-     *
161
-     * @param $email
162
-     * @return mixed
163
-     */
164
-    public function bcc($email)
165
-    {
166
-        $this->ci->email->bcc($email);
167
-
168
-        return $this;
169
-    }
170
-
171
-    //--------------------------------------------------------------------
172
-
173
-    /**
174
-     * Sets the reply to address.
175
-     *
176
-     * @param $email
177
-     * @return mixed
178
-     */
179
-    public function reply_to($email, $name=null)
180
-    {
181
-        $this->ci->email->reply_to($email, $name);
182
-    }
183
-
184
-    //--------------------------------------------------------------------
185
-
186
-    /**
187
-     * Sets the subject line of the email.
188
-     *
189
-     * @param $subject
190
-     * @return mixed
191
-     */
192
-    public function subject($subject)
193
-    {
194
-        $this->ci->email->subject($subject);
195
-
196
-        return $this;
197
-    }
198
-
199
-    //--------------------------------------------------------------------
200
-
201
-    /**
202
-     * Sets the HTML portion of the email address. Optional.
203
-     *
204
-     * @param $message
205
-     * @return mixed
206
-     */
207
-    public function html_message($message)
208
-    {
209
-        $this->ci->email->message($message);
210
-
211
-        $this->format = 'html';
212
-
213
-        return $this;
214
-    }
215
-
216
-    //--------------------------------------------------------------------
217
-
218
-    /**
219
-     * Sets the text portion of the email address. Optional.
220
-     *
221
-     * @param $message
222
-     * @return mixed
223
-     */
224
-    public function text_message($message)
225
-    {
226
-        $this->ci->email->set_alt_message($message);
227
-
228
-        $this->format = 'text';
229
-
230
-        return $this;
231
-    }
232
-
233
-    //--------------------------------------------------------------------
234
-
235
-    /**
236
-     * Sets the format to send the email in. Either 'html' or 'text'.
237
-     *
238
-     * @param $format
239
-     * @return mixed
240
-     */
241
-    public function format($format)
242
-    {
243
-        $this->format = $format;
244
-
245
-        return $this;
246
-    }
247
-
248
-    //--------------------------------------------------------------------
249
-    /**
250
-     * Resets the state to blank, ready for a new email. Useful when
251
-     * sending emails in a loop and you need to make sure that the
252
-     * email is reset.
253
-     *
254
-     * @param bool $clear_attachments
255
-     * @return mixed
256
-     */
257
-    public function reset($clear_attachments=true)
258
-    {
259
-        $this->ci->email->clear($clear_attachments);
260
-
261
-        return $this;
262
-    }
263
-
264
-    //--------------------------------------------------------------------
43
+	protected $ci = null;
44
+
45
+	protected $format = 'html';
46
+
47
+	//--------------------------------------------------------------------
48
+
49
+	public function __construct()
50
+	{
51
+		$this->ci =& get_instance();
52
+
53
+		$this->ci->load->library('email');
54
+	}
55
+
56
+	//--------------------------------------------------------------------
57
+
58
+
59
+	/**
60
+	 * Does the actual delivery of a message.
61
+	 *
62
+	 * @param bool  $clear_after    If TRUE, will reset the class after sending.
63
+	 *
64
+	 * @return mixed
65
+	 */
66
+	public function send($clear_after=true)
67
+	{
68
+		$this->ci->email->mailtype = $this->format;
69
+
70
+		$result = $this->ci->email->send(false);
71
+
72
+		return $result;
73
+	}
74
+
75
+	//--------------------------------------------------------------------
76
+
77
+	/**
78
+	 * Adds an attachment to the current email that is being built.
79
+	 *
80
+	 * @param string    $filename
81
+	 * @param string    $disposition    like 'inline'. Default is 'attachment'
82
+	 * @param string    $newname        If you'd like to rename the file for delivery
83
+	 * @param string    $mime           Custom defined mime type.
84
+	 */
85
+	public function attach($filename, $disposition=null, $newname=null, $mime=null)
86
+	{
87
+		$this->ci->email->attach($filename, $disposition, $newname, $mime);
88
+	}
89
+
90
+	//--------------------------------------------------------------------
91
+
92
+	/**
93
+	 * Sets a header value for the email. Not every service will provide this.
94
+	 *
95
+	 * @param $field
96
+	 * @param $value
97
+	 * @return mixed
98
+	 */
99
+	public function setHeader($field, $value)
100
+	{
101
+		$this->ci->email->set_header($field, $value);
102
+
103
+		return $this;
104
+	}
105
+
106
+	//--------------------------------------------------------------------
107
+
108
+	//--------------------------------------------------------------------
109
+	// Options
110
+	//--------------------------------------------------------------------
111
+
112
+	/**
113
+	 * Sets the email address to send the email to.
114
+	 *
115
+	 * @param $email
116
+	 * @return mixed
117
+	 */
118
+	public function to($email)
119
+	{
120
+		$this->ci->email->to($email);
121
+
122
+		return $this;
123
+	}
124
+
125
+	//--------------------------------------------------------------------
126
+
127
+	/**
128
+	 * Sets who the email is coming from.
129
+	 *
130
+	 * @param $email
131
+	 * @param null $name
132
+	 * @return mixed
133
+	 */
134
+	public function from($email, $name=null)
135
+	{
136
+		$this->ci->email->from($email, $name);
137
+
138
+		return $this;
139
+	}
140
+
141
+	//--------------------------------------------------------------------
142
+
143
+	/**
144
+	 * Sets a single additional email address to 'cc'.
145
+	 *
146
+	 * @param $email
147
+	 * @return mixed
148
+	 */
149
+	public function cc($email)
150
+	{
151
+		$this->ci->email->cc($email);
152
+
153
+		return $this;
154
+	}
155
+
156
+	//--------------------------------------------------------------------
157
+
158
+	/**
159
+	 * Sets a single email address to 'bcc' to.
160
+	 *
161
+	 * @param $email
162
+	 * @return mixed
163
+	 */
164
+	public function bcc($email)
165
+	{
166
+		$this->ci->email->bcc($email);
167
+
168
+		return $this;
169
+	}
170
+
171
+	//--------------------------------------------------------------------
172
+
173
+	/**
174
+	 * Sets the reply to address.
175
+	 *
176
+	 * @param $email
177
+	 * @return mixed
178
+	 */
179
+	public function reply_to($email, $name=null)
180
+	{
181
+		$this->ci->email->reply_to($email, $name);
182
+	}
183
+
184
+	//--------------------------------------------------------------------
185
+
186
+	/**
187
+	 * Sets the subject line of the email.
188
+	 *
189
+	 * @param $subject
190
+	 * @return mixed
191
+	 */
192
+	public function subject($subject)
193
+	{
194
+		$this->ci->email->subject($subject);
195
+
196
+		return $this;
197
+	}
198
+
199
+	//--------------------------------------------------------------------
200
+
201
+	/**
202
+	 * Sets the HTML portion of the email address. Optional.
203
+	 *
204
+	 * @param $message
205
+	 * @return mixed
206
+	 */
207
+	public function html_message($message)
208
+	{
209
+		$this->ci->email->message($message);
210
+
211
+		$this->format = 'html';
212
+
213
+		return $this;
214
+	}
215
+
216
+	//--------------------------------------------------------------------
217
+
218
+	/**
219
+	 * Sets the text portion of the email address. Optional.
220
+	 *
221
+	 * @param $message
222
+	 * @return mixed
223
+	 */
224
+	public function text_message($message)
225
+	{
226
+		$this->ci->email->set_alt_message($message);
227
+
228
+		$this->format = 'text';
229
+
230
+		return $this;
231
+	}
232
+
233
+	//--------------------------------------------------------------------
234
+
235
+	/**
236
+	 * Sets the format to send the email in. Either 'html' or 'text'.
237
+	 *
238
+	 * @param $format
239
+	 * @return mixed
240
+	 */
241
+	public function format($format)
242
+	{
243
+		$this->format = $format;
244
+
245
+		return $this;
246
+	}
247
+
248
+	//--------------------------------------------------------------------
249
+	/**
250
+	 * Resets the state to blank, ready for a new email. Useful when
251
+	 * sending emails in a loop and you need to make sure that the
252
+	 * email is reset.
253
+	 *
254
+	 * @param bool $clear_attachments
255
+	 * @return mixed
256
+	 */
257
+	public function reset($clear_attachments=true)
258
+	{
259
+		$this->ci->email->clear($clear_attachments);
260
+
261
+		return $this;
262
+	}
263
+
264
+	//--------------------------------------------------------------------
265 265
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function __construct()
50 50
     {
51
-        $this->ci =& get_instance();
51
+        $this->ci = & get_instance();
52 52
 
53 53
         $this->ci->load->library('email');
54 54
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return mixed
65 65
      */
66
-    public function send($clear_after=true)
66
+    public function send($clear_after = true)
67 67
     {
68 68
         $this->ci->email->mailtype = $this->format;
69 69
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param string    $newname        If you'd like to rename the file for delivery
83 83
      * @param string    $mime           Custom defined mime type.
84 84
      */
85
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
85
+    public function attach($filename, $disposition = null, $newname = null, $mime = null)
86 86
     {
87 87
         $this->ci->email->attach($filename, $disposition, $newname, $mime);
88 88
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param null $name
132 132
      * @return mixed
133 133
      */
134
-    public function from($email, $name=null)
134
+    public function from($email, $name = null)
135 135
     {
136 136
         $this->ci->email->from($email, $name);
137 137
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      * @param $email
177 177
      * @return mixed
178 178
      */
179
-    public function reply_to($email, $name=null)
179
+    public function reply_to($email, $name = null)
180 180
     {
181 181
         $this->ci->email->reply_to($email, $name);
182 182
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      * @param bool $clear_attachments
255 255
      * @return mixed
256 256
      */
257
-    public function reset($clear_attachments=true)
257
+    public function reset($clear_attachments = true)
258 258
     {
259 259
         $this->ci->email->clear($clear_attachments);
260 260
 
Please login to merge, or discard this patch.
myth/Mail/MailServiceInterface.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -42,145 +42,145 @@
 block discarded – undo
42 42
  */
43 43
 interface MailServiceInterface {
44 44
 
45
-    /**
46
-     * Does the actual delivery of a message.
47
-     *
48
-     * @param bool  $clear_after    If TRUE, will reset the class after sending.
49
-     *
50
-     * @return mixed
51
-     */
52
-    public function send($clear_after=true);
53
-
54
-    //--------------------------------------------------------------------
55
-
56
-    /**
57
-     * Adds an attachment to the current email that is being built.
58
-     *
59
-     * @param string    $filename
60
-     * @param string    $disposition    like 'inline'. Default is 'attachment'
61
-     * @param string    $newname        If you'd like to rename the file for delivery
62
-     * @param string    $mime           Custom defined mime type.
63
-     */
64
-    public function attach($filename, $disposition=null, $newname=null, $mime=null);
65
-
66
-    //--------------------------------------------------------------------
67
-
68
-    /**
69
-     * Sets a header value for the email. Not every service will provide this.
70
-     *
71
-     * @param $field
72
-     * @param $value
73
-     * @return mixed
74
-     */
75
-    public function setHeader($field, $value);
76
-
77
-    //--------------------------------------------------------------------
78
-
79
-    //--------------------------------------------------------------------
80
-    // Options
81
-    //--------------------------------------------------------------------
82
-
83
-    /**
84
-     * Sets the email address to send the email to.
85
-     *
86
-     * @param $email
87
-     * @return mixed
88
-     */
89
-    public function to($email);
45
+	/**
46
+	 * Does the actual delivery of a message.
47
+	 *
48
+	 * @param bool  $clear_after    If TRUE, will reset the class after sending.
49
+	 *
50
+	 * @return mixed
51
+	 */
52
+	public function send($clear_after=true);
53
+
54
+	//--------------------------------------------------------------------
55
+
56
+	/**
57
+	 * Adds an attachment to the current email that is being built.
58
+	 *
59
+	 * @param string    $filename
60
+	 * @param string    $disposition    like 'inline'. Default is 'attachment'
61
+	 * @param string    $newname        If you'd like to rename the file for delivery
62
+	 * @param string    $mime           Custom defined mime type.
63
+	 */
64
+	public function attach($filename, $disposition=null, $newname=null, $mime=null);
65
+
66
+	//--------------------------------------------------------------------
67
+
68
+	/**
69
+	 * Sets a header value for the email. Not every service will provide this.
70
+	 *
71
+	 * @param $field
72
+	 * @param $value
73
+	 * @return mixed
74
+	 */
75
+	public function setHeader($field, $value);
76
+
77
+	//--------------------------------------------------------------------
78
+
79
+	//--------------------------------------------------------------------
80
+	// Options
81
+	//--------------------------------------------------------------------
82
+
83
+	/**
84
+	 * Sets the email address to send the email to.
85
+	 *
86
+	 * @param $email
87
+	 * @return mixed
88
+	 */
89
+	public function to($email);
90 90
     
91
-    //--------------------------------------------------------------------
92
-
93
-    /**
94
-     * Sets who the email is coming from.
95
-     *
96
-     * @param $email
97
-     * @param null $name
98
-     * @return mixed
99
-     */
100
-    public function from($email, $name=null);
101
-
102
-    //--------------------------------------------------------------------
103
-
104
-    /**
105
-     * Sets a single additional email address to 'cc'.
106
-     *
107
-     * @param $email
108
-     * @return mixed
109
-     */
110
-    public function cc($email);
111
-
112
-    //--------------------------------------------------------------------
113
-
114
-    /**
115
-     * Sets a single email address to 'bcc' to.
116
-     *
117
-     * @param $email
118
-     * @return mixed
119
-     */
120
-    public function bcc($email);
121
-
122
-    //--------------------------------------------------------------------
123
-
124
-    /**
125
-     * Sets the reply to address.
126
-     *
127
-     * @param $email
128
-     * @param $name
129
-     * @return mixed
130
-     */
131
-    public function reply_to($email, $name=null);
132
-
133
-    //--------------------------------------------------------------------
134
-
135
-    /**
136
-     * Sets the subject line of the email.
137
-     *
138
-     * @param $subject
139
-     * @return mixed
140
-     */
141
-    public function subject($subject);
142
-
143
-    //--------------------------------------------------------------------
144
-
145
-    /**
146
-     * Sets the HTML portion of the email address. Optional.
147
-     *
148
-     * @param $message
149
-     * @return mixed
150
-     */
151
-    public function html_message($message);
152
-
153
-    //--------------------------------------------------------------------
154
-
155
-    /**
156
-     * Sets the text portion of the email address. Optional.
157
-     *
158
-     * @param $message
159
-     * @return mixed
160
-     */
161
-    public function text_message($message);
162
-
163
-    //--------------------------------------------------------------------
164
-
165
-    /**
166
-     * Sets the format to send the email in. Either 'html' or 'text'.
167
-     *
168
-     * @param $format
169
-     * @return mixed
170
-     */
171
-    public function format($format);
172
-
173
-    //--------------------------------------------------------------------
174
-
175
-    /**
176
-     * Resets the state to blank, ready for a new email. Useful when
177
-     * sending emails in a loop and you need to make sure that the
178
-     * email is reset.
179
-     *
180
-     * @param bool $clear_attachments
181
-     * @return mixed
182
-     */
183
-    public function reset($clear_attachments=true);
184
-
185
-    //--------------------------------------------------------------------
91
+	//--------------------------------------------------------------------
92
+
93
+	/**
94
+	 * Sets who the email is coming from.
95
+	 *
96
+	 * @param $email
97
+	 * @param null $name
98
+	 * @return mixed
99
+	 */
100
+	public function from($email, $name=null);
101
+
102
+	//--------------------------------------------------------------------
103
+
104
+	/**
105
+	 * Sets a single additional email address to 'cc'.
106
+	 *
107
+	 * @param $email
108
+	 * @return mixed
109
+	 */
110
+	public function cc($email);
111
+
112
+	//--------------------------------------------------------------------
113
+
114
+	/**
115
+	 * Sets a single email address to 'bcc' to.
116
+	 *
117
+	 * @param $email
118
+	 * @return mixed
119
+	 */
120
+	public function bcc($email);
121
+
122
+	//--------------------------------------------------------------------
123
+
124
+	/**
125
+	 * Sets the reply to address.
126
+	 *
127
+	 * @param $email
128
+	 * @param $name
129
+	 * @return mixed
130
+	 */
131
+	public function reply_to($email, $name=null);
132
+
133
+	//--------------------------------------------------------------------
134
+
135
+	/**
136
+	 * Sets the subject line of the email.
137
+	 *
138
+	 * @param $subject
139
+	 * @return mixed
140
+	 */
141
+	public function subject($subject);
142
+
143
+	//--------------------------------------------------------------------
144
+
145
+	/**
146
+	 * Sets the HTML portion of the email address. Optional.
147
+	 *
148
+	 * @param $message
149
+	 * @return mixed
150
+	 */
151
+	public function html_message($message);
152
+
153
+	//--------------------------------------------------------------------
154
+
155
+	/**
156
+	 * Sets the text portion of the email address. Optional.
157
+	 *
158
+	 * @param $message
159
+	 * @return mixed
160
+	 */
161
+	public function text_message($message);
162
+
163
+	//--------------------------------------------------------------------
164
+
165
+	/**
166
+	 * Sets the format to send the email in. Either 'html' or 'text'.
167
+	 *
168
+	 * @param $format
169
+	 * @return mixed
170
+	 */
171
+	public function format($format);
172
+
173
+	//--------------------------------------------------------------------
174
+
175
+	/**
176
+	 * Resets the state to blank, ready for a new email. Useful when
177
+	 * sending emails in a loop and you need to make sure that the
178
+	 * email is reset.
179
+	 *
180
+	 * @param bool $clear_attachments
181
+	 * @return mixed
182
+	 */
183
+	public function reset($clear_attachments=true);
184
+
185
+	//--------------------------------------------------------------------
186 186
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return mixed
51 51
      */
52
-    public function send($clear_after=true);
52
+    public function send($clear_after = true);
53 53
 
54 54
     //--------------------------------------------------------------------
55 55
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param string    $newname        If you'd like to rename the file for delivery
62 62
      * @param string    $mime           Custom defined mime type.
63 63
      */
64
-    public function attach($filename, $disposition=null, $newname=null, $mime=null);
64
+    public function attach($filename, $disposition = null, $newname = null, $mime = null);
65 65
 
66 66
     //--------------------------------------------------------------------
67 67
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param null $name
98 98
      * @return mixed
99 99
      */
100
-    public function from($email, $name=null);
100
+    public function from($email, $name = null);
101 101
 
102 102
     //--------------------------------------------------------------------
103 103
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param $name
129 129
      * @return mixed
130 130
      */
131
-    public function reply_to($email, $name=null);
131
+    public function reply_to($email, $name = null);
132 132
 
133 133
     //--------------------------------------------------------------------
134 134
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param bool $clear_attachments
181 181
      * @return mixed
182 182
      */
183
-    public function reset($clear_attachments=true);
183
+    public function reset($clear_attachments = true);
184 184
 
185 185
     //--------------------------------------------------------------------
186 186
 }
Please login to merge, or discard this patch.
myth/Mail/Queue.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php namespace Myth\Mail;
2 2
 /**
3
- * Sprint
4
- *
5
- * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- *
25
- * @package     Sprint
26
- * @author      Lonnie Ezell
27
- * @copyright   Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com)
28
- * @license     http://opensource.org/licenses/MIT  (MIT)
29
- * @link        http://sprintphp.com
30
- * @since       Version 1.0
31
- */
3
+	 * Sprint
4
+	 *
5
+	 * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow.
6
+	 *
7
+	 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+	 * of this software and associated documentation files (the "Software"), to deal
9
+	 * in the Software without restriction, including without limitation the rights
10
+	 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+	 * copies of the Software, and to permit persons to whom the Software is
12
+	 * furnished to do so, subject to the following conditions:
13
+	 *
14
+	 * The above copyright notice and this permission notice shall be included in
15
+	 * all copies or substantial portions of the Software.
16
+	 *
17
+	 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+	 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+	 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+	 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+	 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+	 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+	 * THE SOFTWARE.
24
+	 *
25
+	 * @package     Sprint
26
+	 * @author      Lonnie Ezell
27
+	 * @copyright   Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com)
28
+	 * @license     http://opensource.org/licenses/MIT  (MIT)
29
+	 * @link        http://sprintphp.com
30
+	 * @since       Version 1.0
31
+	 */
32 32
 
33 33
 use Myth\Models\CIDbModel;
34 34
 
35 35
 class Queue extends CIDbModel {
36 36
 
37
-    protected $table_name = 'mail_queue';
37
+	protected $table_name = 'mail_queue';
38 38
 
39
-    protected $set_created = false;
40
-    protected $set_modified = false;
39
+	protected $set_created = false;
40
+	protected $set_modified = false;
41 41
 }
Please login to merge, or discard this patch.
myth/Settings/ConfigStore.php 3 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -49,143 +49,143 @@
 block discarded – undo
49 49
  */
50 50
 class ConfigStore implements SettingsStoreInterface {
51 51
 
52
-    protected $ci;
53
-
54
-    //--------------------------------------------------------------------
55
-
56
-    public function __construct( $ci=null )
57
-    {
58
-        if (is_object($ci))
59
-        {
60
-            $this->ci =& $ci;
61
-        }
62
-        else {
63
-            $this->ci =& get_instance();
64
-        }
65
-    }
66
-
67
-    //--------------------------------------------------------------------
68
-
69
-    /**
70
-     * Inserts/Replaces a single setting item.
71
-     *
72
-     * @param $key
73
-     * @param null $value
74
-     * @param string $group
75
-     */
76
-    public function save($key, $value=null, $group='app')
77
-    {
78
-        // Treat the 'app' group as our primary, un-sectioned
79
-        // config files.
80
-        if ($group != 'app')
81
-        {
82
-            return $this->ci->config->set_item($key, $value);
83
-        }
84
-
85
-        // Otherwise, we'll need to ensure a section exists
86
-        if (! isset($this->ci->config->config[$group]))
87
-        {
88
-            $this->ci->config->config[$group] = [];
89
-        }
90
-
91
-        $this->ci->config->config[$group][$key] = $value;
92
-    }
93
-
94
-    //--------------------------------------------------------------------
95
-
96
-    /**
97
-     * Retrieves a single item. If the config system doesn't have the
98
-     * value loaded, yet, it will attempt to load a config file matching
99
-     * the 'group' name and grab the value from that.
100
-     *
101
-     * @param $key
102
-     * @param string $group
103
-     * @return mixed
104
-     */
105
-    public function get($key, $group='application')
106
-    {
107
-        // First, see if CI already has this key loaded.
108
-        $result = $this->ci->config->item($key);
109
-
110
-        // This bit will fail when the actual value is NULL
111
-        // but should result in false hits infrequently.
112
-        if ($result !== null)
113
-        {
114
-            return $result;
115
-        }
116
-
117
-        // Try to load the 'group' file, then try to load a
118
-        // config file that matches the group name
119
-        $this->ci->load->config($group, false, true);
52
+	protected $ci;
53
+
54
+	//--------------------------------------------------------------------
55
+
56
+	public function __construct( $ci=null )
57
+	{
58
+		if (is_object($ci))
59
+		{
60
+			$this->ci =& $ci;
61
+		}
62
+		else {
63
+			$this->ci =& get_instance();
64
+		}
65
+	}
66
+
67
+	//--------------------------------------------------------------------
68
+
69
+	/**
70
+	 * Inserts/Replaces a single setting item.
71
+	 *
72
+	 * @param $key
73
+	 * @param null $value
74
+	 * @param string $group
75
+	 */
76
+	public function save($key, $value=null, $group='app')
77
+	{
78
+		// Treat the 'app' group as our primary, un-sectioned
79
+		// config files.
80
+		if ($group != 'app')
81
+		{
82
+			return $this->ci->config->set_item($key, $value);
83
+		}
84
+
85
+		// Otherwise, we'll need to ensure a section exists
86
+		if (! isset($this->ci->config->config[$group]))
87
+		{
88
+			$this->ci->config->config[$group] = [];
89
+		}
90
+
91
+		$this->ci->config->config[$group][$key] = $value;
92
+	}
93
+
94
+	//--------------------------------------------------------------------
95
+
96
+	/**
97
+	 * Retrieves a single item. If the config system doesn't have the
98
+	 * value loaded, yet, it will attempt to load a config file matching
99
+	 * the 'group' name and grab the value from that.
100
+	 *
101
+	 * @param $key
102
+	 * @param string $group
103
+	 * @return mixed
104
+	 */
105
+	public function get($key, $group='application')
106
+	{
107
+		// First, see if CI already has this key loaded.
108
+		$result = $this->ci->config->item($key);
109
+
110
+		// This bit will fail when the actual value is NULL
111
+		// but should result in false hits infrequently.
112
+		if ($result !== null)
113
+		{
114
+			return $result;
115
+		}
116
+
117
+		// Try to load the 'group' file, then try to load a
118
+		// config file that matches the group name
119
+		$this->ci->load->config($group, false, true);
120 120
         
121
-        $result = $this->ci->config->item($key);
122
-
123
-        return $result;
124
-    }
125
-
126
-    //--------------------------------------------------------------------
127
-
128
-    /**
129
-     * Deletes a single item.
130
-     *
131
-     * NOT supported by this store.
132
-     *
133
-     * @param $key
134
-     * @param $group
135
-     * @return mixed
136
-     */
137
-    public function delete($key, $group='app')
138
-    {
139
-        return false;
140
-    }
141
-
142
-    //--------------------------------------------------------------------
143
-
144
-    /**
145
-     * Searches the store for any items with $field = $value.
146
-     *
147
-     * Does not work.
148
-     *
149
-     * @param $field
150
-     * @param $value
151
-     * @return mixed
152
-     */
153
-    public function findBy($field, $value)
154
-    {
155
-        return false;
156
-    }
157
-
158
-    //--------------------------------------------------------------------
159
-
160
-    /**
161
-     * Retrieves all items in the store either globally or for a single group.
162
-     *
163
-     * @param string $group
164
-     * @return mixed
165
-     */
166
-    public function all($group=null)
167
-    {
168
-        if (empty($group))
169
-        {
170
-            return $this->ci->config->config;
171
-        }
172
-
173
-        // If we're a group, does the group already exists
174
-        // as a 'section' in the config array?
175
-        if (isset($this->ci->config->config[$group]))
176
-        {
177
-            return $this->ci->config->config[$group];
178
-        }
179
-
180
-        // Still here? Attempt to load the file into a section
181
-        // and try one last time.
182
-        if ($this->ci->load->config($group))
183
-        {
184
-            return $this->ci->config->config($group);
185
-        }
186
-
187
-        return null;
188
-    }
189
-
190
-    //--------------------------------------------------------------------
121
+		$result = $this->ci->config->item($key);
122
+
123
+		return $result;
124
+	}
125
+
126
+	//--------------------------------------------------------------------
127
+
128
+	/**
129
+	 * Deletes a single item.
130
+	 *
131
+	 * NOT supported by this store.
132
+	 *
133
+	 * @param $key
134
+	 * @param $group
135
+	 * @return mixed
136
+	 */
137
+	public function delete($key, $group='app')
138
+	{
139
+		return false;
140
+	}
141
+
142
+	//--------------------------------------------------------------------
143
+
144
+	/**
145
+	 * Searches the store for any items with $field = $value.
146
+	 *
147
+	 * Does not work.
148
+	 *
149
+	 * @param $field
150
+	 * @param $value
151
+	 * @return mixed
152
+	 */
153
+	public function findBy($field, $value)
154
+	{
155
+		return false;
156
+	}
157
+
158
+	//--------------------------------------------------------------------
159
+
160
+	/**
161
+	 * Retrieves all items in the store either globally or for a single group.
162
+	 *
163
+	 * @param string $group
164
+	 * @return mixed
165
+	 */
166
+	public function all($group=null)
167
+	{
168
+		if (empty($group))
169
+		{
170
+			return $this->ci->config->config;
171
+		}
172
+
173
+		// If we're a group, does the group already exists
174
+		// as a 'section' in the config array?
175
+		if (isset($this->ci->config->config[$group]))
176
+		{
177
+			return $this->ci->config->config[$group];
178
+		}
179
+
180
+		// Still here? Attempt to load the file into a section
181
+		// and try one last time.
182
+		if ($this->ci->load->config($group))
183
+		{
184
+			return $this->ci->config->config($group);
185
+		}
186
+
187
+		return null;
188
+	}
189
+
190
+	//--------------------------------------------------------------------
191 191
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 
54 54
     //--------------------------------------------------------------------
55 55
 
56
-    public function __construct( $ci=null )
56
+    public function __construct($ci = null)
57 57
     {
58 58
         if (is_object($ci))
59 59
         {
60
-            $this->ci =& $ci;
60
+            $this->ci = & $ci;
61 61
         }
62 62
         else {
63
-            $this->ci =& get_instance();
63
+            $this->ci = & get_instance();
64 64
         }
65 65
     }
66 66
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param null $value
74 74
      * @param string $group
75 75
      */
76
-    public function save($key, $value=null, $group='app')
76
+    public function save($key, $value = null, $group = 'app')
77 77
     {
78 78
         // Treat the 'app' group as our primary, un-sectioned
79 79
         // config files.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         // Otherwise, we'll need to ensure a section exists
86
-        if (! isset($this->ci->config->config[$group]))
86
+        if ( ! isset($this->ci->config->config[$group]))
87 87
         {
88 88
             $this->ci->config->config[$group] = [];
89 89
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param string $group
103 103
      * @return mixed
104 104
      */
105
-    public function get($key, $group='application')
105
+    public function get($key, $group = 'application')
106 106
     {
107 107
         // First, see if CI already has this key loaded.
108 108
         $result = $this->ci->config->item($key);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param $group
135 135
      * @return mixed
136 136
      */
137
-    public function delete($key, $group='app')
137
+    public function delete($key, $group = 'app')
138 138
     {
139 139
         return false;
140 140
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param string $group
164 164
      * @return mixed
165 165
      */
166
-    public function all($group=null)
166
+    public function all($group = null)
167 167
     {
168 168
         if (empty($group))
169 169
         {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 43
         if (is_object($ci))
44 44
         {
45 45
             $this->ci =& $ci;
46
-        }
47
-        else {
46
+        } else {
48 47
             $this->ci =& get_instance();
49 48
         }
50 49
 
Please login to merge, or discard this patch.