Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Goodchild authored Jul 28, 2017
1 parent 86b9e3d commit 82ee7c9
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,36 @@ use Gyron\Net2Web\Session;
*/
class AccessApiFactory {
/**
* @var string
*/
private $sCachePath;
/**
* @var string
*/
private $sCachePath;
/**
* @param string $sCachePath
*/
public function __construct( string $sCachePath ) {
$this->sCachePath = $sCachePath;
}
/**
* @param string $sCachePath
*/
public function __construct( string $sCachePath ) {
$this->sCachePath = $sCachePath;
}
/**
* @param array $aConfig requires user_id, password, ip and port
* @return Client
* @throws \Exception
*/
public function forConfig( array $aConfig ) {
$sCacheFile = sprintf( '%s/net2web_session.sid', rtrim( $this->sCachePath, '/' ) );
/**
* @param array $aConfig requires user_id, password, ip and port
* @return Client
* @throws \Exception
*/
public function forConfig( array $aConfig ) {
$sCacheFile = sprintf( '%s/net2web_session.sid', rtrim( $this->sCachePath, '/' ) );
$sSessionId = null;
if ( is_file( $sCacheFile ) ) {
$sSessionId = trim( file_get_contents( $sCacheFile ) );
}
$sSessionId = null;
if ( is_file( $sCacheFile ) ) {
$sSessionId = trim( file_get_contents( $sCacheFile ) );
}
$oNet2Session = new Session( $aConfig['user_id'], $aConfig['password'], $aConfig['ip'], (string)$aConfig['port'], $sSessionId );
if ( $sSessionId != $oNet2Session->getSessionId() ) {
file_put_contents( $sCacheFile, trim( $oNet2Session->getSessionId() ) );
}
return ( new Client( oNet2Session ) );
}
$oNet2Session = new Session( $aConfig['user_id'], $aConfig['password'], $aConfig['ip'], (string)$aConfig['port'], $sSessionId );
if ( $sSessionId != $oNet2Session->getSessionId() ) {
file_put_contents( $sCacheFile, trim( $oNet2Session->getSessionId() ) );
}
return ( new Client( oNet2Session ) );
}
}
```

0 comments on commit 82ee7c9

Please sign in to comment.