Completed
Pull Request — master (#5)
by Akpé Aurelle Emmanuel Moïse
01:56
created
tests/Similar_textTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Ezama\tests{
3
-    require($DIR = (($dir=dirname(__DIR__)).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR)).'similar_text.php';
3
+    require($DIR = (($dir = dirname(__DIR__)).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR)).'similar_text.php';
4 4
     require $DIR.'simpleCommonTextSimilarities.php';
5 5
     require $DIR.'complexCommonTextSimilarities.php';
6 6
     require $dir.DIRECTORY_SEPARATOR.'similar_text.php';
Please login to merge, or discard this patch.
src/complexCommonTextSimilarities.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
         
37 37
         protected static function isUrl($url, &$getDomain = '')
38 38
         {
39
-            $matches=array();
40
-            $bool= is_string($url) && preg_match('/\./', $url) && preg_match(self::URL_POSIX_FORMAT, $url) && preg_match(self::URL_FORMAT_EXTENDED_PATTERN, $url, $matches);
41
-            $getDomain = $bool ? self::getDomain($url, $matches[1]):'';
39
+            $matches = array();
40
+            $bool = is_string($url) && preg_match('/\./', $url) && preg_match(self::URL_POSIX_FORMAT, $url) && preg_match(self::URL_FORMAT_EXTENDED_PATTERN, $url, $matches);
41
+            $getDomain = $bool ? self::getDomain($url, $matches[1]) : '';
42 42
             return $bool;
43 43
         }
44 44
         
45 45
         protected static function getDomain($url, $match)
46 46
         {
47
-            return ($getDomain = explode('.', parse_url($url, $match ? PHP_URL_HOST : PHP_URL_PATH))) ? (($c = count($getDomain)) > 1 ? ($getDomain[$c-2]) : '') : '';
47
+            return ($getDomain = explode('.', parse_url($url, $match ? PHP_URL_HOST : PHP_URL_PATH))) ? (($c = count($getDomain)) > 1 ? ($getDomain[$c - 2]) : '') : '';
48 48
         }
49 49
         
50 50
         public static function strippedUrl($a, $b)
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             if (!is_string($a) || !is_string($b)) {
79 79
                 return false;
80 80
             }
81
-            $filter = function ($v) {
81
+            $filter = function($v) {
82 82
                 return !(ctype_space($v));
83 83
             };
84 84
             self::filter($a, $b, $filter, true);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         
105 105
         public static function punctuactionChangesOccured($a, $b, $insensitive = true, $considerSpace = true)
106 106
         {
107
-            $filter = function ($v) use ($considerSpace) {
107
+            $filter = function($v) use ($considerSpace) {
108 108
                 return $considerSpace ? !(ctype_space($v) || ctype_punct($v)) : !ctype_punct($v);
109 109
             };
110 110
             if (!is_string($a) || !is_string($b)) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             if (!is_string($a) || !is_string($b)) {
121 121
                 return false;
122 122
             }
123
-            $filter = function ($v) {
123
+            $filter = function($v) {
124 124
                 return !(ctype_space($v) || ctype_punct($v));
125 125
             };
126 126
             
Please login to merge, or discard this patch.
src/simpleCommonTextSimilarities.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         
23 23
         public static function similarButNotEqual($a, $b)
24 24
         {
25
-            return self::similarText($a, $b, 2, true, $check) && is_array($check)&&$check['similar'] === 100.0 && $check['equal'] === false;
25
+            return self::similarText($a, $b, 2, true, $check) && is_array($check) && $check['similar'] === 100.0 && $check['equal'] === false;
26 26
         }
27 27
         
28 28
         public static function aIsSuperStringOfB($a, $b)
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         
37 37
         public static function wordsReorderOccured($a, $b, $considerPunctuation = true)
38 38
         {
39
-            $filter = function ($v) use ($considerPunctuation) {
39
+            $filter = function($v) use ($considerPunctuation) {
40 40
                 return $considerPunctuation ? !(ctype_space($v) || ctype_punct($v)) : !ctype_space($v);
41 41
             };
42 42
             return self::similarText($a, $b, 2, true, $check, true) && is_array($check) && self::wro_filter($check, $filter) ?true :false;
Please login to merge, or discard this patch.
src/similar_text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
             if (is_array($split)) {
116 116
                 return
117 117
                     array_map(
118
-                        function ($val) {
118
+                        function($val) {
119 119
                             if (self::is_ascii($val)) {
120 120
                                 return strtolower($val);
121 121
                             }
Please login to merge, or discard this patch.