Completed
Push — master ( 8e94f8...744b49 )
by P.R.
04:26
created

TableMetadata   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
c 4
b 0
f 0
lcom 0
cbo 1
dl 0
loc 74
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getColumns() 0 4 1
A getSchemaName() 0 4 1
A getTableName() 0 4 1
1
<?php
2
//----------------------------------------------------------------------------------------------------------------------
3
namespace SetBased\Audit\MySql\Metadata;
4
5
//--------------------------------------------------------------------------------------------------------------------
6
/**
7
 * Class for the metadata of a database table.
8
 */
9
class TableMetadata
10
{
11
  //--------------------------------------------------------------------------------------------------------------------
12
  /**
13
   * The metadata of the columns of this table.
14
   *
15
   * @var TableColumnsMetadata.
16
   */
17
  private $columns;
18
19
  /**
20
   * The name of the schema were the table is located.
21
   *
22
   * @var string
23
   */
24
  private $schemaName;
25
26
  /**
27
   * The name of this table.
28
   *
29
   * @var string
30
   */
31
  private $tableName;
32
33
  //--------------------------------------------------------------------------------------------------------------------
34
  /**
35
   * Object constructor.
36
   *
37
   * @param string  $tableName  The table name.
38
   * @param string  $schemaName The name of the schema were the table is located.
39
   * @param array[] $columns    The metadata of the columns of this table.
40
   */
41 8
  public function __construct($tableName, $schemaName, $columns)
42
  {
43 8
    $this->tableName  = $tableName;
44 8
    $this->columns    = new TableColumnsMetadata($columns);
0 ignored issues
show
Documentation introduced by
$columns is of type array<integer,array>, but the function expects a array<integer,object<array>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45 8
    $this->schemaName = $schemaName;
46 8
  }
47
48
  //--------------------------------------------------------------------------------------------------------------------
49
  /**
50
   * Returns table columns.
51
   *
52
   * @return TableColumnsMetadata
53
   */
54 8
  public function getColumns()
55
  {
56 8
    return $this->columns;
57
  }
58
59
  //--------------------------------------------------------------------------------------------------------------------
60
  /**
61
   * Returns the name of schema.
62
   *
63
   * @return string
64
   */
65 8
  public function getSchemaName()
66
  {
67 8
    return $this->schemaName;
68
  }
69
70
  //--------------------------------------------------------------------------------------------------------------------
71
  /**
72
   * Returns the name of this table.
73
   *
74
   * @return string
75
   */
76 8
  public function getTableName()
77
  {
78 8
    return $this->tableName;
79
  }
80
81
  //--------------------------------------------------------------------------------------------------------------------
82
}
83
84
//----------------------------------------------------------------------------------------------------------------------
85