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

AlterTableCodeStore   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A indentationMode() 0 17 4
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