2018-11-05 22:30:18 +00:00
|
|
|
<?php
|
2019-05-28 17:59:38 +01:00
|
|
|
class Querylet
|
|
|
|
{
|
|
|
|
/** @var string */
|
|
|
|
public $sql;
|
|
|
|
/** @var array */
|
|
|
|
public $variables;
|
|
|
|
|
|
|
|
public function __construct(string $sql, array $variables=[])
|
|
|
|
{
|
|
|
|
$this->sql = $sql;
|
|
|
|
$this->variables = $variables;
|
|
|
|
}
|
|
|
|
|
2019-05-29 18:23:29 +01:00
|
|
|
public function append(Querylet $querylet): void
|
2019-05-28 17:59:38 +01:00
|
|
|
{
|
|
|
|
$this->sql .= $querylet->sql;
|
|
|
|
$this->variables = array_merge($this->variables, $querylet->variables);
|
|
|
|
}
|
|
|
|
|
2019-05-29 18:23:29 +01:00
|
|
|
public function append_sql(string $sql): void
|
2019-05-28 17:59:38 +01:00
|
|
|
{
|
|
|
|
$this->sql .= $sql;
|
|
|
|
}
|
|
|
|
|
2019-05-29 18:23:29 +01:00
|
|
|
public function add_variable($var): void
|
2019-05-28 17:59:38 +01:00
|
|
|
{
|
|
|
|
$this->variables[] = $var;
|
|
|
|
}
|
2018-11-05 22:30:18 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
class TagQuerylet
|
|
|
|
{
|
|
|
|
/** @var string */
|
|
|
|
public $tag;
|
|
|
|
/** @var bool */
|
|
|
|
public $positive;
|
|
|
|
|
|
|
|
public function __construct(string $tag, bool $positive)
|
|
|
|
{
|
|
|
|
$this->tag = $tag;
|
|
|
|
$this->positive = $positive;
|
|
|
|
}
|
2018-11-05 22:30:18 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
class ImgQuerylet
|
|
|
|
{
|
2019-05-28 20:27:23 +01:00
|
|
|
/** @var Querylet */
|
2019-05-28 17:59:38 +01:00
|
|
|
public $qlet;
|
|
|
|
/** @var bool */
|
|
|
|
public $positive;
|
|
|
|
|
|
|
|
public function __construct(Querylet $qlet, bool $positive)
|
|
|
|
{
|
|
|
|
$this->qlet = $qlet;
|
|
|
|
$this->positive = $positive;
|
|
|
|
}
|
2018-11-05 22:30:18 +00:00
|
|
|
}
|