Completed
Push — master ( 1165e2...26f27f )
by Terry
02:02
created
src/AssertionFailedException.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 /**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * @param array $constraints
29 29
      * @param string $level
30 30
      */
31
-    public function __construct(string $message, int $code, string $propertyPath = null, $value, array $constraints=[], string $level='critical')
31
+    public function __construct(string $message, int $code, string $propertyPath = null, $value, array $constraints = [ ], string $level = 'critical')
32 32
     {
33 33
         parent::__construct($message, $code);
34 34
         $this->propertyPath     = $propertyPath;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $calling_location = $this->getCallingFileAndLine();
51 51
 
52
-        return $this->propertyPath . ' in ' .$calling_location;
52
+        return $this->propertyPath.' in '.$calling_location;
53 53
     }
54 54
 
55 55
     /**
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function getCallingFileAndLine() : string
75 75
     {
76
-        foreach ( $this->getTrace() as $trace )
76
+        foreach ($this->getTrace() as $trace)
77 77
         {
78 78
             $trace = (object)$trace;
79
-            if ( empty($trace->file) )
79
+            if (empty($trace->file))
80 80
             {
81 81
                 continue;
82 82
             }
83 83
             $file = static::beforeLast('.php', static::afterLast('/', $trace->file));
84
-            if ( in_array($file, ['AssertionChain', 'Assertion']) )
84
+            if (in_array($file, [ 'AssertionChain', 'Assertion' ]))
85 85
             {
86 86
                 continue;
87 87
             }
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
      * @param bool $return_original
117 117
      * @return string
118 118
      */
119
-    public static function afterLast(string $needle, string $haystack, bool $return_original=false) : string
119
+    public static function afterLast(string $needle, string $haystack, bool $return_original = false) : string
120 120
     {
121
-        if ( static::strrevpos($haystack, $needle) !== -1 )
121
+        if (static::strrevpos($haystack, $needle) !== -1)
122 122
         {
123 123
             return mb_substr($haystack, static::strrevpos($haystack, $needle) + mb_strlen($needle));
124 124
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public static function beforeLast(string $needle, string $haystack) : string
147 147
     {
148
-        $position   = static::strrevpos($haystack, $needle);
148
+        $position = static::strrevpos($haystack, $needle);
149 149
 
150 150
         return $position === -1 ? '' : mb_substr($haystack, 0, static::strrevpos($haystack, $needle));
151 151
     }
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @param bool|false $throwValidationError
8 8
  * @return Assert
9 9
  */
10
-function Assert($value, $throwValidationError=false)
10
+function Assert($value, $throwValidationError = false)
11 11
 {
12 12
     $assert = new Assert($value);
13
-    if ( ! $throwValidationError )
13
+    if ( ! $throwValidationError)
14 14
     {
15 15
         return $assert;
16 16
     }
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
  * @param string $level
26 26
  * @return Assert
27 27
  */
28
-function Validate($value, $name='', $code=0, $error='', $level=Assert::WARNING)
28
+function Validate($value, $name = '', $code = 0, $error = '', $level = Assert::WARNING)
29 29
 {
30 30
     $assert = new Assert($value);
31 31
     $assert->setExceptionClass('Terah\Assert\ValidationFailedException');
32
-    if ( $name )
32
+    if ($name)
33 33
     {
34 34
         $assert->name($name);
35 35
     }
36
-    if ( $code )
36
+    if ($code)
37 37
     {
38 38
         $assert->code($code);
39 39
     }
40
-    if ( $error )
40
+    if ($error)
41 41
     {
42 42
         $assert->error($error);
43 43
     }
44
-    if ( $level )
44
+    if ($level)
45 45
     {
46 46
         $assert->level($level);
47 47
     }
Please login to merge, or discard this patch.