@@ -42,36 +42,36 @@ use Gyron\Net2Web\Session;
4242 */
4343class AccessApiFactory {
4444
45- /**
46- * @var string
47- */
48- private $sCachePath;
45+ /**
46+ * @var string
47+ */
48+ private $sCachePath;
4949
50- /**
51- * @param string $sCachePath
52- */
53- public function __construct( string $sCachePath ) {
54- $this->sCachePath = $sCachePath;
55- }
50+ /**
51+ * @param string $sCachePath
52+ */
53+ public function __construct( string $sCachePath ) {
54+ $this->sCachePath = $sCachePath;
55+ }
5656
57- /**
58- * @param array $aConfig requires user_id, password, ip and port
59- * @return Client
60- * @throws \Exception
61- */
62- public function forConfig( array $aConfig ) {
63- $sCacheFile = sprintf( '%s/net2web_session.sid', rtrim( $this->sCachePath, '/' ) );
57+ /**
58+ * @param array $aConfig requires user_id, password, ip and port
59+ * @return Client
60+ * @throws \Exception
61+ */
62+ public function forConfig( array $aConfig ) {
63+ $sCacheFile = sprintf( '%s/net2web_session.sid', rtrim( $this->sCachePath, '/' ) );
6464
65- $sSessionId = null;
66- if ( is_file( $sCacheFile ) ) {
67- $sSessionId = trim( file_get_contents( $sCacheFile ) );
68- }
65+ $sSessionId = null;
66+ if ( is_file( $sCacheFile ) ) {
67+ $sSessionId = trim( file_get_contents( $sCacheFile ) );
68+ }
6969
70- $oNet2Session = new Session( $aConfig['user_id'], $aConfig['password'], $aConfig['ip'], (string)$aConfig['port'], $sSessionId );
71- if ( $sSessionId != $oNet2Session->getSessionId() ) {
72- file_put_contents( $sCacheFile, trim( $oNet2Session->getSessionId() ) );
73- }
74- return ( new Client( oNet2Session ) );
75- }
70+ $oNet2Session = new Session( $aConfig['user_id'], $aConfig['password'], $aConfig['ip'], (string)$aConfig['port'], $sSessionId );
71+ if ( $sSessionId != $oNet2Session->getSessionId() ) {
72+ file_put_contents( $sCacheFile, trim( $oNet2Session->getSessionId() ) );
73+ }
74+ return ( new Client( oNet2Session ) );
75+ }
7676}
7777```
0 commit comments