summaryrefslogtreecommitdiff
path: root/vendor/fguillot/picodb/lib/PicoDb/Builder/OrConditionBuilder.php
blob: 0defeaf47dd0ece53b359ed07af5ca94c81a978f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace PicoDb\Builder;

/**
 * Class OrConditionBuilder
 *
 * @package PicoDb\Builder
 * @author  Frederic Guillot
 */
class OrConditionBuilder
{
    /**
     * List of SQL conditions
     *
     * @access protected
     * @var string[]
     */
    protected $conditions = array();

    /**
     * Add new condition
     *
     * @access public
     * @param  string $condition
     * @return $this
     */
    public function withCondition($condition) {
        $this->conditions[] = $condition;
        return $this;
    }

    /**
     * Build SQL
     *
     * @access public
     * @return string
     */
    public function build()
    {
        return '('.implode(' OR ', $this->conditions).')';
    }
}