Skip to content

Commit 7bed858

Browse files
committed
Split IArray into IStruct and ITable in order to be able to differentiate them later.
1 parent 11f476c commit 7bed858

File tree

6 files changed

+51
-16
lines changed

6 files changed

+51
-16
lines changed

src/Api/IApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getOutputValues();
3838

3939
/**
4040
* Get all tables of the remote function.
41-
* @return \phpsap\interfaces\Api\IArray[]
41+
* @return \phpsap\interfaces\Api\ITable[]
4242
*/
4343
public function getTables();
4444
}

src/Api/IArray.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,27 @@
55
/**
66
* Interface IArray
77
*
8-
* API extend the logic of values but contain member elements.
8+
* API extend the logic of values to contain member elements.
99
*
1010
* @package phpsap\interfaces\Api
1111
* @author Gregor J.
1212
* @license MIT
1313
*/
1414
interface IArray extends IValue
1515
{
16-
/**
17-
* API table element.
18-
*/
19-
const DIRECTION_TABLE = 'table';
20-
21-
/**
22-
* API element that casts to PHP array.
23-
*/
24-
const TYPE_ARRAY = 'array';
25-
2616
/**
2717
* JSON configuration key for members array.
2818
*/
2919
const JSON_MEMBERS = 'members';
3020

3121
/**
3222
* Cast a given output value to the implemented value.
33-
* @param array $struct The output array to typecast.
23+
* @param array $value The output array to typecast.
3424
* @return array
3525
* @throws \phpsap\interfaces\exceptions\IArrayElementMissingException
3626
* @throws \phpsap\interfaces\exceptions\IInvalidArgumentException
3727
*/
38-
public function cast($struct);
28+
public function cast($value);
3929

4030
/**
4131
* Return an array of member elements.

src/Api/IElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getName();
8787
/**
8888
* Cast a given output value to the implemented value.
8989
* @param bool|int|float|string $value The output to typecast.
90-
* @return bool|int|float|string|\phpsap\DateTime\SapDateTime
90+
* @return bool|int|float|string|\phpsap\DateTime\SapDateTime|\phpsap\DateTime\SapDateInterval
9191
* @throws \phpsap\interfaces\exceptions\IInvalidArgumentException
9292
*/
9393
public function cast($value);

src/Api/IStruct.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace phpsap\interfaces\Api;
4+
5+
/**
6+
* Interface IStruct
7+
*
8+
* API extend the logic of arrays to contain member elements.
9+
*
10+
* @package phpsap\interfaces\Api
11+
* @author Gregor J.
12+
* @license MIT
13+
*/
14+
interface IStruct extends IArray
15+
{
16+
/**
17+
* API element that casts to an associative array in PHP.
18+
*/
19+
const TYPE_STRUCT = 'struct';
20+
}

src/Api/ITable.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace phpsap\interfaces\Api;
4+
5+
/**
6+
* Interface ITable
7+
*
8+
* API extend the logic of arrays but contains rows of member elements.
9+
*
10+
* @package phpsap\interfaces\Api
11+
* @author Gregor J.
12+
* @license MIT
13+
*/
14+
interface ITable extends IArray
15+
{
16+
/**
17+
* API table element.
18+
*/
19+
const DIRECTION_TABLE = 'table';
20+
21+
/**
22+
* API element that casts to a PHP array of associative arrays.
23+
*/
24+
const TYPE_TABLE = 'table';
25+
}

src/exceptions/IArrayElementMissingException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Interface IArrayElementMissingException
77
*
8-
* A table element required by the API is not in the table.
8+
* A table/struct element required by the API is not in the table/struct.
99
*
1010
* @package phpsap\interfaces\exceptions
1111
* @author Gregor J.

0 commit comments

Comments
 (0)