TableWrapper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 49
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 generateMethodBodyWithoutLob() 0 7 1
A generateMethodBodyWithLobFetchData() 0 2 1
A generateMethodBodyWithLobReturnData() 0 2 1
A getReturnTypeDeclaration() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SetBased\Stratum\MySql\Wrapper;
5
6
use SetBased\Stratum\Common\Wrapper\Helper\WrapperContext;
7
use SetBased\Stratum\MySql\Exception\MySqlDataLayerException;
8
9
/**
10
 * Class for generating a wrapper method for a stored procedure of which the selected rows must be echoed in a table
11
 * layout.
12
 */
13
class TableWrapper extends MysqlWrapper
14
{
15
  //--------------------------------------------------------------------------------------------------------------------
16
  /**
17
   * @inheritdoc
18 1
   */
19
  protected function generateMethodBodyWithLobFetchData(WrapperContext $context): void
20 1
  {
21
    // Nothing to do.
22
  }
23
24
  //--------------------------------------------------------------------------------------------------------------------
25
  /**
26
   * @inheritdoc
27 1
   */
28
  protected function generateMethodBodyWithLobReturnData(WrapperContext $context): void
29 1
  {
30
    // Nothing to do.
31
  }
32
33
  //--------------------------------------------------------------------------------------------------------------------
34
  /**
35
   * @inheritdoc
36 1
   */
37
  protected function generateMethodBodyWithoutLob(WrapperContext $context): void
38 1
  {
39
    $this->throws(MySqlDataLayerException::class);
40 1
41 1
    $context->codeStore->append(sprintf("return \$this->executeTable('call %s(%s)');",
42
                                        $context->phpStratumMetadata['routine_name'],
43
                                        $this->getRoutineArgs($context)));
44
  }
45
46
  //--------------------------------------------------------------------------------------------------------------------
47
  /**
48
   * @inheritdoc
49
   */
50
  protected function getDocBlockReturnType(WrapperContext $context): string
51
  {
52
    return 'int';
53
  }
54
55
  //--------------------------------------------------------------------------------------------------------------------
56
  /**
57
   * @inheritdoc
58
   */
59
  protected function getReturnTypeDeclaration(WrapperContext $context): string
60
  {
61
    return ': int';
62
  }
63
64
  //--------------------------------------------------------------------------------------------------------------------
65
}
66
67
//----------------------------------------------------------------------------------------------------------------------
68