Files

30 lines
595 B
PHP
Raw Permalink Normal View History

2022-01-09 03:49:51 +08:00
<?php
declare(strict_types=1);
namespace Database\Condition;
/**
* Class HashCondition
* @package Yoc\db\condition
*/
class HashCondition extends Condition
{
2023-12-12 15:35:35 +08:00
/**
* @return string
* @throws
*/
public function builder(): string
{
$array = [];
if (count($this->value) < 1) {
throw new \Exception('Builder data by a empty array.');
}
foreach ($this->value as $key => $value) {
$array[] = $key . '=' . addslashes($value);
}
return implode(' AND ', $array);
}
2022-01-09 03:49:51 +08:00
}