SqlParser\Components\OrderKeyword::build PHP Method

build() public static method

public static build ( OrderKeyword | OrderKeyword[] $component, array $options = [] ) : string
$component OrderKeyword | OrderKeyword[] The component to be built.
$options array Parameters for building.
return string
    public static function build($component, array $options = array())
    {
        if (is_array($component)) {
            return implode(', ', $component);
        } else {
            return $component->expr . ' ' . $component->type;
        }
    }

Usage Example

Ejemplo n.º 1
0
 public function testBuild()
 {
     $this->assertEquals(OrderKeyword::build(array(new OrderKeyword(new Expression('a'), 'ASC'), new OrderKeyword(new Expression('b'), 'DESC'))), 'a ASC, b DESC');
 }