| 1 |
<?php |
| 2 |
/** |
| 3 |
* Quote Service Provider |
| 4 |
* |
| 5 |
* @package Easy_Invoice |
| 6 |
* @subpackage Providers |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace EasyInvoice\Providers; |
| 10 |
|
| 11 |
use EasyInvoice\Repositories\QuoteRepository; |
| 12 |
|
| 13 |
/** |
| 14 |
* QuoteServiceProvider Class |
| 15 |
* |
| 16 |
* Handles the registration of quote-related services. |
| 17 |
*/ |
| 18 |
class QuoteServiceProvider { |
| 19 |
/** |
| 20 |
* The repository instance |
| 21 |
* |
| 22 |
* @var QuoteRepository |
| 23 |
*/ |
| 24 |
protected static $repository = null; |
| 25 |
|
| 26 |
/** |
| 27 |
* Register quote services |
| 28 |
*/ |
| 29 |
public function register() { |
| 30 |
// Register service providers, load dependencies, etc. |
| 31 |
$this->registerRepositories(); |
| 32 |
$this->registerHooks(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Register repositories |
| 37 |
*/ |
| 38 |
protected function registerRepositories() { |
| 39 |
// This method would be more useful if you're using a dependency injection container |
| 40 |
// For now, it's just a placeholder to maintain structure for future expansion |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Register hooks |
| 45 |
*/ |
| 46 |
protected function registerHooks() { |
| 47 |
// Register any WordPress hooks related to quotes |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Register quote repository |
| 52 |
*/ |
| 53 |
protected function registerQuoteRepository() { |
| 54 |
// Create and store the repository instance |
| 55 |
self::$repository = new QuoteRepository(); |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Get the quote repository |
| 60 |
* |
| 61 |
* @return QuoteRepository The quote repository |
| 62 |
*/ |
| 63 |
public static function getQuoteRepository() { |
| 64 |
// Create the repository if it doesn't exist |
| 65 |
if (self::$repository === null) { |
| 66 |
self::$repository = new QuoteRepository(); |
| 67 |
} |
| 68 |
|
| 69 |
return self::$repository; |
| 70 |
} |
| 71 |
} |