Completed
Branch master (a73664)
by Sworup
04:17
created
src/ProfanityFilter.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
     public function clean($string, $censorChar = "*")
19 19
     {
20
-        if (empty($string)) return $this->createOutputObject();
20
+        if (empty($string)) {
21
+            return $this->createOutputObject();
22
+        }
21 23
 
22 24
         $newstring = $this->checkForBadWordsAnywhere($string, $censorChar);
23 25
         $newstring = $this->checkForBlackListedWords($newstring, $censorChar);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $replacement = array();
34 34
         for ($x = 0; $x < $total_badwords; $x++) {
35 35
             $replacement[$x] = str_repeat($censorChar, strlen($badwords[$x]));
36
-            $badwords[$x] = '/' . str_ireplace(array_keys($replace), array_values($replace), $badwords[$x]) . '/i';
36
+            $badwords[$x] = '/'.str_ireplace(array_keys($replace), array_values($replace), $badwords[$x]).'/i';
37 37
         }
38 38
         return preg_replace($badwords, $replacement, $string);
39 39
     }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
         $replace   = $this->replace;
45 45
         $replacement = array();
46 46
         $total_blacklist = count($blackList);
47
-        for($i=0;$i < $total_blacklist;$i++) {
47
+        for ($i = 0; $i < $total_blacklist; $i++) {
48 48
             $splitword = str_split($blackList[$i]);
49 49
             $first_time_through = true;
50 50
             $regex_ready_word = "";
51 51
             $replacement[$i] = str_repeat($censorChar, strlen($blackList[$i]));
52
-            foreach($splitword as $letter) {
53
-                if($first_time_through) {
52
+            foreach ($splitword as $letter) {
53
+                if ($first_time_through) {
54 54
                     $first_time_through = false;
55 55
                     $regex_ready_word .= str_ireplace(array_keys($replace), array_values($replace), $letter);
56 56
                 } else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 }
59 59
             }
60 60
             
61
-            $blackList[$i] ="#\b$regex_ready_word\b#i";
61
+            $blackList[$i] = "#\b$regex_ready_word\b#i";
62 62
         }
63 63
         return preg_replace($blackList, $replacement, $string);
64 64
     }
Please login to merge, or discard this patch.
src/ProfanityFilterServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function boot()
15 15
     {
16
-        $configPath = __DIR__ . '/../config/config.php';
16
+        $configPath = __DIR__.'/../config/config.php';
17 17
         $this->mergeConfigFrom($configPath, 'profanity-filter');
18 18
     }
19 19
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function register()
26 26
     {
27
-        $this->app['profanity'] = $this->app->share(function ($app) {
27
+        $this->app['profanity'] = $this->app->share(function($app) {
28 28
             $dependency = $this->app['config']['profanity-filter.words'];
29 29
             $blacklist  = $this->app['config']['profanity-filter.blacklist'];
30 30
             $replace    = $this->app['config']['profanity-filter.replace'];
Please login to merge, or discard this patch.