@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | public function boot() |
| 38 | 38 | { |
| 39 | 39 | $this->publishes([ |
| 40 | - __DIR__.'/lang/validation/'.App::getLocale().'.php' => resource_path('lang/validation/'.App::getLocale().'.php'), |
|
| 40 | + __DIR__ . '/lang/validation/' . App::getLocale() . '.php' => resource_path('lang/validation/' . App::getLocale() . '.php'), |
|
| 41 | 41 | ]); |
| 42 | 42 | |
| 43 | - foreach (glob(__DIR__.'/Rules/*.php') as $file) { |
|
| 43 | + foreach (glob(__DIR__ . '/Rules/*.php') as $file) { |
|
| 44 | 44 | require_once $file; |
| 45 | 45 | |
| 46 | 46 | // get the file name of the current file without the extension |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $class = basename($file, '.php'); |
| 49 | 49 | |
| 50 | 50 | $Rule = 'Iamfarhad\Validation\Rules'; |
| 51 | - if (class_exists($Rule.'\\'.$class)) { |
|
| 52 | - $reflectionClass = new \ReflectionClass($Rule.'\\'.$class); |
|
| 53 | - if (! $reflectionClass->implementsInterface(ValidationRuleInterface::class)) { |
|
| 51 | + if (class_exists($Rule . '\\' . $class)) { |
|
| 52 | + $reflectionClass = new \ReflectionClass($Rule . '\\' . $class); |
|
| 53 | + if (!$reflectionClass->implementsInterface(ValidationRuleInterface::class)) { |
|
| 54 | 54 | throw new \Exception('this extenstion is not instance of ValidationRuleInterface'); |
| 55 | 55 | } |
| 56 | 56 | $module = $reflectionClass->newInstanceArgs([]); |
@@ -14,7 +14,7 @@ |
||
| 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; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function rule($attribute, $value, $parameters, $validator): bool |
| 13 | 13 | { |
| 14 | - if (! preg_match('/^\d{16}$/', $value)) { |
|
| 14 | + if (!preg_match('/^\d{16}$/', $value)) { |
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | $sum = 0; |
@@ -11,14 +11,14 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function rule($attribute, $value, $parameters, $validator): bool |
| 13 | 13 | { |
| 14 | - 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)) { |
|
| 14 | + 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)) { |
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | $sub = 0; |
| 18 | 18 | if (strlen($value) == 8) { |
| 19 | - $value = '00'.$value; |
|
| 19 | + $value = '00' . $value; |
|
| 20 | 20 | } elseif (strlen($value) == 9) { |
| 21 | - $value = '0'.$value; |
|
| 21 | + $value = '0' . $value; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | for ($i = 0; $i <= 8; $i++) { |
@@ -18,14 +18,14 @@ |
||
| 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++) { |
@@ -19,12 +19,12 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function __construct() |
| 21 | 21 | { |
| 22 | - $app_lang = resource_path('lang/validation/'.App::getLocale().'.php'); |
|
| 22 | + $app_lang = resource_path('lang/validation/' . App::getLocale() . '.php'); |
|
| 23 | 23 | |
| 24 | - if (! file_exists($app_lang)) { |
|
| 24 | + if (!file_exists($app_lang)) { |
|
| 25 | 25 | $this->lang = include $app_lang; |
| 26 | 26 | } else { |
| 27 | - $this->lang = include __DIR__.'/lang/validation/'.App::getLocale().'.php'; |
|
| 27 | + $this->lang = include __DIR__ . '/lang/validation/' . App::getLocale() . '.php'; |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |