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 — master ( 24a3f9...172650 )
by Brad
02:16
created
src/Base.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 	/**
145 145
 	 * Factory method to create a new Gears\String\Str object.
146 146
 	 *
147
-	 * @param mixed  $string             Must be a scalar string or an object
147
+	 * @param string  $string             Must be a scalar string or an object
148 148
 	 *                                   that implements the __toString() method
149 149
 	 *                                   or a value that is castable to a scalar
150 150
 	 *                                   string.
151 151
 	 *
152
-	 * @param string $encoding           The character encoding to use for this
152
+	 * @param string string           The character encoding to use for this
153 153
 	 *                                   string. If not specified, defaults to
154 154
 	 *                                   the value returned from
155 155
 	 *                                   mb_internal_encoding().
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @param  mixed $offset The index from which to retrieve the char
274 274
 	 *
275
-	 * @return string                 The character at the specified index
275
+	 * @return Base                 The character at the specified index
276 276
 	 * @throws \OutOfBoundsException If the positive or negative offset does
277 277
 	 *                               not exist
278 278
 	 */
Please login to merge, or discard this patch.
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -25,306 +25,306 @@
 block discarded – undo
25 25
  */
26 26
 class Base implements \Countable, \ArrayAccess, \IteratorAggregate, Comparable
27 27
 {
28
-	/**
29
-	 * This stores the actual scalar string that this object represents.
30
-	 *
31
-	 * @var string
32
-	 */
33
-	protected $scalarString;
28
+    /**
29
+     * This stores the actual scalar string that this object represents.
30
+     *
31
+     * @var string
32
+     */
33
+    protected $scalarString;
34 34
 
35
-	/**
36
-	 * This stores the actual scalar string length.
37
-	 *
38
-	 * Because Str objects are immutable, we can calculate the length at
39
-	 * construction time and reuse the same result over and over as needed,
40
-	 * instead of calling strlen() multiple times.
41
-	 *
42
-	 * @var int
43
-	 */
44
-	protected $stringLength;
35
+    /**
36
+     * This stores the actual scalar string length.
37
+     *
38
+     * Because Str objects are immutable, we can calculate the length at
39
+     * construction time and reuse the same result over and over as needed,
40
+     * instead of calling strlen() multiple times.
41
+     *
42
+     * @var int
43
+     */
44
+    protected $stringLength;
45 45
 
46
-	/**
47
-	 * Returns the string length.
48
-	 *
49
-	 * @return int The number of characters in the string.
50
-	 *             A UTF-8 multi-byte character is counted as 1.
51
-	 */
52
-	public function getLength()
53
-	{
54
-		return $this->stringLength;
55
-	}
46
+    /**
47
+     * Returns the string length.
48
+     *
49
+     * @return int The number of characters in the string.
50
+     *             A UTF-8 multi-byte character is counted as 1.
51
+     */
52
+    public function getLength()
53
+    {
54
+        return $this->stringLength;
55
+    }
56 56
 
57
-	/**
58
-	 * The stores the string's encoding.
59
-	 *
60
-	 * Which should be one of the mbstring module's supported encodings.
61
-	 * @see http://php.net/manual/en/mbstring.supported-encodings.php
62
-	 *
63
-	 * @var string
64
-	 */
65
-	protected $encoding;
57
+    /**
58
+     * The stores the string's encoding.
59
+     *
60
+     * Which should be one of the mbstring module's supported encodings.
61
+     * @see http://php.net/manual/en/mbstring.supported-encodings.php
62
+     *
63
+     * @var string
64
+     */
65
+    protected $encoding;
66 66
 
67
-	/**
68
-	 * Returns the encoding used by the Str object.
69
-	 *
70
-	 * @return string The current value of the $encoding property.
71
-	 */
72
-	public function getEncoding()
73
-	{
74
-		return $this->encoding;
75
-	}
67
+    /**
68
+     * Returns the encoding used by the Str object.
69
+     *
70
+     * @return string The current value of the $encoding property.
71
+     */
72
+    public function getEncoding()
73
+    {
74
+        return $this->encoding;
75
+    }
76 76
 
77
-	/**
78
-	 * Initialises a Str object.
79
-	 *
80
-	 * @param mixed  $string             Must be a scalar string or an object
81
-	 *                                   that implements the __toString() method
82
-	 *                                   or a value that is castable to a scalar
83
-	 *                                   string.
84
-	 *
85
-	 * @param string $encoding           The character encoding to use for this
86
-	 *                                   string. If not specified, defaults to
87
-	 *                                   the value returned from
88
-	 *                                   mb_internal_encoding().
89
-	 *
90
-	 * @throws \InvalidArgumentException If an array or object without a
91
-	 *                                   __toString method is passed as
92
-	 *                                   the first argument.
93
-	 */
94
-	public function __construct($string = '', $encoding = null)
95
-	{
96
-		// Make sure we can use the provided string value as a string.
97
-		if (is_array($string))
98
-		{
99
-			throw new \InvalidArgumentException
100
-			(
101
-				'Passed value cannot be an array'
102
-			);
103
-		}
104
-		elseif (is_object($string) && !method_exists($string, '__toString'))
105
-		{
106
-			throw new \InvalidArgumentException
107
-			(
108
-				'Passed object must have a __toString method'
109
-			);
110
-		}
77
+    /**
78
+     * Initialises a Str object.
79
+     *
80
+     * @param mixed  $string             Must be a scalar string or an object
81
+     *                                   that implements the __toString() method
82
+     *                                   or a value that is castable to a scalar
83
+     *                                   string.
84
+     *
85
+     * @param string $encoding           The character encoding to use for this
86
+     *                                   string. If not specified, defaults to
87
+     *                                   the value returned from
88
+     *                                   mb_internal_encoding().
89
+     *
90
+     * @throws \InvalidArgumentException If an array or object without a
91
+     *                                   __toString method is passed as
92
+     *                                   the first argument.
93
+     */
94
+    public function __construct($string = '', $encoding = null)
95
+    {
96
+        // Make sure we can use the provided string value as a string.
97
+        if (is_array($string))
98
+        {
99
+            throw new \InvalidArgumentException
100
+            (
101
+                'Passed value cannot be an array'
102
+            );
103
+        }
104
+        elseif (is_object($string) && !method_exists($string, '__toString'))
105
+        {
106
+            throw new \InvalidArgumentException
107
+            (
108
+                'Passed object must have a __toString method'
109
+            );
110
+        }
111 111
 
112
-		// Store the string internally.
113
-		$this->scalarString = (string)$string;
112
+        // Store the string internally.
113
+        $this->scalarString = (string)$string;
114 114
 
115
-		// Intialise Voku's UTF8 portability layer.
116
-		UTF8::checkForSupport();
115
+        // Intialise Voku's UTF8 portability layer.
116
+        UTF8::checkForSupport();
117 117
 
118
-		// Set the strings encoding.
119
-		if ($encoding !== null)
120
-		{
121
-			$this->encoding = $encoding;
122
-		}
123
-		else
124
-		{
125
-			$this->encoding = mb_internal_encoding();
126
-		}
118
+        // Set the strings encoding.
119
+        if ($encoding !== null)
120
+        {
121
+            $this->encoding = $encoding;
122
+        }
123
+        else
124
+        {
125
+            $this->encoding = mb_internal_encoding();
126
+        }
127 127
 
128
-		// Set the strings length property.
129
-		$this->stringLength = UTF8::strlen($this->scalarString,$this->encoding);
130
-	}
128
+        // Set the strings length property.
129
+        $this->stringLength = UTF8::strlen($this->scalarString,$this->encoding);
130
+    }
131 131
 
132
-	/**
133
-	 * Magic method to automatically turn a Str back into a scalar string.
134
-	 *
135
-	 * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
136
-	 *
137
-	 * @return string
138
-	 */
139
-	public function __toString()
140
-	{
141
-		return $this->scalarString;
142
-	}
132
+    /**
133
+     * Magic method to automatically turn a Str back into a scalar string.
134
+     *
135
+     * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
136
+     *
137
+     * @return string
138
+     */
139
+    public function __toString()
140
+    {
141
+        return $this->scalarString;
142
+    }
143 143
 
144
-	/**
145
-	 * Factory method to create a new Gears\String\Str object.
146
-	 *
147
-	 * @param mixed  $string             Must be a scalar string or an object
148
-	 *                                   that implements the __toString() method
149
-	 *                                   or a value that is castable to a scalar
150
-	 *                                   string.
151
-	 *
152
-	 * @param string $encoding           The character encoding to use for this
153
-	 *                                   string. If not specified, defaults to
154
-	 *                                   the value returned from
155
-	 *                                   mb_internal_encoding().
156
-	 *
157
-	 * @return static                    A Str object.
158
-	 *
159
-	 * @throws \InvalidArgumentException If an array or object without a
160
-	 *                                   __toString method is passed as
161
-	 *                                   the first argument.
162
-	 */
163
-	public static function s($string = '', $encoding = null)
164
-	{
165
-		return new static($string);
166
-	}
144
+    /**
145
+     * Factory method to create a new Gears\String\Str object.
146
+     *
147
+     * @param mixed  $string             Must be a scalar string or an object
148
+     *                                   that implements the __toString() method
149
+     *                                   or a value that is castable to a scalar
150
+     *                                   string.
151
+     *
152
+     * @param string $encoding           The character encoding to use for this
153
+     *                                   string. If not specified, defaults to
154
+     *                                   the value returned from
155
+     *                                   mb_internal_encoding().
156
+     *
157
+     * @return static                    A Str object.
158
+     *
159
+     * @throws \InvalidArgumentException If an array or object without a
160
+     *                                   __toString method is passed as
161
+     *                                   the first argument.
162
+     */
163
+    public static function s($string = '', $encoding = null)
164
+    {
165
+        return new static($string);
166
+    }
167 167
 
168
-	/**
169
-	 * Helper method, used internally.
170
-	 *
171
-	 * Basically all this does is saves us a few key strokes by copying
172
-	 * the current encoding to the next Str object we are creating.
173
-	 *
174
-	 * @param  string $string
175
-	 * @return static
176
-	 */
177
-	protected function newSelf($string)
178
-	{
179
-		return static::s($string, $this->encoding);
180
-	}
168
+    /**
169
+     * Helper method, used internally.
170
+     *
171
+     * Basically all this does is saves us a few key strokes by copying
172
+     * the current encoding to the next Str object we are creating.
173
+     *
174
+     * @param  string $string
175
+     * @return static
176
+     */
177
+    protected function newSelf($string)
178
+    {
179
+        return static::s($string, $this->encoding);
180
+    }
181 181
 
182
-	/**
183
-	 * Helper method, used internally.
184
-	 *
185
-	 * Given an array of scalar strings we will convert all them to Str objects.
186
-	 *
187
-	 * > NOTE: This method is recursive.
188
-	 *
189
-	 * @param  array $input
190
-	 * @return static[]
191
-	 */
192
-	protected function newSelfs(array $input)
193
-	{
194
-		$strObjects = [];
182
+    /**
183
+     * Helper method, used internally.
184
+     *
185
+     * Given an array of scalar strings we will convert all them to Str objects.
186
+     *
187
+     * > NOTE: This method is recursive.
188
+     *
189
+     * @param  array $input
190
+     * @return static[]
191
+     */
192
+    protected function newSelfs(array $input)
193
+    {
194
+        $strObjects = [];
195 195
 
196
-		foreach ($input as $key => $value)
197
-		{
198
-			if (is_string($value))
199
-			{
200
-				// Convert the scalar string to a Str Object
201
-				$strObjects[$key] = $this->newSelf($value);
202
-			}
203
-			elseif (is_array($value))
204
-			{
205
-				// Recurse into the array
206
-				$strObjects[$key] = $this->newSelfs($value);
207
-			}
208
-			else
209
-			{
210
-				// We don't know what it is do do nothing to it
211
-				$strObjects[$key] = $value;
212
-			}
213
-		}
196
+        foreach ($input as $key => $value)
197
+        {
198
+            if (is_string($value))
199
+            {
200
+                // Convert the scalar string to a Str Object
201
+                $strObjects[$key] = $this->newSelf($value);
202
+            }
203
+            elseif (is_array($value))
204
+            {
205
+                // Recurse into the array
206
+                $strObjects[$key] = $this->newSelfs($value);
207
+            }
208
+            else
209
+            {
210
+                // We don't know what it is do do nothing to it
211
+                $strObjects[$key] = $value;
212
+            }
213
+        }
214 214
 
215
-		return $strObjects;
216
-	}
215
+        return $strObjects;
216
+    }
217 217
 
218
-	/**
219
-	 * Countable interface method.
220
-	 *
221
-	 * @see http://php.net/manual/en/class.countable.php
222
-	 *
223
-	 * @return int
224
-	 */
225
-	public function count()
226
-	{
227
-		return $this->getLength();
228
-	}
218
+    /**
219
+     * Countable interface method.
220
+     *
221
+     * @see http://php.net/manual/en/class.countable.php
222
+     *
223
+     * @return int
224
+     */
225
+    public function count()
226
+    {
227
+        return $this->getLength();
228
+    }
229 229
 
230
-	/**
231
-	 * IteratorAggregate interface method.
232
-	 *
233
-	 * @see http://php.net/manual/en/class.iteratoraggregate.php
234
-	 *
235
-	 * @return \ArrayIterator
236
-	 */
237
-	public function getIterator()
230
+    /**
231
+     * IteratorAggregate interface method.
232
+     *
233
+     * @see http://php.net/manual/en/class.iteratoraggregate.php
234
+     *
235
+     * @return \ArrayIterator
236
+     */
237
+    public function getIterator()
238 238
     {
239
-		$chars = array();
239
+        $chars = array();
240 240
 
241 241
         for ($i = 0, $l = $this->getLength(); $i < $l; $i++)
242
-		{
242
+        {
243 243
             $chars[] = $this[$i];
244 244
         }
245 245
 
246 246
         return new \ArrayIterator($chars);
247 247
     }
248 248
 
249
-	/**
250
-	 * Checks to see if the character index exists.
251
-	 *
252
-	 * Implements part of the ArrayAccess interface. Offsets may be
253
-	 * negative to count from the last character in the string.
254
-	 *
255
-	 * @param int $index The integer of the index to check.
256
-	 * @return boolean
257
-	 */
258
-	public function offsetExists($index)
259
-	{
260
-		$index = (int)$index;
249
+    /**
250
+     * Checks to see if the character index exists.
251
+     *
252
+     * Implements part of the ArrayAccess interface. Offsets may be
253
+     * negative to count from the last character in the string.
254
+     *
255
+     * @param int $index The integer of the index to check.
256
+     * @return boolean
257
+     */
258
+    public function offsetExists($index)
259
+    {
260
+        $index = (int)$index;
261 261
 
262
-		if ($index >= 0) return ($this->getLength() > $index);
262
+        if ($index >= 0) return ($this->getLength() > $index);
263 263
 
264
-		return ($this->getLength() >= abs($index));
265
-	}
264
+        return ($this->getLength() >= abs($index));
265
+    }
266 266
 
267
-	/**
268
-	 * Returns the character at the given index. Offsets may be negative to
269
-	 * count from the last character in the string. Implements part of the
270
-	 * ArrayAccess interface, and throws an OutOfBoundsException if the index
271
-	 * does not exist.
272
-	 *
273
-	 * @param  mixed $offset The index from which to retrieve the char
274
-	 *
275
-	 * @return string                 The character at the specified index
276
-	 * @throws \OutOfBoundsException If the positive or negative offset does
277
-	 *                               not exist
278
-	 */
279
-	public function offsetGet($offset)
280
-	{
281
-		$offset = (int)$offset;
282
-		$length = $this->getLength();
267
+    /**
268
+     * Returns the character at the given index. Offsets may be negative to
269
+     * count from the last character in the string. Implements part of the
270
+     * ArrayAccess interface, and throws an OutOfBoundsException if the index
271
+     * does not exist.
272
+     *
273
+     * @param  mixed $offset The index from which to retrieve the char
274
+     *
275
+     * @return string                 The character at the specified index
276
+     * @throws \OutOfBoundsException If the positive or negative offset does
277
+     *                               not exist
278
+     */
279
+    public function offsetGet($offset)
280
+    {
281
+        $offset = (int)$offset;
282
+        $length = $this->getLength();
283 283
 
284
-		if (($offset >= 0 && $length <= $offset) || $length < abs($offset))
285
-		{
286
-			throw new \OutOfBoundsException('No character exists at the index');
287
-		}
284
+        if (($offset >= 0 && $length <= $offset) || $length < abs($offset))
285
+        {
286
+            throw new \OutOfBoundsException('No character exists at the index');
287
+        }
288 288
 
289
-		return $this->newSelf(UTF8::substr
290
-		(
291
-			$this->scalarString,
292
-			$offset,
293
-			1,
294
-			$this->encoding
295
-		));
296
-	}
289
+        return $this->newSelf(UTF8::substr
290
+        (
291
+            $this->scalarString,
292
+            $offset,
293
+            1,
294
+            $this->encoding
295
+        ));
296
+    }
297 297
 
298
-	/**
299
-	 * Implements part of the ArrayAccess interface, but throws an exception
300
-	 * when called. This maintains the immutability of Str objects.
301
-	 *
302
-	 * @param  mixed $offset The index of the character
303
-	 * @param  mixed $value  Value to set
304
-	 *
305
-	 * @throws \Exception When called
306
-	 */
307
-	public function offsetSet($offset, $value)
308
-	{
309
-		// Str is immutable, cannot directly set char
310
-		throw new \Exception('Str object is immutable, cannot modify char');
311
-	}
298
+    /**
299
+     * Implements part of the ArrayAccess interface, but throws an exception
300
+     * when called. This maintains the immutability of Str objects.
301
+     *
302
+     * @param  mixed $offset The index of the character
303
+     * @param  mixed $value  Value to set
304
+     *
305
+     * @throws \Exception When called
306
+     */
307
+    public function offsetSet($offset, $value)
308
+    {
309
+        // Str is immutable, cannot directly set char
310
+        throw new \Exception('Str object is immutable, cannot modify char');
311
+    }
312 312
 
313
-	/**
314
-	 * Implements part of the ArrayAccess interface, but throws an exception
315
-	 * when called. This maintains the immutability of Str objects.
316
-	 *
317
-	 * @param  mixed $offset The index of the character
318
-	 *
319
-	 * @throws \Exception When called
320
-	 */
321
-	public function offsetUnset($offset)
322
-	{
323
-		// Str is immutable, cannot directly unset char
324
-		throw new \Exception('Str object is immutable, cannot unset char');
325
-	}
313
+    /**
314
+     * Implements part of the ArrayAccess interface, but throws an exception
315
+     * when called. This maintains the immutability of Str objects.
316
+     *
317
+     * @param  mixed $offset The index of the character
318
+     *
319
+     * @throws \Exception When called
320
+     */
321
+    public function offsetUnset($offset)
322
+    {
323
+        // Str is immutable, cannot directly unset char
324
+        throw new \Exception('Str object is immutable, cannot unset char');
325
+    }
326 326
 
327
-	/**
327
+    /**
328 328
      * Implements Icecave\Parity\SubClassComparableInterface compare method.
329 329
      *
330 330
      * @see https://git.io/vVxSz
Please login to merge, or discard this patch.
Spacing   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,15 +96,13 @@  discard block
 block discarded – undo
96 96
 		// Make sure we can use the provided string value as a string.
97 97
 		if (is_array($string))
98 98
 		{
99
-			throw new \InvalidArgumentException
100
-			(
99
+			throw new \InvalidArgumentException(
101 100
 				'Passed value cannot be an array'
102 101
 			);
103 102
 		}
104 103
 		elseif (is_object($string) && !method_exists($string, '__toString'))
105 104
 		{
106
-			throw new \InvalidArgumentException
107
-			(
105
+			throw new \InvalidArgumentException(
108 106
 				'Passed object must have a __toString method'
109 107
 			);
110 108
 		}
@@ -126,7 +124,7 @@  discard block
 block discarded – undo
126 124
 		}
127 125
 
128 126
 		// Set the strings length property.
129
-		$this->stringLength = UTF8::strlen($this->scalarString,$this->encoding);
127
+		$this->stringLength = UTF8::strlen($this->scalarString, $this->encoding);
130 128
 	}
131 129
 
132 130
 	/**
@@ -286,8 +284,7 @@  discard block
 block discarded – undo
286 284
 			throw new \OutOfBoundsException('No character exists at the index');
287 285
 		}
288 286
 
289
-		return $this->newSelf(UTF8::substr
290
-		(
287
+		return $this->newSelf(UTF8::substr(
291 288
 			$this->scalarString,
292 289
 			$offset,
293 290
 			1,
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -100,8 +100,7 @@  discard block
 block discarded – undo
100 100
 			(
101 101
 				'Passed value cannot be an array'
102 102
 			);
103
-		}
104
-		elseif (is_object($string) && !method_exists($string, '__toString'))
103
+		} elseif (is_object($string) && !method_exists($string, '__toString'))
105 104
 		{
106 105
 			throw new \InvalidArgumentException
107 106
 			(
@@ -119,8 +118,7 @@  discard block
 block discarded – undo
119 118
 		if ($encoding !== null)
120 119
 		{
121 120
 			$this->encoding = $encoding;
122
-		}
123
-		else
121
+		} else
124 122
 		{
125 123
 			$this->encoding = mb_internal_encoding();
126 124
 		}
@@ -199,13 +197,11 @@  discard block
 block discarded – undo
199 197
 			{
200 198
 				// Convert the scalar string to a Str Object
201 199
 				$strObjects[$key] = $this->newSelf($value);
202
-			}
203
-			elseif (is_array($value))
200
+			} elseif (is_array($value))
204 201
 			{
205 202
 				// Recurse into the array
206 203
 				$strObjects[$key] = $this->newSelfs($value);
207
-			}
208
-			else
204
+			} else
209 205
 			{
210 206
 				// We don't know what it is do do nothing to it
211 207
 				$strObjects[$key] = $value;
@@ -259,7 +255,9 @@  discard block
 block discarded – undo
259 255
 	{
260 256
 		$index = (int)$index;
261 257
 
262
-		if ($index >= 0) return ($this->getLength() > $index);
258
+		if ($index >= 0) {
259
+		    return ($this->getLength() > $index);
260
+		}
263 261
 
264 262
 		return ($this->getLength() >= abs($index));
265 263
 	}
Please login to merge, or discard this patch.
src/Methods/Replace.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
     /**
19 19
      * Replaces all occurrences of $search in $str by $replacement.
20 20
      *
21
-     * @param  string|array $search        The needle to search for.
21
+     * @param  string $search        The needle to search for.
22 22
      *
23
-     * @param  string|array $replacement   The string to replace with.
23
+     * @param  string $replacement   The string to replace with.
24 24
      *
25 25
      * @param  bool         $caseSensitive To enforce case-sensitivity or not.
26 26
      *
Please login to merge, or discard this patch.
Spacing   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         if ($caseSensitive)
32 32
         {
33
-            $return = UTF8::str_replace
34
-            (
33
+            $return = UTF8::str_replace(
35 34
                 $search,
36 35
                 $replacement,
37 36
                 $this->scalarString
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
         }
40 39
         else
41 40
         {
42
-            $return = UTF8::str_ireplace
43
-            (
41
+            $return = UTF8::str_ireplace(
44 42
                 $search,
45 43
                 $replacement,
46 44
                 $this->scalarString
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
 
77 75
         if (count($search) !== count($replacement))
78 76
         {
79
-            throw new \InvalidArgumentException
80
-            (
77
+            throw new \InvalidArgumentException(
81 78
                 '$search and $replacement must the same length!'
82 79
             );
83 80
         }
@@ -103,8 +100,7 @@  discard block
 block discarded – undo
103 100
      */
104 101
     public function replaceBeginning($search, $replacement)
105 102
     {
106
-        return $this->regexReplace
107
-        (
103
+        return $this->regexReplace(
108 104
             '^'.preg_quote($search, '/'),
109 105
             UTF8::str_replace('\\', '\\\\', $replacement)
110 106
         );
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
      */
121 117
     public function replaceEnding($search, $replacement)
122 118
     {
123
-        return $this->regexReplace
124
-        (
119
+        return $this->regexReplace(
125 120
             preg_quote($search, '/').'$',
126 121
             UTF8::str_replace('\\', '\\\\', $replacement)
127 122
         );
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
                 $replacement,
37 37
                 $this->scalarString
38 38
             );
39
-        }
40
-        else
39
+        } else
41 40
         {
42 41
             $return = UTF8::str_ireplace
43 42
             (
@@ -71,8 +70,12 @@  discard block
 block discarded – undo
71 70
      */
72 71
     public function replaceExact($search, $replacement)
73 72
     {
74
-        if (!is_array($search)) $search = [$search];
75
-        if (!is_array($replacement)) $replacement = [$replacement];
73
+        if (!is_array($search)) {
74
+            $search = [$search];
75
+        }
76
+        if (!is_array($replacement)) {
77
+            $replacement = [$replacement];
78
+        }
76 79
 
77 80
         if (count($search) !== count($replacement))
78 81
         {
Please login to merge, or discard this patch.
src/Methods/Trim.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@
 block discarded – undo
11 11
 // -----------------------------------------------------------------------------
12 12
 ////////////////////////////////////////////////////////////////////////////////
13 13
 
14
-use voku\helper\UTF8;
15
-
16 14
 trait Trim
17 15
 {
18 16
     /**
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -16,50 +16,50 @@  discard block
 block discarded – undo
16 16
 trait Trim
17 17
 {
18 18
     /**
19
-	 * Removes whitespace from the start and end of the string.
20
-	 *
21
-	 * Supports the removal of unicode whitespace.
22
-	 * Accepts an optional string of characters to
23
-	 * strip instead of the defaults.
24
-	 *
25
-	 * @param  string $chars Optional string of characters to strip
26
-	 *
27
-	 * @return static
28
-	 */
29
-	public function trim($chars = null)
30
-	{
31
-		$chars = $this->getTrimChars($chars);
19
+     * Removes whitespace from the start and end of the string.
20
+     *
21
+     * Supports the removal of unicode whitespace.
22
+     * Accepts an optional string of characters to
23
+     * strip instead of the defaults.
24
+     *
25
+     * @param  string $chars Optional string of characters to strip
26
+     *
27
+     * @return static
28
+     */
29
+    public function trim($chars = null)
30
+    {
31
+        $chars = $this->getTrimChars($chars);
32 32
 
33
-		return $this->regexReplace("^[$chars]+|[$chars]+\$", '');
34
-	}
33
+        return $this->regexReplace("^[$chars]+|[$chars]+\$", '');
34
+    }
35 35
 
36
-	/**
37
-	 * Returns a string with whitespace removed from the start of the string.
38
-	 * Supports the removal of unicode whitespace. Accepts an optional
39
-	 * string of characters to strip instead of the defaults.
40
-	 *
41
-	 * @param  string $chars Optional string of characters to strip.
42
-	 *
43
-	 * @return static
44
-	 */
45
-	public function trimLeft($chars = null)
46
-	{
36
+    /**
37
+     * Returns a string with whitespace removed from the start of the string.
38
+     * Supports the removal of unicode whitespace. Accepts an optional
39
+     * string of characters to strip instead of the defaults.
40
+     *
41
+     * @param  string $chars Optional string of characters to strip.
42
+     *
43
+     * @return static
44
+     */
45
+    public function trimLeft($chars = null)
46
+    {
47 47
         return $this->regexReplace("^[".$this->getTrimChars($chars)."]+", '');
48
-	}
48
+    }
49 49
 
50
-	/**
51
-	 * Returns a string with whitespace removed from the end of the string.
52
-	 * Supports the removal of unicode whitespace. Accepts an optional
53
-	 * string of characters to strip instead of the defaults.
54
-	 *
55
-	 * @param  string $chars Optional string of characters to strip
56
-	 *
57
-	 * @return static
58
-	 */
59
-	public function trimRight($chars = null)
60
-	{
50
+    /**
51
+     * Returns a string with whitespace removed from the end of the string.
52
+     * Supports the removal of unicode whitespace. Accepts an optional
53
+     * string of characters to strip instead of the defaults.
54
+     *
55
+     * @param  string $chars Optional string of characters to strip
56
+     *
57
+     * @return static
58
+     */
59
+    public function trimRight($chars = null)
60
+    {
61 61
         return $this->regexReplace("[".$this->getTrimChars($chars)."]+\$", '');
62
-	}
62
+    }
63 63
 
64 64
     /**
65 65
      * Internal helper method for trim methods.
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
     protected function getTrimChars($chars)
71 71
     {
72 72
         if (!$chars)
73
-		{
74
-			return '[:space:]';
75
-		}
76
-		else
77
-		{
78
-			return preg_quote($chars, $this->regexDelimiter);
79
-		}
73
+        {
74
+            return '[:space:]';
75
+        }
76
+        else
77
+        {
78
+            return preg_quote($chars, $this->regexDelimiter);
79
+        }
80 80
     }
81 81
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@
 block discarded – undo
72 72
         if (!$chars)
73 73
 		{
74 74
 			return '[:space:]';
75
-		}
76
-		else
75
+		} else
77 76
 		{
78 77
 			return preg_quote($chars, $this->regexDelimiter);
79 78
 		}
Please login to merge, or discard this patch.
RoboFile.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
 
20 20
 class RoboFile extends Robo\Tasks
21 21
 {
22
-	public function test()
23
-	{
24
-		exit
25
-		(
26
-			$this->taskPHPUnit()
27
-			->arg('./tests')
28
-			->option('coverage-clover', './build/logs/clover.xml')
29
-			->run()->getExitCode()
30
-		);
31
-	}
22
+    public function test()
23
+    {
24
+        exit
25
+        (
26
+            $this->taskPHPUnit()
27
+            ->arg('./tests')
28
+            ->option('coverage-clover', './build/logs/clover.xml')
29
+            ->run()->getExitCode()
30
+        );
31
+    }
32 32
 }
Please login to merge, or discard this patch.
src/Exceptions/MisMatchedEncodingException.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@
 block discarded – undo
15 15
 {
16 16
     public function __construct()
17 17
     {
18
-        parent::__construct
19
-        (
18
+        parent::__construct(
20 19
             'You can not append a string of a different encoding '.
21 20
             'to that of the existing string!'
22 21
         );
Please login to merge, or discard this patch.
src/Str.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@
 block discarded – undo
27 27
  */
28 28
 class Str extends Base
29 29
 {
30
-	use Methods\To;
31
-	use Methods\Is;
32
-	use Methods\Pad;
33
-	use Methods\Has;
34
-	use Methods\Misc;
35
-	use Methods\Html;
36
-	use Methods\Regx;
37
-	use Methods\Trim;
38
-	use Methods\Remove;
39
-	use Methods\Ensure;
40
-	use Methods\Between;
41
-	use Methods\IndexOf;
42
-	use Methods\Replace;
43
-	use Methods\Truncate;
44
-	use Methods\Contains;
45
-	use Methods\FirstLast;
46
-	use Methods\StartEndWith;
47
-	use Methods\LongestCommon;
48
-	use Methods\CaseManipulators;
30
+    use Methods\To;
31
+    use Methods\Is;
32
+    use Methods\Pad;
33
+    use Methods\Has;
34
+    use Methods\Misc;
35
+    use Methods\Html;
36
+    use Methods\Regx;
37
+    use Methods\Trim;
38
+    use Methods\Remove;
39
+    use Methods\Ensure;
40
+    use Methods\Between;
41
+    use Methods\IndexOf;
42
+    use Methods\Replace;
43
+    use Methods\Truncate;
44
+    use Methods\Contains;
45
+    use Methods\FirstLast;
46
+    use Methods\StartEndWith;
47
+    use Methods\LongestCommon;
48
+    use Methods\CaseManipulators;
49 49
 }
Please login to merge, or discard this patch.
src/Builder.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@
 block discarded – undo
78 78
     }
79 79
 
80 80
     /**
81
-	 * Magic method to automatically turn the builder back into a scalar string.
82
-	 *
83
-	 * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
84
-	 *
85
-	 * @return string
86
-	 */
81
+     * Magic method to automatically turn the builder back into a scalar string.
82
+     *
83
+     * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
84
+     *
85
+     * @return string
86
+     */
87 87
     public function __toString()
88 88
     {
89 89
         return (string)$this->str;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -232,16 +232,14 @@
 block discarded – undo
232 232
      */
233 233
     public function remove($startIndex, $length)
234 234
     {
235
-        $start = UTF8::substr
236
-        (
235
+        $start = UTF8::substr(
237 236
             (string)$this->str,
238 237
             0,
239 238
             $startIndex,
240 239
             $this->str->getEncoding()
241 240
         );
242 241
 
243
-        $end = UTF8::substr
244
-        (
242
+        $end = UTF8::substr(
245 243
             (string)$this->str,
246 244
             $startIndex + $length,
247 245
             $this->str->getLength(),
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@
 block discarded – undo
110 110
             }
111 111
 
112 112
             $toBeAppended = $string;
113
-        }
114
-        else
113
+        } else
115 114
         {
116 115
             // Ensure the incoming string is string like... Str will throw
117 116
             // exceptions if not. We also make the assumption that any "scalar"
Please login to merge, or discard this patch.
src/Methods/StartEndWith.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function startsWith($substring, $caseSensitive = true)
31 31
     {
32
-        $startOfStr = UTF8::substr
33
-        (
32
+        $startOfStr = UTF8::substr(
34 33
             $this->scalarString,
35 34
             0,
36 35
             UTF8::strlen($substring, $this->encoding),
@@ -60,8 +59,7 @@  discard block
 block discarded – undo
60 59
     {
61 60
         $substringLength = UTF8::strlen($substring, $this->encoding);
62 61
 
63
-        $endOfStr = UTF8::substr
64
-        (
62
+        $endOfStr = UTF8::substr(
65 63
             $this->scalarString,
66 64
             $this->getLength() - $substringLength,
67 65
             $substringLength,
Please login to merge, or discard this patch.
src/Methods/Is.php 3 patches
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -16,122 +16,122 @@
 block discarded – undo
16 16
 trait Is
17 17
 {
18 18
     /**
19
-	 * Is the entire string lower case?
20
-	 *
21
-	 * @return bool Whether or not $str contains only lower case characters.
22
-	 */
23
-	public function isLowerCase()
24
-	{
25
-		return $this->regexMatch('^[[:lower:]]*$');
26
-	}
19
+     * Is the entire string lower case?
20
+     *
21
+     * @return bool Whether or not $str contains only lower case characters.
22
+     */
23
+    public function isLowerCase()
24
+    {
25
+        return $this->regexMatch('^[[:lower:]]*$');
26
+    }
27 27
 
28 28
     /**
29
-	 * Is the entire string upper case?
30
-	 *
31
-	 * @return bool Whether or not $str contains only upper case characters.
32
-	 */
33
-	public function isUpperCase()
34
-	{
35
-		return $this->regexMatch('^[[:upper:]]*$');
36
-	}
29
+     * Is the entire string upper case?
30
+     *
31
+     * @return bool Whether or not $str contains only upper case characters.
32
+     */
33
+    public function isUpperCase()
34
+    {
35
+        return $this->regexMatch('^[[:upper:]]*$');
36
+    }
37 37
 
38 38
     /**
39
-	 * Returns true if the string contains only alphabetic chars, false
40
-	 * otherwise.
41
-	 *
42
-	 * @return bool Whether or not $str contains only alphabetic chars
43
-	 */
44
-	public function isAlpha()
45
-	{
46
-		return $this->regexMatch('^[[:alpha:]]*$');
47
-	}
39
+     * Returns true if the string contains only alphabetic chars, false
40
+     * otherwise.
41
+     *
42
+     * @return bool Whether or not $str contains only alphabetic chars
43
+     */
44
+    public function isAlpha()
45
+    {
46
+        return $this->regexMatch('^[[:alpha:]]*$');
47
+    }
48 48
 
49 49
     /**
50
-	 * Returns true if the string contains only alphabetic and numeric chars,
51
-	 * false otherwise.
52
-	 *
53
-	 * @return bool Whether or not $str contains only alphanumeric chars
54
-	 */
55
-	public function isAlphanumeric()
56
-	{
57
-		return $this->regexMatch('^[[:alnum:]]*$');
58
-	}
59
-
60
-	/**
61
-	 * Returns true if the string contains only whitespace chars, false
62
-	 * otherwise.
63
-	 *
64
-	 * @return bool Whether or not $str contains only whitespace characters
65
-	 */
66
-	public function isBlank()
67
-	{
68
-		return $this->regexMatch('^[[:space:]]*$');
69
-	}
70
-
71
-	/**
72
-	 * Returns true if the string contains only hexadecimal chars, false
73
-	 * otherwise.
74
-	 *
75
-	 * @return bool Whether or not $str contains only hexadecimal chars
76
-	 */
77
-	public function isHexadecimal()
78
-	{
79
-		return $this->regexMatch('^[[:xdigit:]]*$');
80
-	}
81
-
82
-	/**
83
-	 * Returns true if the string is JSON, false otherwise. Unlike json_decode
84
-	 * in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers,
85
-	 * in that an empty string is not considered valid JSON.
86
-	 *
87
-	 * @return bool Whether or not $str is JSON
88
-	 */
89
-	public function isJson()
90
-	{
91
-		if ($this->getLength() === 0) return false;
92
-
93
-		json_decode($this->scalarString);
94
-
95
-		return (json_last_error() === JSON_ERROR_NONE);
96
-	}
97
-
98
-	/**
99
-	 * Returns true if the string is serialized, false otherwise.
100
-	 *
101
-	 * @return bool Whether or not $str is serialized
102
-	 */
103
-	public function isSerialized()
104
-	{
105
-		if ($this->getLength() === 0) return false;
106
-
107
-		/** @noinspection PhpUsageOfSilenceOperatorInspection */
108
-		return
109
-		(
110
-			$this->scalarString === 'b:0;' ||
111
-			@unserialize($this->scalarString) !== false
112
-		);
113
-	}
114
-
115
-	/**
116
-	 * Returns true if the string is base64 encoded, false otherwise.
117
-	 *
118
-	 * @return bool
119
-	 */
120
-	public function isBase64()
121
-	{
122
-		// An empty string is by definition not encoded.
123
-		if ($this->getLength() === 0) return false;
124
-
125
-		// Grab the current string value.
126
-		$possiblyEncoded = $this->scalarString;
127
-
128
-		// Attempt to decode it.
129
-		$decoded = base64_decode($possiblyEncoded, true);
130
-
131
-		// If we get false it can't be base64
132
-		if ($decoded === false) return false;
133
-
134
-		// Lets double check
135
-		return (base64_encode($decoded) === $this->scalarString);
136
-	}
50
+     * Returns true if the string contains only alphabetic and numeric chars,
51
+     * false otherwise.
52
+     *
53
+     * @return bool Whether or not $str contains only alphanumeric chars
54
+     */
55
+    public function isAlphanumeric()
56
+    {
57
+        return $this->regexMatch('^[[:alnum:]]*$');
58
+    }
59
+
60
+    /**
61
+     * Returns true if the string contains only whitespace chars, false
62
+     * otherwise.
63
+     *
64
+     * @return bool Whether or not $str contains only whitespace characters
65
+     */
66
+    public function isBlank()
67
+    {
68
+        return $this->regexMatch('^[[:space:]]*$');
69
+    }
70
+
71
+    /**
72
+     * Returns true if the string contains only hexadecimal chars, false
73
+     * otherwise.
74
+     *
75
+     * @return bool Whether or not $str contains only hexadecimal chars
76
+     */
77
+    public function isHexadecimal()
78
+    {
79
+        return $this->regexMatch('^[[:xdigit:]]*$');
80
+    }
81
+
82
+    /**
83
+     * Returns true if the string is JSON, false otherwise. Unlike json_decode
84
+     * in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers,
85
+     * in that an empty string is not considered valid JSON.
86
+     *
87
+     * @return bool Whether or not $str is JSON
88
+     */
89
+    public function isJson()
90
+    {
91
+        if ($this->getLength() === 0) return false;
92
+
93
+        json_decode($this->scalarString);
94
+
95
+        return (json_last_error() === JSON_ERROR_NONE);
96
+    }
97
+
98
+    /**
99
+     * Returns true if the string is serialized, false otherwise.
100
+     *
101
+     * @return bool Whether or not $str is serialized
102
+     */
103
+    public function isSerialized()
104
+    {
105
+        if ($this->getLength() === 0) return false;
106
+
107
+        /** @noinspection PhpUsageOfSilenceOperatorInspection */
108
+        return
109
+        (
110
+            $this->scalarString === 'b:0;' ||
111
+            @unserialize($this->scalarString) !== false
112
+        );
113
+    }
114
+
115
+    /**
116
+     * Returns true if the string is base64 encoded, false otherwise.
117
+     *
118
+     * @return bool
119
+     */
120
+    public function isBase64()
121
+    {
122
+        // An empty string is by definition not encoded.
123
+        if ($this->getLength() === 0) return false;
124
+
125
+        // Grab the current string value.
126
+        $possiblyEncoded = $this->scalarString;
127
+
128
+        // Attempt to decode it.
129
+        $decoded = base64_decode($possiblyEncoded, true);
130
+
131
+        // If we get false it can't be base64
132
+        if ($decoded === false) return false;
133
+
134
+        // Lets double check
135
+        return (base64_encode($decoded) === $this->scalarString);
136
+    }
137 137
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function isJson()
90 90
 	{
91
-		if ($this->getLength() === 0) return false;
91
+		if ($this->getLength() === 0) {
92
+		    return false;
93
+		}
92 94
 
93 95
 		json_decode($this->scalarString);
94 96
 
@@ -102,7 +104,9 @@  discard block
 block discarded – undo
102 104
 	 */
103 105
 	public function isSerialized()
104 106
 	{
105
-		if ($this->getLength() === 0) return false;
107
+		if ($this->getLength() === 0) {
108
+		    return false;
109
+		}
106 110
 
107 111
 		/** @noinspection PhpUsageOfSilenceOperatorInspection */
108 112
 		return
@@ -120,7 +124,9 @@  discard block
 block discarded – undo
120 124
 	public function isBase64()
121 125
 	{
122 126
 		// An empty string is by definition not encoded.
123
-		if ($this->getLength() === 0) return false;
127
+		if ($this->getLength() === 0) {
128
+		    return false;
129
+		}
124 130
 
125 131
 		// Grab the current string value.
126 132
 		$possiblyEncoded = $this->scalarString;
@@ -129,7 +135,9 @@  discard block
 block discarded – undo
129 135
 		$decoded = base64_decode($possiblyEncoded, true);
130 136
 
131 137
 		// If we get false it can't be base64
132
-		if ($decoded === false) return false;
138
+		if ($decoded === false) {
139
+		    return false;
140
+		}
133 141
 
134 142
 		// Lets double check
135 143
 		return (base64_encode($decoded) === $this->scalarString);
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@
 block discarded – undo
11 11
 // -----------------------------------------------------------------------------
12 12
 ////////////////////////////////////////////////////////////////////////////////
13 13
 
14
-use voku\helper\UTF8;
15
-
16 14
 trait Trim
17 15
 {
18 16
     /**
Please login to merge, or discard this patch.