These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | class ORAField implements Field { |
||
3 | private $name, $tablename, $default, $max_length, $nullable, |
||
0 ignored issues
–
show
|
|||
4 | $is_pk, $is_unique, $is_multiple, $is_key, $type; |
||
5 | |||
6 | function __construct( $info ) { |
||
7 | $this->name = $info['column_name']; |
||
8 | $this->tablename = $info['table_name']; |
||
9 | $this->default = $info['data_default']; |
||
10 | $this->max_length = $info['data_length']; |
||
11 | $this->nullable = $info['not_null']; |
||
12 | $this->is_pk = isset( $info['prim'] ) && $info['prim'] == 1 ? 1 : 0; |
||
13 | $this->is_unique = isset( $info['uniq'] ) && $info['uniq'] == 1 ? 1 : 0; |
||
14 | $this->is_multiple = isset( $info['nonuniq'] ) && $info['nonuniq'] == 1 ? 1 : 0; |
||
15 | $this->is_key = ( $this->is_pk || $this->is_unique || $this->is_multiple ); |
||
16 | $this->type = $info['data_type']; |
||
17 | } |
||
18 | |||
19 | function name() { |
||
20 | return $this->name; |
||
21 | } |
||
22 | |||
23 | function tableName() { |
||
24 | return $this->tablename; |
||
25 | } |
||
26 | |||
27 | function defaultValue() { |
||
28 | return $this->default; |
||
29 | } |
||
30 | |||
31 | function maxLength() { |
||
32 | return $this->max_length; |
||
33 | } |
||
34 | |||
35 | function isNullable() { |
||
36 | return $this->nullable; |
||
37 | } |
||
38 | |||
39 | function isKey() { |
||
40 | return $this->is_key; |
||
41 | } |
||
42 | |||
43 | function isMultipleKey() { |
||
44 | return $this->is_multiple; |
||
45 | } |
||
46 | |||
47 | function type() { |
||
48 | return $this->type; |
||
49 | } |
||
50 | } |
||
51 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.