Completed
Push — master ( efd012...704f4c )
by P.R.
03:36
created

MySqlAlterTableCodeStore   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A indentationMode() 0 18 4
1
<?php
2
3
namespace SetBased\Audit\MySql\Helper;
4
5
use SetBased\Helper\CodeStore\CodeStore;
6
7
/**
8
 * A helper class for automatically generating MySQL alter table syntax code with proper indentation.
9
 */
10
class MySqlAlterTableCodeStore extends CodeStore
11
{
12
  //--------------------------------------------------------------------------------------------------------------------
13
  /**
14
   * @inheritdoc
15
   */
16 8
  protected function indentationMode($line)
17
  {
18 8
    $mode = 0;
19
20 8
    $line = trim($line);
21
22 8
    if (substr($line, 0, 11)=='alter table' && substr($line, -1)<>';')
23
    {
24 5
      $mode |= self::C_INDENT_INCREMENT_AFTER;
25
    }
26
27 8
    if (substr($line, 0, 1)==';')
28
    {
29 5
      $mode |= self::C_INDENT_DECREMENT_BEFORE;
30
    }
31
32 8
    return $mode;
33
  }
34
35
  //--------------------------------------------------------------------------------------------------------------------
36
}
37
38
//----------------------------------------------------------------------------------------------------------------------
39