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
Push — develop ( e54387...b62a26 )
by Lonnie
10s
created
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/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.
myth/Settings/DatabaseStore.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
     //--------------------------------------------------------------------
40 40
 
41
-    public function __construct( $ci=null )
41
+    public function __construct($ci = null)
42 42
     {
43 43
         if (is_object($ci))
44 44
         {
45
-            $this->ci =& $ci;
45
+            $this->ci = & $ci;
46 46
         }
47 47
         else {
48
-            $this->ci =& get_instance();
48
+            $this->ci = & get_instance();
49 49
         }
50 50
 
51 51
         // Ensure that the database is loaded.
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param string $group
66 66
      * @return bool
67 67
      */
68
-    public function save($key, $value=null, $group='app')
68
+    public function save($key, $value = null, $group = 'app')
69 69
     {
70 70
         if (empty($this->ci->db) || ! is_object($this->ci->db))
71 71
         {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param string $group
101 101
      * @return mixed
102 102
      */
103
-    public function get($key, $group='app')
103
+    public function get($key, $group = 'app')
104 104
     {
105 105
         if (empty($this->ci->db) || ! is_object($this->ci->db))
106 106
         {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $query = $this->ci->db->where($where)
116 116
                               ->get('settings');
117 117
 
118
-        if (! $query->num_rows())
118
+        if ( ! $query->num_rows())
119 119
         {
120 120
             return false;
121 121
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $value = $query->row()->value;
124 124
 
125 125
         // Check to see if it needs to be unserialized
126
-        $data = @unserialize($value);   // We don't need to issue an E_NOTICE here...
126
+        $data = @unserialize($value); // We don't need to issue an E_NOTICE here...
127 127
 
128 128
         // Check for a value of false or
129 129
         if ($value === 'b:0;' || $data !== false)
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @param $group
144 144
      * @return mixed
145 145
      */
146
-    public function delete($key, $group='app')
146
+    public function delete($key, $group = 'app')
147 147
     {
148 148
         if (empty($this->ci->db) || ! is_object($this->ci->db))
149 149
         {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $query = $this->ci->db->where($field, $value)
178 178
                               ->get('settings');
179 179
 
180
-        if (! $query->num_rows())
180
+        if ( ! $query->num_rows())
181 181
         {
182 182
             return false;
183 183
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param string $group
194 194
      * @return mixed
195 195
      */
196
-    public function all($group=null)
196
+    public function all($group = null)
197 197
     {
198 198
         if (empty($this->ci->db) || ! is_object($this->ci->db))
199 199
         {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
         $query = $this->ci->db->get('settings');
204 204
 
205
-        if (! $query->num_rows())
205
+        if ( ! $query->num_rows())
206 206
         {
207 207
             return false;
208 208
         }
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.
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -32,183 +32,183 @@
 block discarded – undo
32 32
 
33 33
 class DatabaseStore implements SettingsStoreInterface {
34 34
 
35
-    protected $ci;
36
-
37
-    protected $db;
38
-
39
-    //--------------------------------------------------------------------
40
-
41
-    public function __construct( $ci=null )
42
-    {
43
-        if (is_object($ci))
44
-        {
45
-            $this->ci =& $ci;
46
-        }
47
-        else {
48
-            $this->ci =& get_instance();
49
-        }
50
-
51
-        // Ensure that the database is loaded.
52
-        if (empty($this->ci->db))
53
-        {
54
-            $this->ci->load->database();
55
-        }
56
-    }
57
-
58
-    //--------------------------------------------------------------------
59
-
60
-    /**
61
-     * Inserts or Replaces an setting value.
62
-     *
63
-     * @param $key
64
-     * @param null $value
65
-     * @param string $group
66
-     * @return bool
67
-     */
68
-    public function save($key, $value=null, $group='app')
69
-    {
70
-        if (empty($this->ci->db) || ! is_object($this->ci->db))
71
-        {
72
-            return false;
73
-        }
74
-
75
-        $where = [
76
-            'name'  => $key,
77
-            'group' => $group
78
-        ];
79
-        $this->ci->db->delete('settings', $where);
80
-
81
-        if (is_array($value) || is_object($value))
82
-        {
83
-            $value = serialize($value);
84
-        }
85
-
86
-        $data = [
87
-            'name'  => $key,
88
-            'value' => $value,
89
-            'group' => $group
90
-        ];
91
-        return $this->ci->db->insert('settings', $data);
92
-    }
93
-
94
-    //--------------------------------------------------------------------
95
-
96
-    /**
97
-     * Retrieves a single item.
98
-     *
99
-     * @param $key
100
-     * @param string $group
101
-     * @return mixed
102
-     */
103
-    public function get($key, $group='app')
104
-    {
105
-        if (empty($this->ci->db) || ! is_object($this->ci->db))
106
-        {
107
-            return false;
108
-        }
109
-
110
-        $where = [
111
-            'name'  => $key,
112
-            'group' => $group
113
-        ];
114
-
115
-        $query = $this->ci->db->where($where)
116
-                              ->get('settings');
117
-
118
-        if (! $query->num_rows())
119
-        {
120
-            return false;
121
-        }
122
-
123
-        $value = $query->row()->value;
124
-
125
-        // Check to see if it needs to be unserialized
126
-        $data = @unserialize($value);   // We don't need to issue an E_NOTICE here...
127
-
128
-        // Check for a value of false or
129
-        if ($value === 'b:0;' || $data !== false)
130
-        {
131
-            $value = $data;
132
-        }
133
-
134
-        return $value;
135
-    }
136
-
137
-    //--------------------------------------------------------------------
138
-
139
-    /**
140
-     * Deletes a single item.
141
-     *
142
-     * @param $key
143
-     * @param $group
144
-     * @return mixed
145
-     */
146
-    public function delete($key, $group='app')
147
-    {
148
-        if (empty($this->ci->db) || ! is_object($this->ci->db))
149
-        {
150
-            return false;
151
-        }
152
-
153
-        $where = [
154
-            'name'  => $key,
155
-            'group' => $group
156
-        ];
157
-
158
-        return $this->ci->db->delete('settings', $where);
159
-    }
160
-
161
-    //--------------------------------------------------------------------
162
-
163
-    /**
164
-     * Searches the store for any items with $field = $value.
165
-     *
166
-     * @param $field
167
-     * @param $value
168
-     * @return mixed
169
-     */
170
-    public function findBy($field, $value)
171
-    {
172
-        if (empty($this->ci->db) || ! is_object($this->ci->db))
173
-        {
174
-            return false;
175
-        }
176
-
177
-        $query = $this->ci->db->where($field, $value)
178
-                              ->get('settings');
179
-
180
-        if (! $query->num_rows())
181
-        {
182
-            return false;
183
-        }
184
-
185
-        return $query->result_array();
186
-    }
187
-
188
-    //--------------------------------------------------------------------
189
-
190
-    /**
191
-     * Retrieves all items in the store either globally or for a single group.
192
-     *
193
-     * @param string $group
194
-     * @return mixed
195
-     */
196
-    public function all($group=null)
197
-    {
198
-        if (empty($this->ci->db) || ! is_object($this->ci->db))
199
-        {
200
-            return false;
201
-        }
202
-
203
-        $query = $this->ci->db->get('settings');
204
-
205
-        if (! $query->num_rows())
206
-        {
207
-            return false;
208
-        }
209
-
210
-        return $query->result_array();
211
-    }
212
-
213
-    //--------------------------------------------------------------------
35
+	protected $ci;
36
+
37
+	protected $db;
38
+
39
+	//--------------------------------------------------------------------
40
+
41
+	public function __construct( $ci=null )
42
+	{
43
+		if (is_object($ci))
44
+		{
45
+			$this->ci =& $ci;
46
+		}
47
+		else {
48
+			$this->ci =& get_instance();
49
+		}
50
+
51
+		// Ensure that the database is loaded.
52
+		if (empty($this->ci->db))
53
+		{
54
+			$this->ci->load->database();
55
+		}
56
+	}
57
+
58
+	//--------------------------------------------------------------------
59
+
60
+	/**
61
+	 * Inserts or Replaces an setting value.
62
+	 *
63
+	 * @param $key
64
+	 * @param null $value
65
+	 * @param string $group
66
+	 * @return bool
67
+	 */
68
+	public function save($key, $value=null, $group='app')
69
+	{
70
+		if (empty($this->ci->db) || ! is_object($this->ci->db))
71
+		{
72
+			return false;
73
+		}
74
+
75
+		$where = [
76
+			'name'  => $key,
77
+			'group' => $group
78
+		];
79
+		$this->ci->db->delete('settings', $where);
80
+
81
+		if (is_array($value) || is_object($value))
82
+		{
83
+			$value = serialize($value);
84
+		}
85
+
86
+		$data = [
87
+			'name'  => $key,
88
+			'value' => $value,
89
+			'group' => $group
90
+		];
91
+		return $this->ci->db->insert('settings', $data);
92
+	}
93
+
94
+	//--------------------------------------------------------------------
95
+
96
+	/**
97
+	 * Retrieves a single item.
98
+	 *
99
+	 * @param $key
100
+	 * @param string $group
101
+	 * @return mixed
102
+	 */
103
+	public function get($key, $group='app')
104
+	{
105
+		if (empty($this->ci->db) || ! is_object($this->ci->db))
106
+		{
107
+			return false;
108
+		}
109
+
110
+		$where = [
111
+			'name'  => $key,
112
+			'group' => $group
113
+		];
114
+
115
+		$query = $this->ci->db->where($where)
116
+							  ->get('settings');
117
+
118
+		if (! $query->num_rows())
119
+		{
120
+			return false;
121
+		}
122
+
123
+		$value = $query->row()->value;
124
+
125
+		// Check to see if it needs to be unserialized
126
+		$data = @unserialize($value);   // We don't need to issue an E_NOTICE here...
127
+
128
+		// Check for a value of false or
129
+		if ($value === 'b:0;' || $data !== false)
130
+		{
131
+			$value = $data;
132
+		}
133
+
134
+		return $value;
135
+	}
136
+
137
+	//--------------------------------------------------------------------
138
+
139
+	/**
140
+	 * Deletes a single item.
141
+	 *
142
+	 * @param $key
143
+	 * @param $group
144
+	 * @return mixed
145
+	 */
146
+	public function delete($key, $group='app')
147
+	{
148
+		if (empty($this->ci->db) || ! is_object($this->ci->db))
149
+		{
150
+			return false;
151
+		}
152
+
153
+		$where = [
154
+			'name'  => $key,
155
+			'group' => $group
156
+		];
157
+
158
+		return $this->ci->db->delete('settings', $where);
159
+	}
160
+
161
+	//--------------------------------------------------------------------
162
+
163
+	/**
164
+	 * Searches the store for any items with $field = $value.
165
+	 *
166
+	 * @param $field
167
+	 * @param $value
168
+	 * @return mixed
169
+	 */
170
+	public function findBy($field, $value)
171
+	{
172
+		if (empty($this->ci->db) || ! is_object($this->ci->db))
173
+		{
174
+			return false;
175
+		}
176
+
177
+		$query = $this->ci->db->where($field, $value)
178
+							  ->get('settings');
179
+
180
+		if (! $query->num_rows())
181
+		{
182
+			return false;
183
+		}
184
+
185
+		return $query->result_array();
186
+	}
187
+
188
+	//--------------------------------------------------------------------
189
+
190
+	/**
191
+	 * Retrieves all items in the store either globally or for a single group.
192
+	 *
193
+	 * @param string $group
194
+	 * @return mixed
195
+	 */
196
+	public function all($group=null)
197
+	{
198
+		if (empty($this->ci->db) || ! is_object($this->ci->db))
199
+		{
200
+			return false;
201
+		}
202
+
203
+		$query = $this->ci->db->get('settings');
204
+
205
+		if (! $query->num_rows())
206
+		{
207
+			return false;
208
+		}
209
+
210
+		return $query->result_array();
211
+	}
212
+
213
+	//--------------------------------------------------------------------
214 214
 }
Please login to merge, or discard this patch.
myth/Settings/Settings.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
         {
71 71
             foreach ($user_stores as $alias => $class)
72 72
             {
73
-                self::$stores[ strtolower($alias) ] = new $class();
73
+                self::$stores[strtolower($alias)] = new $class();
74 74
             }
75 75
         }
76 76
 
77 77
         self::$default_store = config_item('settings.default_store');
78 78
 
79
-        if (empty(self::$stores[ self::$default_store ]))
79
+        if (empty(self::$stores[self::$default_store]))
80 80
         {
81
-            show_error( lang('settings.bad_default') );
81
+            show_error(lang('settings.bad_default'));
82 82
         }
83 83
     }
84 84
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string $group
93 93
      * @param string $store
94 94
      */
95
-    public static function save($key, $value=null, $group='app', $store=null)
95
+    public static function save($key, $value = null, $group = 'app', $store = null)
96 96
     {
97 97
         self::init();
98 98
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             $store = self::$default_store;
104 104
         }
105 105
 
106
-        return self::$stores[ $store ]->save($key, $value, $group);
106
+        return self::$stores[$store]->save($key, $value, $group);
107 107
     }
108 108
 
109 109
     //--------------------------------------------------------------------
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param string $store
119 119
      * @return mixed
120 120
      */
121
-    public static function get($key, $group='app', $store=null)
121
+    public static function get($key, $group = 'app', $store = null)
122 122
     {
123 123
         self::init();
124 124
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 
127 127
         // If the store is specified but doesn't exist, crap out
128 128
         // so that they developer has a chance to fix it.
129
-        if (! is_null($store) && empty(self::$stores[$store]))
129
+        if ( ! is_null($store) && empty(self::$stores[$store]))
130 130
         {
131
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
131
+            show_error(sprintf(lang('settings.cant_retrieve'), $store));
132 132
         }
133 133
 
134 134
         // If $store is set, get the value from that store only.
135
-        if (! empty($store))
135
+        if ( ! empty($store))
136 136
         {
137 137
             return self::$stores[$store]->get($key, $group);
138 138
         }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @param $store
161 161
      * @return mixed
162 162
      */
163
-    public static function delete($key, $group='app', $store=null)
163
+    public static function delete($key, $group = 'app', $store = null)
164 164
     {
165 165
         self::init();
166 166
 
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
 
169 169
         // If the store is specified but doesn't exist, crap out
170 170
         // so that they developer has a chance to fix it.
171
-        if (! is_null($store) && empty(self::$stores[$store]))
171
+        if ( ! is_null($store) && empty(self::$stores[$store]))
172 172
         {
173
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
173
+            show_error(sprintf(lang('settings.cant_retrieve'), $store));
174 174
         }
175 175
 
176 176
         // If $store is set, get the value from that store only.
177
-        if (! empty($store))
177
+        if ( ! empty($store))
178 178
         {
179 179
             return self::$stores[$store]->delete($key, $group);
180 180
         }
181 181
 
182 182
         // Otherwise delete from the default store
183
-        return self::$stores[ self::$default_store ]->delete($key, $group);
183
+        return self::$stores[self::$default_store]->delete($key, $group);
184 184
     }
185 185
 
186 186
     //--------------------------------------------------------------------
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
      * @param string $group
216 216
      * @return mixed
217 217
      */
218
-    public static function all($group=null, $store=null)
218
+    public static function all($group = null, $store = null)
219 219
     {
220 220
         self::init();
221 221
 
222 222
         $group = strtolower($group);
223 223
 
224
-        if (! empty($store))
224
+        if ( ! empty($store))
225 225
         {
226
-            return self::$stores[ $store ]->all($group);
226
+            return self::$stores[$store]->all($group);
227 227
         }
228 228
 
229 229
         // Otherwise combine the results from all stores
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             $found = $s->all($group);
235 235
             if ($found)
236 236
             {
237
-                $results = array_merge($results, (array)$found);
237
+                $results = array_merge($results, (array) $found);
238 238
             }
239 239
         }
240 240
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         if (class_exists($class))
258 258
         {
259
-            self::$stores[ strtolower($alias) ] = new $class();
259
+            self::$stores[strtolower($alias)] = new $class();
260 260
             return true;
261 261
         }
262 262
 
Please login to merge, or discard this patch.
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -40,253 +40,253 @@
 block discarded – undo
40 40
  */
41 41
 class Settings {
42 42
 
43
-    /**
44
-     * Holds instantiated data stores.
45
-     *
46
-     * @var array
47
-     */
48
-    protected static $stores = [];
49
-
50
-    protected static $default_store = '';
51
-
52
-    protected static $initialized = false;
53
-
54
-    //--------------------------------------------------------------------
55
-
56
-    /**
57
-     * Fires up instances of the datastores and gets us ready to roll.
58
-     */
59
-    public static function init()
60
-    {
61
-        if (self::$initialized === true)
62
-        {
63
-            return;
64
-        }
65
-
66
-        // Load up and instantiate our setting stores.
67
-        $user_stores = config_item('settings.stores');
68
-
69
-        if (is_array($user_stores))
70
-        {
71
-            foreach ($user_stores as $alias => $class)
72
-            {
73
-                self::$stores[ strtolower($alias) ] = new $class();
74
-            }
75
-        }
76
-
77
-        self::$default_store = config_item('settings.default_store');
78
-
79
-        if (empty(self::$stores[ self::$default_store ]))
80
-        {
81
-            show_error( lang('settings.bad_default') );
82
-        }
83
-    }
84
-
85
-    //--------------------------------------------------------------------
86
-
87
-    /**
88
-     * Inserts/Replaces a single setting item.
89
-     *
90
-     * @param $key
91
-     * @param null $value
92
-     * @param string $group
93
-     * @param string $store
94
-     */
95
-    public static function save($key, $value=null, $group='app', $store=null)
96
-    {
97
-        self::init();
98
-
99
-        if (empty($store) || empty(self::$stores[$store]))
100
-        {
101
-            // we've already determined that the default store exists
102
-            // in the init() method.
103
-            $store = self::$default_store;
104
-        }
105
-
106
-        return self::$stores[ $store ]->save($key, $value, $group);
107
-    }
108
-
109
-    //--------------------------------------------------------------------
110
-
111
-    /**
112
-     * Retrieves a single item. If not $store is specified, will loop
113
-     * through the stores in order until it finds it. If $store is
114
-     * specified, will only look within that store for it.
115
-     *
116
-     * @param $key
117
-     * @param string $group
118
-     * @param string $store
119
-     * @return mixed
120
-     */
121
-    public static function get($key, $group='app', $store=null)
122
-    {
123
-        self::init();
124
-
125
-        $group = strtolower($group);
126
-
127
-        // If the store is specified but doesn't exist, crap out
128
-        // so that they developer has a chance to fix it.
129
-        if (! is_null($store) && empty(self::$stores[$store]))
130
-        {
131
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
132
-        }
133
-
134
-        // If $store is set, get the value from that store only.
135
-        if (! empty($store))
136
-        {
137
-            return self::$stores[$store]->get($key, $group);
138
-        }
139
-
140
-        // Otherwise loop through each store until we find it
141
-        foreach (self::$stores as $s)
142
-        {
143
-            if ($found = $s->get($key, $group))
144
-            {
145
-                return $found;
146
-            }
147
-        }
148
-
149
-        // Still here... guess we didn't find anything, then...
150
-        return false;
151
-    }
152
-
153
-    //--------------------------------------------------------------------
154
-
155
-    /**
156
-     * Deletes a single item.
157
-     *
158
-     * @param $key
159
-     * @param $group
160
-     * @param $store
161
-     * @return mixed
162
-     */
163
-    public static function delete($key, $group='app', $store=null)
164
-    {
165
-        self::init();
166
-
167
-        $group = strtolower($group);
168
-
169
-        // If the store is specified but doesn't exist, crap out
170
-        // so that they developer has a chance to fix it.
171
-        if (! is_null($store) && empty(self::$stores[$store]))
172
-        {
173
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
174
-        }
175
-
176
-        // If $store is set, get the value from that store only.
177
-        if (! empty($store))
178
-        {
179
-            return self::$stores[$store]->delete($key, $group);
180
-        }
181
-
182
-        // Otherwise delete from the default store
183
-        return self::$stores[ self::$default_store ]->delete($key, $group);
184
-    }
185
-
186
-    //--------------------------------------------------------------------
187
-
188
-    /**
189
-     * Searches the store for any items with $field = $value.
190
-     *
191
-     * @param $field
192
-     * @param $value
193
-     * @return mixed
194
-     */
195
-    public static function findBy($field, $value)
196
-    {
197
-        self::init();
198
-
199
-        foreach (self::$stores as $s)
200
-        {
201
-            if ($found = $s->findBy($field, $value))
202
-            {
203
-                return $found;
204
-            }
205
-        }
206
-
207
-        return false;
208
-    }
209
-
210
-    //--------------------------------------------------------------------
211
-
212
-    /**
213
-     * Retrieves all items in the store either globally or for a single group.
214
-     *
215
-     * @param string $group
216
-     * @return mixed
217
-     */
218
-    public static function all($group=null, $store=null)
219
-    {
220
-        self::init();
221
-
222
-        $group = strtolower($group);
223
-
224
-        if (! empty($store))
225
-        {
226
-            return self::$stores[ $store ]->all($group);
227
-        }
228
-
229
-        // Otherwise combine the results from all stores
230
-        $results = [];
231
-
232
-        foreach (self::$stores as $s)
233
-        {
234
-            $found = $s->all($group);
235
-            if ($found)
236
-            {
237
-                $results = array_merge($results, (array)$found);
238
-            }
239
-        }
240
-
241
-        return $results;
242
-    }
243
-
244
-    //--------------------------------------------------------------------
245
-
246
-    /**
247
-     * Appends a new datastore the end of the curent stores.
248
-     *
249
-     * @param $alias
250
-     * @param $class
251
-     * @return bool
252
-     */
253
-    public static function addStore($alias, $class)
254
-    {
255
-        self::init();
256
-
257
-        if (class_exists($class))
258
-        {
259
-            self::$stores[ strtolower($alias) ] = new $class();
260
-            return true;
261
-        }
262
-
263
-        return false;
264
-    }
265
-
266
-    //--------------------------------------------------------------------
267
-
268
-    /**
269
-     * Removes a datastore from the list of stores currently available.
270
-     *
271
-     * @param $alias
272
-     * @return bool
273
-     */
274
-    public static function removeStore($alias)
275
-    {
276
-        self::init();
277
-
278
-        $alias = strtolower($alias);
279
-
280
-        if (empty(self::$stores[$alias]))
281
-        {
282
-            return false;
283
-        }
284
-
285
-        unset(self::$stores[$alias]);
286
-
287
-        return true;
288
-    }
289
-
290
-    //--------------------------------------------------------------------
43
+	/**
44
+	 * Holds instantiated data stores.
45
+	 *
46
+	 * @var array
47
+	 */
48
+	protected static $stores = [];
49
+
50
+	protected static $default_store = '';
51
+
52
+	protected static $initialized = false;
53
+
54
+	//--------------------------------------------------------------------
55
+
56
+	/**
57
+	 * Fires up instances of the datastores and gets us ready to roll.
58
+	 */
59
+	public static function init()
60
+	{
61
+		if (self::$initialized === true)
62
+		{
63
+			return;
64
+		}
65
+
66
+		// Load up and instantiate our setting stores.
67
+		$user_stores = config_item('settings.stores');
68
+
69
+		if (is_array($user_stores))
70
+		{
71
+			foreach ($user_stores as $alias => $class)
72
+			{
73
+				self::$stores[ strtolower($alias) ] = new $class();
74
+			}
75
+		}
76
+
77
+		self::$default_store = config_item('settings.default_store');
78
+
79
+		if (empty(self::$stores[ self::$default_store ]))
80
+		{
81
+			show_error( lang('settings.bad_default') );
82
+		}
83
+	}
84
+
85
+	//--------------------------------------------------------------------
86
+
87
+	/**
88
+	 * Inserts/Replaces a single setting item.
89
+	 *
90
+	 * @param $key
91
+	 * @param null $value
92
+	 * @param string $group
93
+	 * @param string $store
94
+	 */
95
+	public static function save($key, $value=null, $group='app', $store=null)
96
+	{
97
+		self::init();
98
+
99
+		if (empty($store) || empty(self::$stores[$store]))
100
+		{
101
+			// we've already determined that the default store exists
102
+			// in the init() method.
103
+			$store = self::$default_store;
104
+		}
105
+
106
+		return self::$stores[ $store ]->save($key, $value, $group);
107
+	}
108
+
109
+	//--------------------------------------------------------------------
110
+
111
+	/**
112
+	 * Retrieves a single item. If not $store is specified, will loop
113
+	 * through the stores in order until it finds it. If $store is
114
+	 * specified, will only look within that store for it.
115
+	 *
116
+	 * @param $key
117
+	 * @param string $group
118
+	 * @param string $store
119
+	 * @return mixed
120
+	 */
121
+	public static function get($key, $group='app', $store=null)
122
+	{
123
+		self::init();
124
+
125
+		$group = strtolower($group);
126
+
127
+		// If the store is specified but doesn't exist, crap out
128
+		// so that they developer has a chance to fix it.
129
+		if (! is_null($store) && empty(self::$stores[$store]))
130
+		{
131
+			show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
132
+		}
133
+
134
+		// If $store is set, get the value from that store only.
135
+		if (! empty($store))
136
+		{
137
+			return self::$stores[$store]->get($key, $group);
138
+		}
139
+
140
+		// Otherwise loop through each store until we find it
141
+		foreach (self::$stores as $s)
142
+		{
143
+			if ($found = $s->get($key, $group))
144
+			{
145
+				return $found;
146
+			}
147
+		}
148
+
149
+		// Still here... guess we didn't find anything, then...
150
+		return false;
151
+	}
152
+
153
+	//--------------------------------------------------------------------
154
+
155
+	/**
156
+	 * Deletes a single item.
157
+	 *
158
+	 * @param $key
159
+	 * @param $group
160
+	 * @param $store
161
+	 * @return mixed
162
+	 */
163
+	public static function delete($key, $group='app', $store=null)
164
+	{
165
+		self::init();
166
+
167
+		$group = strtolower($group);
168
+
169
+		// If the store is specified but doesn't exist, crap out
170
+		// so that they developer has a chance to fix it.
171
+		if (! is_null($store) && empty(self::$stores[$store]))
172
+		{
173
+			show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
174
+		}
175
+
176
+		// If $store is set, get the value from that store only.
177
+		if (! empty($store))
178
+		{
179
+			return self::$stores[$store]->delete($key, $group);
180
+		}
181
+
182
+		// Otherwise delete from the default store
183
+		return self::$stores[ self::$default_store ]->delete($key, $group);
184
+	}
185
+
186
+	//--------------------------------------------------------------------
187
+
188
+	/**
189
+	 * Searches the store for any items with $field = $value.
190
+	 *
191
+	 * @param $field
192
+	 * @param $value
193
+	 * @return mixed
194
+	 */
195
+	public static function findBy($field, $value)
196
+	{
197
+		self::init();
198
+
199
+		foreach (self::$stores as $s)
200
+		{
201
+			if ($found = $s->findBy($field, $value))
202
+			{
203
+				return $found;
204
+			}
205
+		}
206
+
207
+		return false;
208
+	}
209
+
210
+	//--------------------------------------------------------------------
211
+
212
+	/**
213
+	 * Retrieves all items in the store either globally or for a single group.
214
+	 *
215
+	 * @param string $group
216
+	 * @return mixed
217
+	 */
218
+	public static function all($group=null, $store=null)
219
+	{
220
+		self::init();
221
+
222
+		$group = strtolower($group);
223
+
224
+		if (! empty($store))
225
+		{
226
+			return self::$stores[ $store ]->all($group);
227
+		}
228
+
229
+		// Otherwise combine the results from all stores
230
+		$results = [];
231
+
232
+		foreach (self::$stores as $s)
233
+		{
234
+			$found = $s->all($group);
235
+			if ($found)
236
+			{
237
+				$results = array_merge($results, (array)$found);
238
+			}
239
+		}
240
+
241
+		return $results;
242
+	}
243
+
244
+	//--------------------------------------------------------------------
245
+
246
+	/**
247
+	 * Appends a new datastore the end of the curent stores.
248
+	 *
249
+	 * @param $alias
250
+	 * @param $class
251
+	 * @return bool
252
+	 */
253
+	public static function addStore($alias, $class)
254
+	{
255
+		self::init();
256
+
257
+		if (class_exists($class))
258
+		{
259
+			self::$stores[ strtolower($alias) ] = new $class();
260
+			return true;
261
+		}
262
+
263
+		return false;
264
+	}
265
+
266
+	//--------------------------------------------------------------------
267
+
268
+	/**
269
+	 * Removes a datastore from the list of stores currently available.
270
+	 *
271
+	 * @param $alias
272
+	 * @return bool
273
+	 */
274
+	public static function removeStore($alias)
275
+	{
276
+		self::init();
277
+
278
+		$alias = strtolower($alias);
279
+
280
+		if (empty(self::$stores[$alias]))
281
+		{
282
+			return false;
283
+		}
284
+
285
+		unset(self::$stores[$alias]);
286
+
287
+		return true;
288
+	}
289
+
290
+	//--------------------------------------------------------------------
291 291
 
292 292
 }
Please login to merge, or discard this patch.
myth/Settings/SettingsStoreInterface.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -40,58 +40,58 @@
 block discarded – undo
40 40
  */
41 41
 interface SettingsStoreInterface {
42 42
 
43
-    /**
44
-     * Inserts/Replaces a single setting item.
45
-     *
46
-     * @param $key
47
-     * @param null $value
48
-     * @param string $group
49
-     */
50
-    public function save($key, $value=null, $group='app');
43
+	/**
44
+	 * Inserts/Replaces a single setting item.
45
+	 *
46
+	 * @param $key
47
+	 * @param null $value
48
+	 * @param string $group
49
+	 */
50
+	public function save($key, $value=null, $group='app');
51 51
 
52
-    //--------------------------------------------------------------------
52
+	//--------------------------------------------------------------------
53 53
 
54
-    /**
55
-     * Retrieves a single item.
56
-     *
57
-     * @param $key
58
-     * @param string $group
59
-     * @return mixed
60
-     */
61
-    public function get($key, $group='app');
54
+	/**
55
+	 * Retrieves a single item.
56
+	 *
57
+	 * @param $key
58
+	 * @param string $group
59
+	 * @return mixed
60
+	 */
61
+	public function get($key, $group='app');
62 62
 
63
-    //--------------------------------------------------------------------
63
+	//--------------------------------------------------------------------
64 64
 
65
-    /**
66
-     * Deletes a single item.
67
-     *
68
-     * @param $key
69
-     * @param $group
70
-     * @return mixed
71
-     */
72
-    public function delete($key, $group='app');
65
+	/**
66
+	 * Deletes a single item.
67
+	 *
68
+	 * @param $key
69
+	 * @param $group
70
+	 * @return mixed
71
+	 */
72
+	public function delete($key, $group='app');
73 73
 
74
-    //--------------------------------------------------------------------
74
+	//--------------------------------------------------------------------
75 75
 
76
-    /**
77
-     * Searches the store for any items with $field = $value.
78
-     *
79
-     * @param $field
80
-     * @param $value
81
-     * @return mixed
82
-     */
83
-    public function findBy($field, $value);
76
+	/**
77
+	 * Searches the store for any items with $field = $value.
78
+	 *
79
+	 * @param $field
80
+	 * @param $value
81
+	 * @return mixed
82
+	 */
83
+	public function findBy($field, $value);
84 84
 
85
-    //--------------------------------------------------------------------
85
+	//--------------------------------------------------------------------
86 86
 
87
-    /**
88
-     * Retrieves all items in the store either globally or for a single group.
89
-     *
90
-     * @param string $group
91
-     * @return mixed
92
-     */
93
-    public function all($group=null);
87
+	/**
88
+	 * Retrieves all items in the store either globally or for a single group.
89
+	 *
90
+	 * @param string $group
91
+	 * @return mixed
92
+	 */
93
+	public function all($group=null);
94 94
 
95
-    //--------------------------------------------------------------------
95
+	//--------------------------------------------------------------------
96 96
 
97 97
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param null $value
48 48
      * @param string $group
49 49
      */
50
-    public function save($key, $value=null, $group='app');
50
+    public function save($key, $value = null, $group = 'app');
51 51
 
52 52
     //--------------------------------------------------------------------
53 53
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $group
59 59
      * @return mixed
60 60
      */
61
-    public function get($key, $group='app');
61
+    public function get($key, $group = 'app');
62 62
 
63 63
     //--------------------------------------------------------------------
64 64
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param $group
70 70
      * @return mixed
71 71
      */
72
-    public function delete($key, $group='app');
72
+    public function delete($key, $group = 'app');
73 73
 
74 74
     //--------------------------------------------------------------------
75 75
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param string $group
91 91
      * @return mixed
92 92
      */
93
-    public function all($group=null);
93
+    public function all($group = null);
94 94
 
95 95
     //--------------------------------------------------------------------
96 96
 
Please login to merge, or discard this patch.
myth/Themers/MetaCollection.php 2 patches
Indentation   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -35,219 +35,219 @@
 block discarded – undo
35 35
 
36 36
 class MetaCollection implements MetaInterface {
37 37
 
38
-    /**
39
-     * Stores the meta values the user has set.
40
-     *
41
-     * @var array
42
-     */
43
-    protected $meta = [];
44
-
45
-    /**
46
-     * Stores the standard meta-value names
47
-     * Mostly here for reference, I guess.
48
-     *
49
-     * @var array
50
-     */
51
-    protected $std_meta = [
52
-        'application-name',
53
-        'author',
54
-        'copyright',
55
-        'description',
56
-        'generator',
57
-        'keywords',
58
-        'robots',
59
-        'googlebot'
60
-    ];
61
-
62
-    /**
63
-     * Stores the HTTP-Equiv meta tags
64
-     * since they need to be rendered differently.
65
-     *
66
-     * @var array
67
-     */
68
-    protected $http_equiv_meta = [
69
-        'cache-control',
70
-        'content-language',
71
-        'content-type',
72
-        'default-style',
73
-        'expires',
74
-        'pragma',
75
-        'refresh',
76
-        'set-cookie'
77
-    ];
78
-
79
-    /**
80
-     * Stores the document's character encoding.
81
-     *
82
-     * @var string
83
-     */
84
-    public $charset = 'utf-8';
85
-
86
-    //--------------------------------------------------------------------
87
-
88
-    public function __construct($ci)
89
-    {
90
-        $ci->config->load('html_meta', true);
91
-
92
-        $config = $ci->config->item('html_meta');
93
-
94
-        $this->meta = $config['meta'];
95
-
96
-        $this->http_equiv_meta = array_merge($this->http_equiv_meta, $config['http-equiv']);
97
-    }
98
-
99
-    //--------------------------------------------------------------------
100
-
101
-
102
-    /**
103
-     * Sets a single meta item.
104
-     * $alias can also be an array of key/value pairs to set.
105
-     *
106
-     * @param string|array $alias
107
-     * @param null $value
108
-     *
109
-     * @return mixed
110
-     */
111
-    public function set($alias, $value=null, $escape=true)
112
-    {
113
-        if (is_array($alias))
114
-        {
115
-            foreach ($alias as $key => $val)
116
-            {
117
-                $this->set($key, $val);
118
-            }
119
-
120
-            return $this;
121
-        }
122
-
123
-        // Charset
124
-        if (strtolower($alias) == 'charset')
125
-        {
126
-            $this->charset = $value;
127
-
128
-            return $this;
129
-        }
130
-
131
-        $this->meta[ strtolower($alias) ] = $escape ? esc($value, 'htmlAttr') : $value;
132
-
133
-        return $this;
134
-    }
135
-
136
-    //--------------------------------------------------------------------
137
-
138
-    /**
139
-     * Returns a single meta item.
140
-     *
141
-     * @param $alias
142
-     *
143
-     * @return mixed
144
-     */
145
-    public function get($alias)
146
-    {
147
-        $alias = strtolower($alias);
148
-
149
-        return isset($this->meta[ $alias ]) ? $this->meta[$alias] : null;
150
-    }
151
-
152
-    //--------------------------------------------------------------------
153
-
154
-    /**
155
-     * Renders out all defined meta tags.
156
-     *
157
-     * @return mixed
158
-     */
159
-    public function renderTags()
160
-    {
161
-        if (! count($this->meta))
162
-        {
163
-            return null;
164
-        }
165
-
166
-        $output = '';
167
-
168
-        // Character Encoding
169
-        $output .= "\t<meta charset=\"{$this->charset}\" >";
170
-
171
-        // Everything else
172
-        foreach ($this->meta as $name => $content)
173
-        {
174
-            if (is_array($content))
175
-            {
176
-                $content = implode(',', $content);
177
-            }
178
-
179
-            if (empty($content))
180
-            {
181
-                continue;
182
-            }
183
-
184
-            // Http Equivalent meta tags.
185
-            if (in_array($name, $this->http_equiv_meta))
186
-            {
187
-                $output .= "\t<meta http-equiv=\"{$name}\" content=\"{$content}\">\n";
188
-            }
189
-            // Standard Meta Tag
190
-            else {
191
-                $output .= "\t<meta name=\"{$name}\" content=\"{$content}\">\n";
192
-            }
193
-        }
194
-
195
-        return $output;
196
-    }
197
-
198
-    //--------------------------------------------------------------------
199
-
200
-    /**
201
-     * Registers a new HTTP Equivalent meta tag so it can be
202
-     * rendered out properly.
203
-     *
204
-     * @param $name
205
-     *
206
-     * @return $this
207
-     */
208
-    public function registerHTTPEquivTag($name)
209
-    {
210
-        if (is_null($name))
211
-        {
212
-            return $this;
213
-        }
214
-
215
-        $this->http_equiv_meta[] = strtolower($name);
216
-
217
-        return $this;
218
-    }
219
-
220
-    //--------------------------------------------------------------------
221
-
222
-
223
-    /**
224
-     * Convenience implementation to set a value
225
-     * as if it was a property of the class.
226
-     *
227
-     * @param $alias
228
-     * @param null $value
229
-     */
230
-    public function __set($alias, $value=null)
231
-    {
232
-        $this->set($alias, $value);
233
-    }
234
-
235
-    //--------------------------------------------------------------------
236
-
237
-    /**
238
-     * Convenience method to access a value
239
-     * as if it was a property of the class.
240
-     *
241
-     * @param $alias
242
-     *
243
-     * @return mixed
244
-     */
245
-    public function __get($alias)
246
-    {
247
-        return $this->get($alias);
248
-    }
249
-
250
-    //--------------------------------------------------------------------
38
+	/**
39
+	 * Stores the meta values the user has set.
40
+	 *
41
+	 * @var array
42
+	 */
43
+	protected $meta = [];
44
+
45
+	/**
46
+	 * Stores the standard meta-value names
47
+	 * Mostly here for reference, I guess.
48
+	 *
49
+	 * @var array
50
+	 */
51
+	protected $std_meta = [
52
+		'application-name',
53
+		'author',
54
+		'copyright',
55
+		'description',
56
+		'generator',
57
+		'keywords',
58
+		'robots',
59
+		'googlebot'
60
+	];
61
+
62
+	/**
63
+	 * Stores the HTTP-Equiv meta tags
64
+	 * since they need to be rendered differently.
65
+	 *
66
+	 * @var array
67
+	 */
68
+	protected $http_equiv_meta = [
69
+		'cache-control',
70
+		'content-language',
71
+		'content-type',
72
+		'default-style',
73
+		'expires',
74
+		'pragma',
75
+		'refresh',
76
+		'set-cookie'
77
+	];
78
+
79
+	/**
80
+	 * Stores the document's character encoding.
81
+	 *
82
+	 * @var string
83
+	 */
84
+	public $charset = 'utf-8';
85
+
86
+	//--------------------------------------------------------------------
87
+
88
+	public function __construct($ci)
89
+	{
90
+		$ci->config->load('html_meta', true);
91
+
92
+		$config = $ci->config->item('html_meta');
93
+
94
+		$this->meta = $config['meta'];
95
+
96
+		$this->http_equiv_meta = array_merge($this->http_equiv_meta, $config['http-equiv']);
97
+	}
98
+
99
+	//--------------------------------------------------------------------
100
+
101
+
102
+	/**
103
+	 * Sets a single meta item.
104
+	 * $alias can also be an array of key/value pairs to set.
105
+	 *
106
+	 * @param string|array $alias
107
+	 * @param null $value
108
+	 *
109
+	 * @return mixed
110
+	 */
111
+	public function set($alias, $value=null, $escape=true)
112
+	{
113
+		if (is_array($alias))
114
+		{
115
+			foreach ($alias as $key => $val)
116
+			{
117
+				$this->set($key, $val);
118
+			}
119
+
120
+			return $this;
121
+		}
122
+
123
+		// Charset
124
+		if (strtolower($alias) == 'charset')
125
+		{
126
+			$this->charset = $value;
127
+
128
+			return $this;
129
+		}
130
+
131
+		$this->meta[ strtolower($alias) ] = $escape ? esc($value, 'htmlAttr') : $value;
132
+
133
+		return $this;
134
+	}
135
+
136
+	//--------------------------------------------------------------------
137
+
138
+	/**
139
+	 * Returns a single meta item.
140
+	 *
141
+	 * @param $alias
142
+	 *
143
+	 * @return mixed
144
+	 */
145
+	public function get($alias)
146
+	{
147
+		$alias = strtolower($alias);
148
+
149
+		return isset($this->meta[ $alias ]) ? $this->meta[$alias] : null;
150
+	}
151
+
152
+	//--------------------------------------------------------------------
153
+
154
+	/**
155
+	 * Renders out all defined meta tags.
156
+	 *
157
+	 * @return mixed
158
+	 */
159
+	public function renderTags()
160
+	{
161
+		if (! count($this->meta))
162
+		{
163
+			return null;
164
+		}
165
+
166
+		$output = '';
167
+
168
+		// Character Encoding
169
+		$output .= "\t<meta charset=\"{$this->charset}\" >";
170
+
171
+		// Everything else
172
+		foreach ($this->meta as $name => $content)
173
+		{
174
+			if (is_array($content))
175
+			{
176
+				$content = implode(',', $content);
177
+			}
178
+
179
+			if (empty($content))
180
+			{
181
+				continue;
182
+			}
183
+
184
+			// Http Equivalent meta tags.
185
+			if (in_array($name, $this->http_equiv_meta))
186
+			{
187
+				$output .= "\t<meta http-equiv=\"{$name}\" content=\"{$content}\">\n";
188
+			}
189
+			// Standard Meta Tag
190
+			else {
191
+				$output .= "\t<meta name=\"{$name}\" content=\"{$content}\">\n";
192
+			}
193
+		}
194
+
195
+		return $output;
196
+	}
197
+
198
+	//--------------------------------------------------------------------
199
+
200
+	/**
201
+	 * Registers a new HTTP Equivalent meta tag so it can be
202
+	 * rendered out properly.
203
+	 *
204
+	 * @param $name
205
+	 *
206
+	 * @return $this
207
+	 */
208
+	public function registerHTTPEquivTag($name)
209
+	{
210
+		if (is_null($name))
211
+		{
212
+			return $this;
213
+		}
214
+
215
+		$this->http_equiv_meta[] = strtolower($name);
216
+
217
+		return $this;
218
+	}
219
+
220
+	//--------------------------------------------------------------------
221
+
222
+
223
+	/**
224
+	 * Convenience implementation to set a value
225
+	 * as if it was a property of the class.
226
+	 *
227
+	 * @param $alias
228
+	 * @param null $value
229
+	 */
230
+	public function __set($alias, $value=null)
231
+	{
232
+		$this->set($alias, $value);
233
+	}
234
+
235
+	//--------------------------------------------------------------------
236
+
237
+	/**
238
+	 * Convenience method to access a value
239
+	 * as if it was a property of the class.
240
+	 *
241
+	 * @param $alias
242
+	 *
243
+	 * @return mixed
244
+	 */
245
+	public function __get($alias)
246
+	{
247
+		return $this->get($alias);
248
+	}
249
+
250
+	//--------------------------------------------------------------------
251 251
 
252 252
 
253 253
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace Myth\Themers;
2 2
 
3
-require_once dirname(__FILE__) .'/escape.php';
3
+require_once dirname(__FILE__).'/escape.php';
4 4
 
5 5
 /**
6 6
  * Sprint
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      *
109 109
      * @return mixed
110 110
      */
111
-    public function set($alias, $value=null, $escape=true)
111
+    public function set($alias, $value = null, $escape = true)
112 112
     {
113 113
         if (is_array($alias))
114 114
         {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             return $this;
129 129
         }
130 130
 
131
-        $this->meta[ strtolower($alias) ] = $escape ? esc($value, 'htmlAttr') : $value;
131
+        $this->meta[strtolower($alias)] = $escape ? esc($value, 'htmlAttr') : $value;
132 132
 
133 133
         return $this;
134 134
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $alias = strtolower($alias);
148 148
 
149
-        return isset($this->meta[ $alias ]) ? $this->meta[$alias] : null;
149
+        return isset($this->meta[$alias]) ? $this->meta[$alias] : null;
150 150
     }
151 151
 
152 152
     //--------------------------------------------------------------------
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function renderTags()
160 160
     {
161
-        if (! count($this->meta))
161
+        if ( ! count($this->meta))
162 162
         {
163 163
             return null;
164 164
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param $alias
228 228
      * @param null $value
229 229
      */
230
-    public function __set($alias, $value=null)
230
+    public function __set($alias, $value = null)
231 231
     {
232 232
         $this->set($alias, $value);
233 233
     }
Please login to merge, or discard this patch.