Client
1 month ago
Endpoint
1 month ago
Exception
3 years ago
InstallerApiClient.php
1 month ago
InstallerApiClientFactory.php
1 month ago
SiteUrl.php
1 month ago
InstallerApiClientFactory.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OTGS\Installer\Api; |
| 4 | |
| 5 | use OTGS\Installer\Api\Endpoint\Subscription as SubscriptionEndpoint; |
| 6 | use OTGS\Installer\Api\Endpoint\ProductBucketUrl as ProductBucketUrlEndpoint; |
| 7 | use OTGS_Installer_Logger_Storage; |
| 8 | use OTGS_Installer_Plugin_Factory; |
| 9 | use OTGS_Installer_Plugin_Finder; |
| 10 | |
| 11 | class InstallerApiClientFactory { |
| 12 | public static function create( OTGS_Installer_Logger_Storage $loggerStorage, $repositoryId, $repositoryApiUrl ) { |
| 13 | $client = new Client\Client( new \WP_Http(), $repositoryApiUrl ); |
| 14 | |
| 15 | $siteUrl = new SiteUrl(); |
| 16 | $subscriptionEndpoint = new SubscriptionEndpoint( |
| 17 | $repositoryId, |
| 18 | $siteUrl, |
| 19 | new OTGS_Installer_Plugin_Finder( new OTGS_Installer_Plugin_Factory() ) |
| 20 | ); |
| 21 | |
| 22 | $productBucketUrlEndpoint = new ProductBucketUrlEndpoint( |
| 23 | $repositoryId, |
| 24 | $siteUrl |
| 25 | ); |
| 26 | |
| 27 | return new InstallerApiClient( $loggerStorage, $client, $subscriptionEndpoint, $productBucketUrlEndpoint ); |
| 28 | } |
| 29 | } |
| 30 |