Skip to content

Commit 154ae01

Browse files
authored
Add getTenants() helper
1 parent 089e696 commit 154ae01

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/XeroFactory.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class XeroFactory
1717
*/
1818
protected $application;
1919

20+
/**
21+
* @var \Calcinai\OAuth2\Client\XeroTenant[]
22+
*/
23+
protected $tenants = [];
24+
2025
/**
2126
* Setup
2227
*/
@@ -37,6 +42,7 @@ public function setupApplication()
3742
$config->XeroRefreshToken = $refresh;
3843
}
3944

45+
$this->tenants = $provider->getTenants($newAccessToken);
4046
$config->write();
4147
}
4248

@@ -74,4 +80,16 @@ public function getRedirectUri()
7480
'connectXero'
7581
);
7682
}
83+
84+
/**
85+
* @return \Calcinai\OAuth2\Client\XeroTenant[]
86+
*/
87+
public function getTenants()
88+
{
89+
if (!$this->application) {
90+
$this->setupApplication();
91+
}
92+
93+
return $this->tenants;
94+
}
7795
}

0 commit comments

Comments
 (0)