Passed
Push — master ( bfb841...301b7b )
by farhad
06:09 queued 02:26
created
src/Contracts/AbstractValidationRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      */
47 47
     public function register(): void
48 48
     {
49
-        \Validator::extend($this->getValidationRule(), function ($attribute, $value, $parameters, $validator) {
49
+        \Validator::extend($this->getValidationRule(), function($attribute, $value, $parameters, $validator) {
50 50
             return $this->rule($attribute, $value, $parameters, $validator);
51 51
         });
52 52
         \Validator::replacer($this->getValidationRule(), 'ValidationMessages@message');
Please login to merge, or discard this patch.
src/Rules/IsNotPersian.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
         if (is_string($value)) {
15 15
             $this->status = (bool) preg_match("/[\x{600}-\x{6FF}]/u", $value);
16 16
 
17
-            return ! $this->status;
17
+            return !$this->status;
18 18
         }
19 19
 
20 20
         return false;
Please login to merge, or discard this patch.
src/Rules/ShebaNumber.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
         }
19 19
 
20 20
         $value = preg_replace('/[\W_]+/', '', strtoupper($value));
21
-        if ((4 > strlen($value) || strlen($value) > 34) || (is_numeric($value[0]) || is_numeric($value[1])) || (! is_numeric($value[2]) || ! is_numeric($value[3]))) {
21
+        if ((4 > strlen($value) || strlen($value) > 34) || (is_numeric($value[0]) || is_numeric($value[1])) || (!is_numeric($value[2]) || !is_numeric($value[3]))) {
22 22
             return false;
23 23
         }
24 24
         $ibanReplaceChars = range('A', 'Z');
25 25
         foreach (range(10, 35) as $tempvalue) {
26 26
             $ibanReplaceValues[] = strval($tempvalue);
27 27
         }
28
-        $tmpIBAN = substr($value, 4).substr($value, 0, 4);
28
+        $tmpIBAN = substr($value, 4) . substr($value, 0, 4);
29 29
         $tmpIBAN = str_replace($ibanReplaceChars, $ibanReplaceValues, $tmpIBAN);
30 30
         $tmpValue = intval(substr($tmpIBAN, 0, 1));
31 31
         for ($i = 1; $i < strlen($tmpIBAN); $i++) {
Please login to merge, or discard this patch.
src/ValidationMessages.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
      */
26 26
     public function __construct()
27 27
     {
28
-        $app_lang = resource_path('lang/validation/'.App::getLocale().'.php');
28
+        $app_lang = resource_path('lang/validation/' . App::getLocale() . '.php');
29 29
 
30
-        if (! file_exists($app_lang)) {
30
+        if (!file_exists($app_lang)) {
31 31
             $this->lang = include $app_lang;
32 32
         } else {
33
-            $this->lang = include __DIR__.'/lang/validation/'.App::getLocale().'.php';
33
+            $this->lang = include __DIR__ . '/lang/validation/' . App::getLocale() . '.php';
34 34
         }
35 35
     }
36 36
 
Please login to merge, or discard this patch.
src/Rules/CardNumber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function rule($attribute, $value, $parameters, $validator): bool
23 23
     {
24
-        if (! preg_match('/^\d{16}$/', $value)) {
24
+        if (!preg_match('/^\d{16}$/', $value)) {
25 25
             return false;
26 26
         }
27 27
         $sum = 0;
Please login to merge, or discard this patch.
src/Rules/MelliCode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
      */
22 22
     public function rule($attribute, $value, $parameters, $validator): bool
23 23
     {
24
-        if (! preg_match('/^\d{8,10}$/', $value) || preg_match('/^[0]{10}|[1]{10}|[2]{10}|[3]{10}|[4]{10}|[5]{10}|[6]{10}|[7]{10}|[8]{10}|[9]{10}$/', $value)) {
24
+        if (!preg_match('/^\d{8,10}$/', $value) || preg_match('/^[0]{10}|[1]{10}|[2]{10}|[3]{10}|[4]{10}|[5]{10}|[6]{10}|[7]{10}|[8]{10}|[9]{10}$/', $value)) {
25 25
             return false;
26 26
         }
27 27
         $sub = 0;
28 28
         if (strlen($value) == 8) {
29
-            $value = '00'.$value;
29
+            $value = '00' . $value;
30 30
         } elseif (strlen($value) == 9) {
31
-            $value = '0'.$value;
31
+            $value = '0' . $value;
32 32
         }
33 33
 
34 34
         for ($i = 0; $i <= 8; $i++) {
Please login to merge, or discard this patch.
src/ValidationServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     public function boot()
39 39
     {
40 40
         $this->publishes([
41
-            __DIR__.'/lang/validation/'.App::getLocale().'.php' => resource_path('lang/validation/'.App::getLocale().'.php'),
41
+            __DIR__ . '/lang/validation/' . App::getLocale() . '.php' => resource_path('lang/validation/' . App::getLocale() . '.php'),
42 42
         ]);
43 43
 
44
-        foreach (glob(__DIR__.'/Rules/*.php') as $file) {
44
+        foreach (glob(__DIR__ . '/Rules/*.php') as $file) {
45 45
             require_once $file;
46 46
 
47 47
             // get the file name of the current file without the extension
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
             $class = basename($file, '.php');
50 50
 
51 51
             $Rule = 'Iamfarhad\Validation\Rules';
52
-            if (class_exists($Rule.'\\'.$class)) {
53
-                $reflectionClass = new \ReflectionClass($Rule.'\\'.$class);
54
-                if (! $reflectionClass->isSubclassOf(AbstractValidationRule::class)) {
55
-                    throw new \Exception('this extension ('.$class.') is not instance of AbstractValidationRule');
52
+            if (class_exists($Rule . '\\' . $class)) {
53
+                $reflectionClass = new \ReflectionClass($Rule . '\\' . $class);
54
+                if (!$reflectionClass->isSubclassOf(AbstractValidationRule::class)) {
55
+                    throw new \Exception('this extension (' . $class . ') is not instance of AbstractValidationRule');
56 56
                 }
57 57
                 // Register extension
58 58
                 $module = $reflectionClass->newInstanceArgs([]);
Please login to merge, or discard this patch.