-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add fonts factry * Remove unnecessary imports. Co-authored-by: jseparovic1 <jurica.separovic@gmail.com>
- Loading branch information
1 parent
c61b7fe
commit 2d60704
Showing
3 changed files
with
48 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace PCode\GoogleFontDownloader\Lib; | ||
|
||
use GuzzleHttp\Client; | ||
use GuzzleHttp\Psr7\Uri; | ||
use League\Flysystem\Adapter\Local; | ||
use League\Flysystem\Filesystem; | ||
use PCode\GoogleFontDownloader\Interfaces\DownloaderInterface; | ||
use PCode\GoogleFontDownloader\Lib\Service\DownloadService; | ||
use PCode\GoogleFontDownloader\Lib\Service\FileService; | ||
use PCode\GoogleFontDownloader\Lib\Service\FontService; | ||
|
||
class DownloaderFactory | ||
{ | ||
/** | ||
* @param string $path | ||
* @return DownloaderInterface | ||
*/ | ||
public static function create($path) | ||
{ | ||
$fileService = new FileService( | ||
new Filesystem(new Local($path)) | ||
); | ||
|
||
$fontService = new FontService($fileService, basename($path) . '/'); | ||
|
||
$downloadService = new DownloadService(new Client(), $fileService, $fontService); | ||
|
||
return new Downloader( | ||
$fileService, | ||
$fontService, | ||
$downloadService, | ||
new MajodevAPI($fontService, $downloadService, new Uri()) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters