Skip to content

Commit e56a752

Browse files
committed
update documentation to php-sap/common:2.0
1 parent cd629c2 commit e56a752

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

Diff for: abstract-rfc.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ The class `ZGetWeek` contains only code, that configures the API of your SAP
88

99
* `getName()` returns the SAP remote function name.
1010
* `setDate()` sets the SAP remote function parameter.
11-
* `getReturnTypecast()` casts the result of the SAP remote function call to a
11+
* `invoke()` casts the result of the SAP remote function call to a
1212
DateTime object.
1313

1414
```php
1515
<?php
1616

1717
use phpsap\saprfc\AbstractRemoteFunctionCall;
18-
use kbATeam\TypeCast\TypeCastValue;
1918
use phpsap\DateTime\SapDateTime;
2019

2120
/**
@@ -46,14 +45,19 @@ class ZGetWeek extends AbstractRemoteFunctionCall
4645
}
4746

4847
/**
49-
* Define typecasting for SAP remote function return value.
50-
* @return \kbATeam\TypeCast\TypeCastValue
48+
* Call SAP remote function to get the week of the given date.
49+
* @param null|array $params Optional parameter array.
50+
* @return phpsap\DateTime\SapDateTime The calendar week of the given date.
51+
* @throws \phpsap\interfaces\exceptions\IConnectionFailedException
52+
* @throws \phpsap\interfaces\exceptions\IUnknownFunctionException
53+
* @throws \phpsap\exceptions\FunctionCallException
5154
*/
52-
protected function getReturnTypecast()
55+
protected function invoke($params = null)
5356
{
54-
return new TypeCastValue(function ($result) {
55-
return SapDateTime::createFromFormat(SapDateTime::SAP_WEEK, $result['E_WEEK']);
56-
});
57+
//parent returns array
58+
$result = parent::invoke($params);
59+
//return SapDateTime object
60+
return SapDateTime::createFromFormat(SapDateTime::SAP_WEEK, $result['E_WEEK']);
5761
}
5862
}
5963
```

Diff for: motivation.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ $result = $function->invoke(['paramName' => 'value']);
5050
<?php
5151

5252
use phpsap\saprfc\AbstractRemoteFunctionCall;
53-
use kbATeam\TypeCast\TypeCastValue;
5453

5554
class MyCoolSapRemoteFunction extends AbstractRemoteFunctionCall
5655
{
@@ -77,14 +76,18 @@ class MyCoolSapRemoteFunction extends AbstractRemoteFunctionCall
7776
}
7877

7978
/**
80-
* Define typecasting for SAP remote function return value.
81-
* @return \kbATeam\TypeCast\TypeCastValue
79+
* Call SAP remote function to see, if paramA succeeds.
80+
* @param null|array $params Optional parameter array.
81+
* @return bool success?
82+
* @throws \phpsap\interfaces\exceptions\IConnectionFailedException
83+
* @throws \phpsap\interfaces\exceptions\IUnknownFunctionException
84+
* @throws \phpsap\exceptions\FunctionCallException
8285
*/
83-
protected function getReturnTypecast()
86+
protected function invoke($params = null)
8487
{
85-
return new TypeCastValue(function ($res) {
86-
return $res['E_OK'] !== 'X';
87-
});
88+
//parent returns array
89+
$result = parent::invoke($params);
90+
return $result['E_OK'] !== 'X';
8891
}
8992
}
9093
```

0 commit comments

Comments
 (0)