public function testAllSubstrings()
 {
     $text = 'abc';
     $expected = ['a', 'ab', 'abc', 'b', 'bc', 'c'];
     $substrings = String::getAllSubStrings($text);
     $this->assertCount(6, $substrings);
     $this->assertEquals($expected, $substrings);
 }
 /**
  * Returns the Longest common substring
  * @param string $text1
  * @param string $text2
  * @return string
  */
 public function similarity($text1, $text2)
 {
     $intersection = array_intersect(String::getAllSubStrings($text1), String::getAllSubStrings($text2));
     $max = 0;
     $lcs = '';
     foreach ($intersection as $substr) {
         if (strlen($substr) > $max) {
             $max = strlen($substr);
             $lcs = $substr;
         }
     }
     return $lcs;
 }