Passed
Push — master ( 151185...42f330 )
by P.R.
04:09
created

LogWrapper   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 47
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDocBlockReturnType() 0 3 1
A getReturnTypeDeclaration() 0 3 1
A writeResultHandler() 0 6 1
A writeRoutineFunctionLobReturnData() 0 2 1
A writeRoutineFunctionLobFetchData() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SetBased\Stratum\MySql\Wrapper;
5
6
use SetBased\Stratum\MySql\Exception\MySqlDataLayerException;
7
8
/**
9
 * Class for generating a wrapper method for a stored procedure 'selecting' rows for logging.
10
 */
11
class LogWrapper extends Wrapper
12
{
13
  //--------------------------------------------------------------------------------------------------------------------
14
  /**
15
   * @inheritdoc
16
   */
17 1
  protected function getDocBlockReturnType(): string
18
  {
19 1
    return 'int';
20
  }
21
22
  //--------------------------------------------------------------------------------------------------------------------
23
  /**
24
   * @inheritdoc
25
   */
26 1
  protected function getReturnTypeDeclaration(): string
27
  {
28 1
    return ': int';
29
  }
30
31
  //--------------------------------------------------------------------------------------------------------------------
32
  /**
33
   * @inheritdoc
34
   */
35 1
  protected function writeResultHandler(): void
36
  {
37 1
    $this->throws(MySqlDataLayerException::class);
38
39 1
    $routineArgs = $this->getRoutineArgs();
40 1
    $this->codeStore->append('return $this->executeLog(\'call '.$this->routine['routine_name'].'('.$routineArgs.')\');');
41
  }
42
43
  //--------------------------------------------------------------------------------------------------------------------
44
  /**
45
   * @inheritdoc
46
   */
47
  protected function writeRoutineFunctionLobFetchData(): void
48
  {
49
    // Nothing to do.
50
  }
51
52
  //--------------------------------------------------------------------------------------------------------------------
53
  /**
54
   * @inheritdoc
55
   */
56
  protected function writeRoutineFunctionLobReturnData(): void
57
  {
58
    // Nothing to do.
59
  }
60
61
  //--------------------------------------------------------------------------------------------------------------------
62
}
63
64
//----------------------------------------------------------------------------------------------------------------------
65