Completed
Pull Request — master (#59)
by Dima
03:22
created

MySqlAlterTableCodeStore   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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 1
  protected function indentationMode($line)
18
  {
19 1
    $mode = 0;
20
21 1
    $line = trim($line);
22
23 1
    if (substr($line, -6, 6)=='CHANGE')
24 1
    {
25 1
      $mode |= self::C_INDENT_INCREMENT_AFTER;
26 1
    }
27
28 1
    if (substr($line, 0, 1)==';')
29 1
    {
30 1
      $mode |= self::C_INDENT_DECREMENT_BEFORE;
31 1
    }
32
33 1
    return $mode;
34
  }
35
36
  //--------------------------------------------------------------------------------------------------------------------
37
}
38
39
//----------------------------------------------------------------------------------------------------------------------
40