File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed
Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1212use Http \Client \Common \Plugin \QueryDefaultsPlugin ;
1313use Psr \Http \Message \ResponseInterface ;
1414use Psr \Http \Message \UriInterface ;
15+ use RuntimeException ;
1516use Shapecode \FUT \Client \Authentication \AccountInterface ;
1617use Shapecode \FUT \Client \Authentication \Session ;
1718use Shapecode \FUT \Client \Config \Config ;
@@ -694,9 +695,14 @@ public function clubConsumables()
694695 */
695696 public function squad (int $ squadId = 0 )
696697 {
698+ $ session = $ this ->getAccount ()->getSession ();
699+ if ($ session === null ) {
700+ throw new RuntimeException ('session has to be set ' );
701+ }
702+
697703 $ this ->pin ->sendEvent ('page_view ' , 'Hub - Squads ' );
698704
699- $ personaId = $ this -> getAccount ()-> getSession () ->getPersona ();
705+ $ personaId = $ session ->getPersona ();
700706 $ response = $ this ->request ('GET ' , '/squad/ ' . $ squadId . '/user/ ' . $ personaId );
701707
702708 $ this ->pin ->sendEvent ('page_view ' , 'Squads - Squad Overview ' );
@@ -1122,6 +1128,10 @@ protected function request(
11221128 $ account = $ this ->getAccount ();
11231129 $ session = $ account ->getSession ();
11241130
1131+ if ($ session === null ) {
1132+ throw new RuntimeException ('session has to be set ' );
1133+ }
1134+
11251135 if ($ method === 'GET ' ) {
11261136 $ params ['_ ' ] = time ();
11271137 }
Original file line number Diff line number Diff line change 55namespace Shapecode \FUT \Client \Api ;
66
77use Carbon \Carbon ;
8+ use RuntimeException ;
89use Shapecode \FUT \Client \Authentication \AccountInterface ;
910use Shapecode \FUT \Client \Exception \PinErrorException ;
1011use Shapecode \FUT \Client \Http \ClientFactoryInterface ;
@@ -58,6 +59,10 @@ public function event(
5859 $ account = $ this ->account ;
5960 $ session = $ account ->getSession ();
6061
62+ if ($ session === null ) {
63+ throw new RuntimeException ('session has to be set ' );
64+ }
65+
6166 $ data = [
6267 'core ' => [
6368 'dob ' => $ session ->getDob (),
@@ -121,6 +126,10 @@ public function send(array $events) : bool
121126 $ session = $ account ->getSession ();
122127 $ platform = $ account ->getCredentials ()->getPlatform ();
123128
129+ if ($ session === null ) {
130+ throw new RuntimeException ('session has to be set ' );
131+ }
132+
124133 $ body = json_encode ([
125134 'custom ' => [
126135 'networkAccess ' => 'G ' ,
Original file line number Diff line number Diff line change 55namespace Shapecode \FUT \Client \Authentication ;
66
77use GuzzleHttp \ClientInterface ;
8- use RuntimeException ;
98use Shapecode \FUT \Client \Model \ProxyInterface ;
109
1110class Account implements AccountInterface
@@ -37,12 +36,8 @@ public function getCredentials() : CredentialsInterface
3736 return $ this ->credentials ;
3837 }
3938
40- public function getSession () : SessionInterface
39+ public function getSession () : ? SessionInterface
4140 {
42- if ($ this ->session === null ) {
43- throw new RuntimeException ('session has to be set ' );
44- }
45-
4641 return $ this ->session ;
4742 }
4843
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ interface AccountInterface
1010{
1111 public function getCredentials () : CredentialsInterface ;
1212
13- public function getSession () : SessionInterface ;
13+ public function getSession () : ? SessionInterface ;
1414
1515 public function setSession (SessionInterface $ session ) : void ;
1616
You can’t perform that action at this time.
0 commit comments