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

MySqlAlterTableCodeStore::indentationMode()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

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