Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active February 20, 2025 22:31
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
<?
private function addTerms(string $SQLselect) {
$selectSentence = $this->createSqlWhere();
// INJECTED CODE
$simplifiedTerms =
(new LikePatternSimplifier())->simplify($this->texts());
// INJECTED CODE
foreach ($simplifiedTerms as $text) {
$selectSentence->addWhere(
$this->tableAlias() .
" LIKE '%" .
$this->sanitize($text) .
"%'");
}
$SQLselect->addWhere($selectSentence->asSQLSentence());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment