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
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 2 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.
src/Base.php 2 patches
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.
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 1 patch
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.
src/Methods/Misc.php 1 patch
Spacing   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,16 +66,14 @@  discard block
 block discarded – undo
66 66
     {
67 67
         if ($index > $this->getLength()) throw new \OutOfBoundsException();
68 68
 
69
-        $start = UTF8::substr
70
-        (
69
+        $start = UTF8::substr(
71 70
             $this->scalarString,
72 71
             0,
73 72
             $index,
74 73
             $this->encoding
75 74
         );
76 75
 
77
-        $end = UTF8::substr
78
-        (
76
+        $end = UTF8::substr(
79 77
             $this->scalarString,
80 78
             $index,
81 79
             $this->getLength(),
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
      */
105 103
     public function repeat($multiplier)
106 104
     {
107
-        return $this->newSelf
108
-        (
105
+        return $this->newSelf(
109 106
             UTF8::str_repeat($this->scalarString, $multiplier)
110 107
         );
111 108
     }
@@ -163,8 +160,7 @@  discard block
 block discarded – undo
163 160
             $length = $end - $start;
164 161
         }
165 162
 
166
-        return $this->newSelf
167
-        (
163
+        return $this->newSelf(
168 164
             UTF8::substr($this->scalarString, $start, $length, $this->encoding)
169 165
         );
170 166
     }
@@ -179,8 +175,7 @@  discard block
 block discarded – undo
179 175
      */
180 176
     public function surround($substring)
181 177
     {
182
-        return $this->newSelf
183
-        (
178
+        return $this->newSelf(
184 179
             implode('', [$substring, $this->scalarString, $substring])
185 180
         );
186 181
     }
@@ -213,8 +208,7 @@  discard block
 block discarded – undo
213 208
     {
214 209
         if ($caseSensitive)
215 210
         {
216
-            return UTF8::substr_count
217
-            (
211
+            return UTF8::substr_count(
218 212
                 $this->scalarString,
219 213
                 $substring,
220 214
                 $this->encoding
Please login to merge, or discard this patch.
src/Methods/Between.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
         $endIndex = $this->indexOf($end, $substrIndex);
43 43
         if ($endIndex === false) return $this->newSelf('');
44 44
 
45
-        $result = UTF8::substr
46
-        (
45
+        $result = UTF8::substr(
47 46
             $this->scalarString,
48 47
             $substrIndex,
49 48
             $endIndex - $substrIndex,
Please login to merge, or discard this patch.