Skip to content

Commit d5989cb

Browse files
committed
add interfaces
1 parent ac53b28 commit d5989cb

File tree

5 files changed

+298
-0
lines changed

5 files changed

+298
-0
lines changed

src/IConfig.php

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* File src/IConfig.php
4+
*
5+
* Basic configuration interface.
6+
*
7+
* @package interfaces
8+
* @author Gregor J.
9+
* @license MIT
10+
*/
11+
12+
namespace phpsap\interfaces;
13+
14+
/**
15+
* Interface IConfig
16+
*
17+
* Interface to configure basic connection parameters for SAP remote function calls.
18+
*
19+
* @package phpsap\interfaces
20+
* @author Gregor J.
21+
* @license MIT
22+
*/
23+
interface IConfig
24+
{
25+
/**
26+
* If the connection needs to be made through a firewall using a SAPRouter,
27+
* specify the SAPRouter parameters in the following format:
28+
* /H/hostname/S/portnumber/H/
29+
* @return string the saprouter
30+
*/
31+
public function getSaprouter();
32+
33+
/**
34+
* Get the trace level (0-3)
35+
* @return int the trace level
36+
*/
37+
public function getTrace();
38+
39+
/**
40+
* Only needed it if you want to connect to a non-Unicode backend using a
41+
* non-ISO-Latin-1 user name or password. The RFC library will then use that
42+
* codepage for the initial handshake, thus preserving the characters in
43+
* username/password.
44+
*
45+
* @return int the codepage
46+
*/
47+
public function getCodepage();
48+
49+
/**
50+
* Get the username to use for authentication.
51+
* @return string the username
52+
*/
53+
public function getUser();
54+
55+
/**
56+
* Get the password to use for authentication.
57+
* @return string the password
58+
*/
59+
public function getPasswd();
60+
61+
/**
62+
* Get the destination in RfcOpen.
63+
* @return string Get the destination in RfcOpen.
64+
*/
65+
public function getClient();
66+
67+
/**
68+
* Get the logon Language.
69+
* @return string the logon language
70+
*/
71+
public function getLang();
72+
73+
/**
74+
* Get the destination in RfcOpenConnection.
75+
* @return string the logon language
76+
*/
77+
public function getDest();
78+
79+
/**
80+
* Generate the configuration needed for connecting.
81+
* @return mixed
82+
*/
83+
public function generateConfig();
84+
}

src/IConfigA.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* File src/IConfigA.php
4+
*
5+
* Type A configuration interface.
6+
*
7+
* @package interfaces
8+
* @author Gregor J.
9+
* @license MIT
10+
*/
11+
12+
namespace phpsap\interfaces;
13+
14+
/**
15+
* Interface IConfigA
16+
*
17+
* Interface to configure connection parameters for SAP remote function calls using
18+
* a specific SAP application server (type A).
19+
*
20+
* @package phpsap\interfaces
21+
* @author Gregor J.
22+
* @license MIT
23+
*/
24+
interface IConfigA extends IConfig
25+
{
26+
/**
27+
* @var string A: RFC server is a specific SAP application server
28+
*/
29+
const TYPE = 'A';
30+
31+
/**
32+
* Get the host name of a specific SAP application server.
33+
* @return string host name of a specific SAP application server
34+
*/
35+
public function getAshost();
36+
37+
/**
38+
* Get the SAP system number.
39+
* @return string SAP system number
40+
*/
41+
public function getSysnr();
42+
43+
/**
44+
* optional; default: gateway on application server
45+
* @return string gateway on application server
46+
*/
47+
public function getGwhost();
48+
49+
/**
50+
* optional; default: gateway on application server
51+
* @return string gateway on application server
52+
*/
53+
public function getGwserv();
54+
}

src/IConfigB.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* File src/IConfigB.php
4+
*
5+
* Type B configuration interface.
6+
*
7+
* @package interfaces
8+
* @author Gregor J.
9+
* @license MIT
10+
*/
11+
12+
namespace phpsap\interfaces;
13+
14+
/**
15+
* Interface IConfigB
16+
*
17+
* Interface to configure connection parameters for SAP remote function calls using
18+
* load balancing (type B).
19+
*
20+
* @package phpsap\interfaces
21+
* @author Gregor J.
22+
* @license MIT
23+
*/
24+
interface IConfigB extends IConfig
25+
{
26+
/**
27+
* @var string B: use Load Balancing feature
28+
*/
29+
const TYPE = 'B';
30+
31+
/**
32+
* Get the name of SAP system, optional; default: destination
33+
* @return string name of SAP system.
34+
*/
35+
public function getR3name();
36+
37+
/**
38+
* Get the host name of the message server.
39+
* @return string host name of the message server
40+
*/
41+
public function getMshost();
42+
43+
/**
44+
* Get the group name of the application servers, optional; default: PUBLIC.
45+
* @return string group name of the application servers
46+
*/
47+
public function getGroup();
48+
}

src/IConnection.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* File src/IConnection.php
4+
*
5+
* PHP/SAP connection interface.
6+
*
7+
* @package interfaces
8+
* @author Gregor J.
9+
* @license MIT
10+
*/
11+
12+
namespace phpsap\interfaces;
13+
14+
/**
15+
* Interface IConnection
16+
*
17+
* PHP/SAP connection interface.
18+
*
19+
* @package phpsap\interfaces
20+
* @author Gregor J.
21+
* @license MIT
22+
*/
23+
interface IConnection
24+
{
25+
/**
26+
* Inject connection configuration.
27+
* @param \phpsap\interfaces\IConfig $config connection configuration
28+
*/
29+
public function __construct(IConfig $config);
30+
31+
/**
32+
* Returns the connection ID.
33+
* The connection ID is derived from the configuration. The same configuration
34+
* will result in the same connection ID.
35+
* @return string
36+
*/
37+
public function getId();
38+
39+
/**
40+
* Send a ping request via an established connection to verify that the
41+
* connection works.
42+
* @return boolean success?
43+
* @throws \phpsap\exceptions\ConnectionFailedException
44+
*/
45+
public function ping();
46+
47+
/**
48+
* Prepare a remote function call and return a function instance.
49+
* @param string $functionName
50+
* @return \phpsap\interfaces\IFunction
51+
*/
52+
public function prepareFunction($functionName);
53+
54+
/**
55+
* Closes the connection.
56+
* @return void
57+
*/
58+
public function close();
59+
}

src/IFunction.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* File src/IFunction.php
4+
*
5+
* PHP/SAP function interface.
6+
*
7+
* @package interfaces
8+
* @author Gregor J.
9+
* @license MIT
10+
*/
11+
12+
namespace phpsap\interfaces;
13+
14+
use kbATeam\TypeCast\ITypeCast;
15+
16+
/**
17+
* Interface IFunction
18+
*
19+
* PHP/SAP function interface.
20+
*
21+
* @package phpsap\interfaces
22+
* @author Gregor J.
23+
* @license MIT
24+
*/
25+
interface IFunction
26+
{
27+
/**
28+
* Get the function name.
29+
* @return string
30+
*/
31+
public function getName();
32+
33+
/**
34+
* Remove all parameters that have been set and start over.
35+
* @return \phpsap\interfaces\IFunction
36+
*/
37+
public function reset();
38+
39+
/**
40+
* Set function call parameter.
41+
* @param string $name
42+
* @param array|string|float|int|bool|null $value
43+
* @return \phpsap\interfaces\IFunction
44+
*/
45+
public function setParam($name, $value);
46+
47+
/**
48+
* Invoke the prepared function call.
49+
* @param null|array $params Optional parameter array.
50+
* @return array
51+
*/
52+
public function invoke($params = null);
53+
}

0 commit comments

Comments
 (0)