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

MySqlAlterTableCodeStore::indentationMode()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
ccs 12
cts 12
cp 1
rs 9.4285
cc 3
eloc 8
nc 4
nop 1
crap 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