Completed
Pull Request — master (#57)
by Dima
02:53
created

MySqlAlterTableCodeStore   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 27
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 0

1 Method

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