Skip to content

V2 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Feb 3, 2020
Merged

V2 #1

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ad892a6
introduce new functions to retrieve formerly set parameters and remov…
gregor-j Oct 14, 2019
ccc9310
introduce possibility to descript the remote function API
gregor-j Oct 14, 2019
0047d12
add constants and move value interface to common element interface
gregor-j Oct 15, 2019
346f906
new API element hierarchy: value-element-array
gregor-j Oct 15, 2019
d576b9a
Rename Interfaces and add comments for better understanding
gregor-j Oct 15, 2019
3041d10
Add exception for missing table elements
gregor-j Oct 15, 2019
a30d469
rename table element missing exception to array
gregor-j Oct 15, 2019
755f95a
add API interface and make API JSON serializeable
gregor-j Oct 15, 2019
4517ac0
add methods for adding API elements, values and arrays.
gregor-j Oct 15, 2019
65f9fde
move IArray specific constants from IElement and IValue
gregor-j Oct 16, 2019
fcadcd1
combine all add() methods of the api interface
gregor-j Oct 16, 2019
18e13a3
add json decode static functions
gregor-j Oct 16, 2019
a5df652
add json configuration keys
gregor-j Oct 16, 2019
a1ebdfc
update comments of API specific methods.
gregor-j Oct 29, 2019
aaac4a6
add data types hex-bin and DateTime
gregor-j Oct 30, 2019
5628ba7
split DateTime data type into date and time.
gregor-j Oct 30, 2019
cae22fe
split hexbin to hex2bin and bin2hex for input and output directions
gregor-j Oct 30, 2019
ef0264b
add virtual timestamp and week data types
gregor-j Oct 30, 2019
6fe8ef3
update comments
gregor-j Oct 30, 2019
c885680
rename const hex2bin to hexbin
gregor-j Oct 30, 2019
8234577
fix typo
gregor-j Nov 13, 2019
1eb07c7
refactor configuration interfaces
gregor-j Nov 13, 2019
16331f9
refactor connection interface
gregor-j Nov 13, 2019
14de0e3
add JSON serialization of functions
gregor-j Nov 28, 2019
fbbb5d1
add missing exceptions, reduce jsonDecode to string, update comments
gregor-j Nov 28, 2019
8e92645
unify comments
gregor-j Nov 28, 2019
87313e3
fix error in comment
gregor-j Nov 28, 2019
05f3a4f
overwrite cast() method for arrays
gregor-j Nov 28, 2019
665c43f
remove IConfiguration::getValidConfigKeys()
gregor-j Dec 2, 2019
356be27
add JsonSerializable interface
gregor-j Dec 3, 2019
281381b
Make all classes children of IJsonSerializable
gregor-j Dec 3, 2019
0d0b9da
make IFunction \JsonSerializable
gregor-j Dec 3, 2019
7bc5e3a
remove addMember() from Api\IArray
gregor-j Dec 3, 2019
ee5ff61
remove connection class and adapt function class for configuration
gregor-j Dec 6, 2019
e6ce98a
rename retrieveApi() to extractApi()
gregor-j Dec 6, 2019
5143f6a
fix line length
gregor-j Dec 6, 2019
2b75e1a
rename reset() to resetParams() and add missing exceptions
gregor-j Dec 9, 2019
a50bc2c
update comments
gregor-j Dec 9, 2019
46e1f22
remove typecasting from IApi
gregor-j Dec 16, 2019
e907a6b
Change default return of get*() in config class to null except for ma…
gregor-j Dec 17, 2019
85c1ad3
change order of methods and constants to reflect mandatory and option…
gregor-j Dec 17, 2019
5b4655d
unify PHPdoc of methods
gregor-j Dec 17, 2019
d04c513
unify PHPdoc of methods
gregor-j Dec 17, 2019
bc06434
remove setParam() method and add the missing exceptions
gregor-j Jan 13, 2020
a982e46
fix typos and comments
gregor-j Feb 3, 2020
07468f6
fix typos and comments
gregor-j Feb 3, 2020
4b82311
fix typos and comments
gregor-j Feb 3, 2020
88c8790
update readme to v2
gregor-j Feb 3, 2020
b78011a
set PHP versions
gregor-j Feb 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@

This repository defines interfaces for implementing the [PHP/SAP][phpsap] API.

[See PHP/SAP Interfaces for documentation][doc]

[phpsap]: https://php-sap.github.io
[license-mit]: https://img.shields.io/badge/license-MIT-blue.svg
[doc]: https://php-sap.github.io/interfaces "Interfaces | PHP/SAP"
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
}
],
"homepage": "https://php-sap.github.io",
"support": {
"docs": "https://php-sap.github.io/interfaces"
},
"keywords": [
"phpsap",
"php-sap",
Expand All @@ -24,7 +21,8 @@
},
"minimum-stability": "stable",
"require": {
"php": ">=5.5.0"
"php": "^5.5|^7.0",
"ext-json": "*"
},
"autoload": {
"psr-4": {
Expand Down
44 changes: 44 additions & 0 deletions src/Api/IApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace phpsap\interfaces\Api;

use phpsap\interfaces\Util\IJsonSerializable;

/**
* Interface IApi
*
* Describes the SAP remote function API. To be precise it describes the SAP remote
* function call parameters (input), the returns (output) and the tables (input/
* output).
*
* @package phpsap\interfaces
* @author Gregor J.
* @license MIT
*/
interface IApi extends IJsonSerializable
{
/**
* Add a value, struct or table of the remote function.
* @param \phpsap\interfaces\Api\IValue $value
* @return $this
*/
public function add(IValue $value);

/**
* Get all input values of the remote function.
* @return \phpsap\interfaces\Api\IValue[]
*/
public function getInputValues();

/**
* Get all output values of the remote function.
* @return \phpsap\interfaces\Api\IValue[]
*/
public function getOutputValues();

/**
* Get all tables of the remote function.
* @return \phpsap\interfaces\Api\IArray[]
*/
public function getTables();
}
45 changes: 45 additions & 0 deletions src/Api/IArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace phpsap\interfaces\Api;

/**
* Interface IArray
*
* API extend the logic of values but contain member elements.
*
* @package phpsap\interfaces\Api
* @author Gregor J.
* @license MIT
*/
interface IArray extends IValue
{
/**
* API table element.
*/
const DIRECTION_TABLE = 'table';

/**
* API element that casts to PHP array.
*/
const TYPE_ARRAY = 'array';

/**
* JSON configuration key for members array.
*/
const JSON_MEMBERS = 'members';

/**
* Cast a given output value to the implemented value.
* @param array $struct The output array to typecast.
* @return array
* @throws \phpsap\interfaces\exceptions\IArrayElementMissingException
* @throws \phpsap\interfaces\exceptions\IInvalidArgumentException
*/
public function cast($struct);

/**
* Return an array of member elements.
* @return \phpsap\interfaces\Api\IElement[]
*/
public function getMembers();
}
94 changes: 94 additions & 0 deletions src/Api/IElement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace phpsap\interfaces\Api;

use phpsap\interfaces\Util\IJsonSerializable;

/**
* Interface IElement
*
* API elements are struct or table members and have no direction or optional flag
* of their own.
*
* @package phpsap\interfaces\Api
* @author Gregor J.
* @license MIT
*/
interface IElement extends IJsonSerializable
{
/**
* API element that casts to PHP string.
*/
const TYPE_STRING = 'string';

/**
* API element that casts to PHP int.
*/
const TYPE_INTEGER = 'int';

/**
* API element that casts to PHP bool.
*/
const TYPE_BOOLEAN = 'bool';

/**
* API element that casts to PHP float.
*/
const TYPE_FLOAT = 'float';

/**
* API element that casts to a hexadecimal encoded binary to a binary.
* (direction: output)
*/
const TYPE_HEXBIN = 'hexbin';

/**
* API date element that casts to a DateTime object.
*/
const TYPE_DATE = 'date';

/**
* API time element that casts to a DateTime object.
*/
const TYPE_TIME = 'time';

/**
* API virtual timestamp element (e.g. string) that casts to a DateTime object.
*/
const TYPE_TIMESTAMP = 'timestamp';

/**
* API virtual calendar week element (e.g. string) that casts to a DateTime object.
*/
const TYPE_WEEK = 'week';

/**
* JSON configuration key for type value.
*/
const JSON_TYPE = 'type';

/**
* JSON configuration key for name value.
*/
const JSON_NAME = 'name';

/**
* The PHP type of the element.
* @return string
*/
public function getType();

/**
* The name of the element.
* @return string
*/
public function getName();

/**
* Cast a given output value to the implemented value.
* @param bool|int|float|string $value The output to typecast.
* @return bool|int|float|string|\phpsap\DateTime\SapDateTime
* @throws \phpsap\interfaces\exceptions\IInvalidArgumentException
*/
public function cast($value);
}
49 changes: 49 additions & 0 deletions src/Api/IValue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace phpsap\interfaces\Api;

/**
* Interface IValue
*
* API values extend the logic of an element but have a direction (input or output)
* and an optional flag, unlike elements.
*
* @package phpsap\interfaces\Api
* @author Gregor J.
* @license MIT
*/
interface IValue extends IElement
{
/**
* API input element.
*/
const DIRECTION_INPUT = 'input';

/**
* API output element.
*/
const DIRECTION_OUTPUT = 'output';

/**
* JSON configuration key for direction value.
*/
const JSON_DIRECTION = 'direction';

/**
* JSON configuration key for is optional flag.
*/
const JSON_OPTIONAL = 'optional';

/**
* Get the direction of the parameter.
* interface.
* @return string
*/
public function getDirection();

/**
* Is the element optional?
* @return bool
*/
public function isOptional();
}
Loading