NoneWrapper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 50
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A generateMethodBodyWithLobFetchData() 0 4 1
A getDocBlockReturnType() 0 3 1
A generateMethodBodyWithoutLob() 0 7 1
A getReturnTypeDeclaration() 0 3 1
A generateMethodBodyWithLobReturnData() 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\MySqlQueryErrorException;
8
9
/**
10
 * Class for generating a wrapper method for a stored procedure without result set.
11
 */
12
class NoneWrapper extends MysqlWrapper
13
{
14
  //--------------------------------------------------------------------------------------------------------------------
15
  /**
16
   * @inheritdoc
17 1
   */
18
  protected function generateMethodBodyWithLobFetchData(WrapperContext $context): void
19 1
  {
20
    $context->codeStore->append('$ret = $this->mysqli->affected_rows;');
21
    $context->codeStore->append('');
22
  }
23
24
  //--------------------------------------------------------------------------------------------------------------------
25
  /**
26 1
   * @inheritdoc
27
   */
28 1
  protected function generateMethodBodyWithLobReturnData(WrapperContext $context): void
29
  {
30
    $context->codeStore->append('return $ret;');
31
  }
32
33
  //--------------------------------------------------------------------------------------------------------------------
34
  /**
35 1
   * @inheritdoc
36
   */
37 1
  protected function generateMethodBodyWithoutLob(WrapperContext $context): void
38
  {
39 1
    $this->throws(MySqlQueryErrorException::class);
40 1
41
    $context->codeStore->append(sprintf("return \$this->executeNone('call %s(%s)');",
42
                                        $context->phpStratumMetadata['routine_name'],
43
                                        $this->getRoutineArgs($context)));
44
  }
45
46
  //--------------------------------------------------------------------------------------------------------------------
47 1
  /**
48
   * @inheritdoc
49 1
   */
50 1
  protected function getDocBlockReturnType(WrapperContext $context): string
51
  {
52
    return 'int';
53
  }
54
55
  //--------------------------------------------------------------------------------------------------------------------
56
  /**
57 1
   * @inheritdoc
58
   */
59 1
  protected function getReturnTypeDeclaration(WrapperContext $context): string
60
  {
61
    return ': int';
62
  }
63
64
  //--------------------------------------------------------------------------------------------------------------------
65
}
66
67
//----------------------------------------------------------------------------------------------------------------------
68