| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | 'characters' => 'ABCDEFGHIKJLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789', | 
| 29 | 29 | 'width' => 230, | 
| 30 | 30 | 'height' => 70, | 
| 31 | - 'foregroundColors' => ['2980b9','2E9FFF','FF1166','000000','22EE99'], | |
| 31 | + 'foregroundColors' => ['2980b9', '2E9FFF', 'FF1166', '000000', '22EE99'], | |
| 32 | 32 | 'backgroundColor' => '#FFF', | 
| 33 | 33 | 'letterSpacing' => 6, | 
| 34 | 34 |              'fontFamily' => resource_path('views/vendor/captchaSimpleDriver/assets/fonts/DroidSerif.ttf'), | 
| @@ -18,14 +18,14 @@ discard block | ||
| 18 | 18 | * Configurations that needs to be done by user. | 
| 19 | 19 | */ | 
| 20 | 20 | $this->publish( | 
| 21 | - __DIR__ . '/../../config/captcha.php', | |
| 21 | + __DIR__.'/../../config/captcha.php', | |
| 22 | 22 |              config_path('captcha.php'), | 
| 23 | 23 | 'config' | 
| 24 | 24 | ); | 
| 25 | 25 | |
| 26 | 26 | // Validator extensions | 
| 27 | 27 | $this->app['validator']->extend( | 
| 28 | -            config('captcha.validator','captcha'), | |
| 28 | +            config('captcha.validator', 'captcha'), | |
| 29 | 29 |              function($attribute, $value, $parameters) { | 
| 30 | 30 | return captcha_verify($value); | 
| 31 | 31 | }, | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | public function register() | 
| 42 | 42 |      { | 
| 43 | 43 | // Bind captcha manager | 
| 44 | -        $this->app->bind('shetabit-captcha', function () { | |
| 44 | +        $this->app->bind('shetabit-captcha', function() { | |
| 45 | 45 |              return new CaptchaManager($this, config('captcha')); | 
| 46 | 46 | }); | 
| 47 | 47 | |
| @@ -7,5 +7,5 @@ | ||
| 7 | 7 |          config('captcha.drivers.simple.middleware') | 
| 8 | 8 | ) | 
| 9 | 9 | ->name( | 
| 10 | -        config('captcha.drivers.simple.route','captcha') | |
| 10 | +        config('captcha.drivers.simple.route', 'captcha') | |
| 11 | 11 | ); | 
| @@ -31,8 +31,8 @@ discard block | ||
| 31 | 31 | $this->settings = (object) $settings; | 
| 32 | 32 | |
| 33 | 33 | $this->bindViews() | 
| 34 | - ->bindRoutes() | |
| 35 | - ->publishResources(); | |
| 34 | + ->bindRoutes() | |
| 35 | + ->publishResources(); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | /** | 
| @@ -69,8 +69,8 @@ discard block | ||
| 69 | 69 |          $destinationPath = resource_path('views/vendor/captchaSimpleDriver'); | 
| 70 | 70 | |
| 71 | 71 | $this->serviceProvider | 
| 72 | - ->publish(__DIR__ . '/resources/views', $destinationPath, 'views') | |
| 73 | - ->publish(__DIR__ . '/resources/assets', $destinationPath.'/assets', 'assets'); | |
| 72 | + ->publish(__DIR__ . '/resources/views', $destinationPath, 'views') | |
| 73 | + ->publish(__DIR__ . '/resources/assets', $destinationPath.'/assets', 'assets'); | |
| 74 | 74 | |
| 75 | 75 | return $this; | 
| 76 | 76 | } | 
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | */ | 
| 43 | 43 | protected function bindViews() | 
| 44 | 44 |      { | 
| 45 | - $this->serviceProvider->bindViewFile(__DIR__ . '/resources/views', 'captchaSimpleDriver'); | |
| 45 | + $this->serviceProvider->bindViewFile(__DIR__.'/resources/views', 'captchaSimpleDriver'); | |
| 46 | 46 | |
| 47 | 47 | return $this; | 
| 48 | 48 | } | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | */ | 
| 55 | 55 | protected function bindRoutes() | 
| 56 | 56 |      { | 
| 57 | - $this->serviceProvider->bindRouteFile(__DIR__ . '/routes.php'); | |
| 57 | + $this->serviceProvider->bindRouteFile(__DIR__.'/routes.php'); | |
| 58 | 58 | |
| 59 | 59 | return $this; | 
| 60 | 60 | } | 
| @@ -69,8 +69,8 @@ discard block | ||
| 69 | 69 |          $destinationPath = resource_path('views/vendor/captchaSimpleDriver'); | 
| 70 | 70 | |
| 71 | 71 | $this->serviceProvider | 
| 72 | - ->publish(__DIR__ . '/resources/views', $destinationPath, 'views') | |
| 73 | - ->publish(__DIR__ . '/resources/assets', $destinationPath.'/assets', 'assets'); | |
| 72 | + ->publish(__DIR__.'/resources/views', $destinationPath, 'views') | |
| 73 | + ->publish(__DIR__.'/resources/assets', $destinationPath.'/assets', 'assets'); | |
| 74 | 74 | |
| 75 | 75 | return $this; | 
| 76 | 76 | } | 
| @@ -164,7 +164,7 @@ discard block | ||
| 164 | 164 |      { | 
| 165 | 165 | $value = session()->pull($key); | 
| 166 | 166 | |
| 167 | -        if (! empty($value)) { | |
| 167 | +        if ( ! empty($value)) { | |
| 168 | 168 | session()->forget($key); | 
| 169 | 169 | } | 
| 170 | 170 | |
| @@ -212,28 +212,28 @@ discard block | ||
| 212 | 212 | |
| 213 | 213 | $this->fillWithColor($canvas, $backgroundColor); | 
| 214 | 214 | |
| 215 | - $offsetX = ($width - strlen($token) * ($letterSpacing + $fontSize * 0.66)) / 2; | |
| 215 | + $offsetX = ($width-strlen($token) * ($letterSpacing+$fontSize * 0.66)) / 2; | |
| 216 | 216 | $offsetY = ceil(($height) / 1.5); | 
| 217 | 217 | |
| 218 | 218 | // write token | 
| 219 | 219 |          for ($i = 0; $i < strlen($token); $i++) { | 
| 220 | - $randomForegroundColor = $foregroundColors[mt_rand(0, count($foregroundColors) - 1)]; | |
| 220 | + $randomForegroundColor = $foregroundColors[mt_rand(0, count($foregroundColors)-1)]; | |
| 221 | 221 | imagettftext( | 
| 222 | 222 | $canvas, | 
| 223 | 223 | $this->settings->fontSize, | 
| 224 | - ceil(mt_rand(0,10)), | |
| 224 | + ceil(mt_rand(0, 10)), | |
| 225 | 225 | $offsetX, | 
| 226 | 226 | $offsetY, | 
| 227 | 227 | $this->prepareColor($canvas, $randomForegroundColor), | 
| 228 | 228 | $fontFamily, | 
| 229 | 229 | $token[$i] | 
| 230 | 230 | ); | 
| 231 | - $offsetX += ceil($fontSize * 0.66) + $letterSpacing; | |
| 231 | + $offsetX += ceil($fontSize * 0.66)+$letterSpacing; | |
| 232 | 232 | } | 
| 233 | 233 | |
| 234 | 234 | //Scratches foreground | 
| 235 | 235 |          for ($i = 0; $i < $this->settings->scratches[0]; $i++) { | 
| 236 | - $randomForegroundColor = $foregroundColors[mt_rand(0, count($foregroundColors) - 1)]; | |
| 236 | + $randomForegroundColor = $foregroundColors[mt_rand(0, count($foregroundColors)-1)]; | |
| 237 | 237 | |
| 238 | 238 | $this->drawScratch($canvas, $width, $height, $randomForegroundColor); | 
| 239 | 239 | } | 
| @@ -318,13 +318,13 @@ discard block | ||
| 318 | 318 | * @param int $maxLength | 
| 319 | 319 | * @return string | 
| 320 | 320 | */ | 
| 321 | - private function randomString($characters = '123456789' , $minLength = 4, $maxLength = 6) | |
| 321 | + private function randomString($characters = '123456789', $minLength = 4, $maxLength = 6) | |
| 322 | 322 |      { | 
| 323 | 323 | $randomLength = mt_rand($minLength, $maxLength); | 
| 324 | 324 | $string = []; | 
| 325 | 325 | |
| 326 | 326 |          for ($i = 0; $i < $randomLength; $i++) { | 
| 327 | - $string[] = $characters[mt_rand(1, mb_strlen($characters) - 1)]; | |
| 327 | + $string[] = $characters[mt_rand(1, mb_strlen($characters)-1)]; | |
| 328 | 328 | } | 
| 329 | 329 | |
| 330 | 330 | $string = implode($string); | 
| @@ -343,16 +343,16 @@ discard block | ||
| 343 | 343 | $hexColor = ($hexColor[0] == '#') ? substr($hexColor, 1) : $hexColor; | 
| 344 | 344 | |
| 345 | 345 | // Separate colors | 
| 346 | -        switch(strlen($hexColor)) { | |
| 346 | +        switch (strlen($hexColor)) { | |
| 347 | 347 | case 6: | 
| 348 | 348 | $red = $hexColor[0].$hexColor[1]; | 
| 349 | 349 | $green = $hexColor[2].$hexColor[3]; | 
| 350 | 350 | $blue = $hexColor[4].$hexColor[5]; | 
| 351 | 351 | break; | 
| 352 | 352 | case 3: | 
| 353 | - $red = str_repeat($hexColor[0],2); | |
| 354 | - $green = str_repeat($hexColor[1],2); | |
| 355 | - $blue = str_repeat($hexColor[2],2); | |
| 353 | + $red = str_repeat($hexColor[0], 2); | |
| 354 | + $green = str_repeat($hexColor[1], 2); | |
| 355 | + $blue = str_repeat($hexColor[2], 2); | |
| 356 | 356 | break; | 
| 357 | 357 | default: | 
| 358 | 358 | $red = $green = $blue = 0; | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 | */ | 
| 115 | 115 | protected function getDriverInstance() | 
| 116 | 116 |      { | 
| 117 | -        if (!empty($this->driverInstance)) { | |
| 117 | +        if ( ! empty($this->driverInstance)) { | |
| 118 | 118 | return $this->driverInstance; | 
| 119 | 119 | } | 
| 120 | 120 | |
| @@ -132,7 +132,7 @@ discard block | ||
| 132 | 132 | $this->validateDriver(); | 
| 133 | 133 | $class = $this->config['map'][$this->driver]; | 
| 134 | 134 | |
| 135 | -        if (!empty($this->callbackUrl)) { // use custom callbackUrl if exists | |
| 135 | +        if ( ! empty($this->callbackUrl)) { // use custom callbackUrl if exists | |
| 136 | 136 | $this->settings['callbackUrl'] = $this->callbackUrl; | 
| 137 | 137 | } | 
| 138 | 138 | |
| @@ -154,13 +154,13 @@ discard block | ||
| 154 | 154 |              throw new DriverNotFoundException('Driver not found in config file. Try updating the package.'); | 
| 155 | 155 | } | 
| 156 | 156 | |
| 157 | -        if (!class_exists($this->config['map'][$this->driver])) { | |
| 157 | +        if ( ! class_exists($this->config['map'][$this->driver])) { | |
| 158 | 158 |              throw new DriverNotFoundException('Driver source not found. Please update the package.'); | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | 161 | $reflect = new \ReflectionClass($this->config['map'][$this->driver]); | 
| 162 | 162 | |
| 163 | -        if (!$reflect->implementsInterface(DriverInterface::class)) { | |
| 163 | +        if ( ! $reflect->implementsInterface(DriverInterface::class)) { | |
| 164 | 164 |              throw new \Exception("Driver must be an instance of Contracts\DriverInterface."); | 
| 165 | 165 | } | 
| 166 | 166 | } |