@@ -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
1717use phpsap\saprfc\AbstractRemoteFunctionCall;
18- use kbATeam\TypeCast\TypeCastValue;
1918use 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```
0 commit comments