Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
IsNull
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 render
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Db\Sql\Predicate;
16
17use Pop\Db\Sql\AbstractSql;
18
19/**
20 * Is Null predicate class
21 *
22 * @category   Pop
23 * @package    Pop\Db
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    7.0.0
28 */
29class IsNull extends AbstractPredicate
30{
31
32    /**
33     * Constructor
34     *
35     * Instantiate the IS NULL predicate set object
36     *
37     * @param  string $values
38     * @param  string $conjunction
39     * @throws Exception
40     */
41    public function __construct(string $values, string $conjunction = 'AND')
42    {
43        $this->format = '%1 IS NULL';
44        parent::__construct($values, $conjunction);
45    }
46
47    /**
48     * Render the predicate string
49     *
50     *
51     * @param  AbstractSql $sql
52     * @return string
53     */
54    public function render(AbstractSql $sql): string
55    {
56        return '(' . str_replace('%1', $sql->quoteId($this->values), $this->format) . ')';
57    }
58
59}