Test Failed
Push — master ( d02081...898276 )
by P.R.
04:01
created

AlterTableCodeStore::indentationMode()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 4
nop 1
dl 0
loc 17
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace SetBased\Audit\MySql;
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 AlterTableCodeStore extends CodeStore
11
{
12
  //--------------------------------------------------------------------------------------------------------------------
13
  /**
14
   * @inheritdoc
15
   */
16
  protected function indentationMode($line)
17
  {
18
    $mode = 0;
19
20
    $line = trim($line);
21
22
    if (substr($line, 0, 11)=='alter table' && substr($line, -1)<>';')
23
    {
24
      $mode |= self::C_INDENT_INCREMENT_AFTER;
25
    }
26
27
    if (substr($line, 0, 1)==';')
28
    {
29
      $mode |= self::C_INDENT_DECREMENT_BEFORE;
30
    }
31
32
    return $mode;
33
  }
34
35
  //--------------------------------------------------------------------------------------------------------------------
36
}
37
38
//----------------------------------------------------------------------------------------------------------------------
39