summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/sql/src/Expression.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ipl/sql/src/Expression.php')
-rw-r--r--vendor/ipl/sql/src/Expression.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/ipl/sql/src/Expression.php b/vendor/ipl/sql/src/Expression.php
new file mode 100644
index 0000000..cd508ac
--- /dev/null
+++ b/vendor/ipl/sql/src/Expression.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace ipl\Sql;
+
+/**
+ * A database expression that does need quoting or escaping, e.g. new Expression('NOW()');
+ */
+class Expression implements ExpressionInterface
+{
+ /** @var string The statement of the expression */
+ protected $statement;
+
+ /** @var array The columns used by the expression */
+ protected $columns;
+
+ /** @var array The values for the expression */
+ protected $values;
+
+ /**
+ * Create a new database expression
+ *
+ * @param string $statement The statement of the expression
+ * @param array $columns The columns used by the expression
+ * @param mixed ...$values The values for the expression
+ */
+ public function __construct($statement, array $columns = null, ...$values)
+ {
+ $this->statement = $statement;
+ $this->columns = $columns;
+ $this->values = $values;
+ }
+
+ public function getStatement()
+ {
+ return $this->statement;
+ }
+
+ public function getColumns()
+ {
+ return $this->columns ?: [];
+ }
+
+ public function setColumns(array $columns)
+ {
+ $this->columns = $columns;
+ }
+
+ public function getValues()
+ {
+ return $this->values;
+ }
+}