Payment
1 year ago
Support
11 months ago
Application.php
1 year ago
Container.php
1 year ago
Factory.php
1 year ago
Application.php
59 lines
| 1 | <?php |
| 2 | namespace Ollyo\PaymentHub\Core; |
| 3 | |
| 4 | use Ollyo\PaymentHub\Config\Repository; |
| 5 | use Ollyo\PaymentHub\Contracts\Config\RepositoryContract; |
| 6 | |
| 7 | class Application |
| 8 | { |
| 9 | /** |
| 10 | * The application version |
| 11 | * |
| 12 | * @var string |
| 13 | */ |
| 14 | const VERSION = '1.0.0'; |
| 15 | |
| 16 | /** |
| 17 | * The repository instance |
| 18 | * |
| 19 | * @var Array<Repository> |
| 20 | */ |
| 21 | protected $repositories = []; |
| 22 | |
| 23 | /** |
| 24 | * Get the application version number |
| 25 | * |
| 26 | * @return string; |
| 27 | */ |
| 28 | public function getVersion() |
| 29 | { |
| 30 | return static::VERSION; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | public function hasRepository($key) |
| 35 | { |
| 36 | return isset($this->repositories[$key]); |
| 37 | } |
| 38 | |
| 39 | public function makeRepository($key): RepositoryContract |
| 40 | { |
| 41 | if (!$this->hasRepository($key)) { |
| 42 | $this->repositories[$key] = new Repository(); |
| 43 | } |
| 44 | |
| 45 | return $this->repositories[$key]; |
| 46 | } |
| 47 | |
| 48 | public function getAppConfig() |
| 49 | { |
| 50 | $config = $this->makeRepository(static::class); |
| 51 | $config->set([ |
| 52 | 'name' => 'payment hub', |
| 53 | 'version' => $this->getVersion(), |
| 54 | 'payments' => ['paypal', 'stripe', 'authorised net'] |
| 55 | ]); |
| 56 | |
| 57 | return $config; |
| 58 | } |
| 59 | } |