| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | final class ExecuteRequest implements Request |
||
| 20 | { |
||
| 21 | /** @var non-empty-array<int, int|string|array> */ |
||
|
|
|||
| 22 | private $body; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param non-empty-array<int, int|string|array> $body |
||
| 26 | */ |
||
| 27 | 73 | private function __construct($body) |
|
| 28 | { |
||
| 29 | 73 | $this->body = $body; |
|
| 30 | } |
||
| 31 | |||
| 32 | 65 | public static function fromSql(string $sql, array $params = []) : self |
|
| 33 | { |
||
| 34 | 65 | return new self($params ? [ |
|
| 35 | 65 | Keys::SQL_TEXT => $sql, |
|
| 36 | 65 | Keys::SQL_BIND => $params, |
|
| 37 | 65 | ] : [ |
|
| 38 | 65 | Keys::SQL_TEXT => $sql, |
|
| 39 | 65 | ]); |
|
| 40 | } |
||
| 41 | |||
| 42 | 12 | public static function fromStatementId(int $statementId, array $params = []) : self |
|
| 43 | { |
||
| 44 | 12 | return new self($params ? [ |
|
| 45 | 12 | Keys::STMT_ID => $statementId, |
|
| 46 | 12 | Keys::SQL_BIND => $params, |
|
| 47 | 12 | ] : [ |
|
| 48 | 12 | Keys::STMT_ID => $statementId, |
|
| 49 | 12 | ]); |
|
| 50 | } |
||
| 51 | |||
| 52 | 73 | public function getType() : int |
|
| 55 | } |
||
| 56 | |||
| 57 | 73 | public function getBody() : array |
|
| 60 | } |
||
| 61 | } |
||
| 62 |