for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Helix\DB\SQL;
/**
* Represents a text expression. Produces various transformations.
*/
class Text extends Scalar {
use TextTrait;
* Casts the expression to a floating point number.
*
* @return Numeric
public function toFloat () {
if ($this->db->getDriver() === 'sqlite') {
return new Numeric($this->db, "CAST({$this} AS REAL)");
}
return new Numeric($this->db, "({$this} + 0)");
* Casts the expression to a signed integer.
public function toInt () {
return new Numeric($this->db, "CAST({$this} AS INTEGER)");
return new Numeric($this->db, "CAST({$this} AS SIGNED)");