Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
SQLiteField
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 6
72
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 name
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 tableName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 defaultValue
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
12
 isNullable
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 type
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Wikimedia\Rdbms;
4
5use stdClass;
6
7class SQLiteField implements Field {
8    private stdClass $info;
9    private string $tableName;
10
11    public function __construct( stdClass $info, string $tableName ) {
12        $this->info = $info;
13        $this->tableName = $tableName;
14    }
15
16    public function name() {
17        return $this->info->name;
18    }
19
20    public function tableName() {
21        return $this->tableName;
22    }
23
24    public function defaultValue() {
25        if ( is_string( $this->info->dflt_value ) ) {
26            // Typically quoted
27            if ( preg_match( '/^\'(.*)\'$/', $this->info->dflt_value, $matches ) ) {
28                return str_replace( "''", "'", $matches[1] );
29            }
30        }
31
32        return $this->info->dflt_value;
33    }
34
35    /**
36     * @return bool
37     */
38    public function isNullable() {
39        return !$this->info->notnull;
40    }
41
42    public function type() {
43        return $this->info->type;
44    }
45}