flux-querybuilder/src/Functions/First.php

24 lines
408 B
PHP
Raw Normal View History

<?php
2024-03-30 16:44:38 +01:00
namespace Hosterra\FluxBuilder\Functions;
2024-03-30 16:44:38 +01:00
use Hosterra\FluxBuilder\Type;
2024-03-30 16:44:38 +01:00
class First extends Base {
/**
* @var string|null $column
*/
private $column;
2024-03-30 16:44:38 +01:00
public function __construct( ?string $column = null ) {
$this->column = $column;
}
2024-03-30 16:44:38 +01:00
public function __toString() {
$params = new Type( array_filter( [
'column' => $this->column
] ) );
2024-03-30 16:44:38 +01:00
return '|> first(' . $params . ') ';
}
}