Skip to content

Commit e484b3c

Browse files
committed
Add soundex
1 parent b9a2004 commit e484b3c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Diff for: composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"source": "https://github.com/Vectorface/MySQLite"
2121
},
2222
"require": {
23-
"php": "^8.0.0"
23+
"php": "^8.0.0",
24+
"ext-pdo": "*"
2425
},
2526
"require-dev": {
2627
"phpunit/phpunit": "^9",

Diff for: src/Vectorface/MySQLite/MySQL/StringFunctions.php

+8
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,12 @@ public static function mysql_format()
5050
$decimals = isset($args[1]) ? $args[1] : 0;
5151
return number_format($number, $decimals);
5252
}
53+
54+
/**
55+
* Get the soundex value of a given string
56+
*/
57+
public static function mysql_soundex(string $str): string
58+
{
59+
return soundex($str);
60+
}
5361
}

Diff for: tests/Vectorface/Tests/MySQLite/MySQLiteTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,9 @@ public function testFormat()
169169
$test = MySQLite::mysql_format("12.232", 1);
170170
$this->assertEquals($expected, $test);
171171
}
172+
173+
public function testSoundex()
174+
{
175+
$this->assertEquals("F000", MySQLite::mysql_soundex("foo"));
176+
}
172177
}

0 commit comments

Comments
 (0)