2022-01-09 03:49:51 +08:00
|
|
|
<?php
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Database\Condition;
|
|
|
|
|
|
|
|
|
|
use JetBrains\PhpStorm\Pure;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class InCondition
|
|
|
|
|
* @package Database\Condition
|
|
|
|
|
*/
|
|
|
|
|
class InCondition extends Condition
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2023-12-12 15:35:35 +08:00
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @throws
|
|
|
|
|
*/
|
|
|
|
|
#[Pure] public function builder(): string
|
|
|
|
|
{
|
|
|
|
|
if (is_array($this->value)) {
|
|
|
|
|
return $this->column . ' IN (' . implode(',', $this->value) . ')';
|
|
|
|
|
} else {
|
|
|
|
|
return $this->column . ' IN (' . $this->value . ')';
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-09 03:49:51 +08:00
|
|
|
|
|
|
|
|
}
|