Completed
Pull Request — master (#1)
by
unknown
04:35 queued 02:12
created
src/ProfanityFilter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,21 +44,21 @@
 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 {
57
-                    $regex_ready_word .= "\W*".str_ireplace(array_keys($replace), array_values($replace), $letter);
57
+                    $regex_ready_word .= "\W*" . str_ireplace(array_keys($replace), array_values($replace), $letter);
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.
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.
src/ProfanityFilterServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 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.