| 1 |
<?php |
| 2 |
/** |
| 3 |
* Invoice Item Service Provider Class |
| 4 |
* |
| 5 |
* @package Easy_Invoice |
| 6 |
* @subpackage Providers |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace EasyInvoice\Providers; |
| 10 |
|
| 11 |
use EasyInvoice\Interfaces\InvoiceItemRepositoryInterface; |
| 12 |
use EasyInvoice\Repositories\InvoiceItemRepository; |
| 13 |
|
| 14 |
/** |
| 15 |
* InvoiceItemServiceProvider Class |
| 16 |
* |
| 17 |
* Handles registration of invoice item-related services. |
| 18 |
*/ |
| 19 |
class InvoiceItemServiceProvider { |
| 20 |
/** |
| 21 |
* The repository instance |
| 22 |
* |
| 23 |
* @var InvoiceItemRepositoryInterface |
| 24 |
*/ |
| 25 |
protected static $repository = null; |
| 26 |
|
| 27 |
/** |
| 28 |
* Register invoice item services |
| 29 |
*/ |
| 30 |
public function register() { |
| 31 |
// Register invoice item repository |
| 32 |
$this->registerInvoiceItemRepository(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Register invoice item repository |
| 37 |
*/ |
| 38 |
protected function registerInvoiceItemRepository() { |
| 39 |
// Create and store the repository instance |
| 40 |
self::$repository = new InvoiceItemRepository(); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Get the invoice item repository |
| 45 |
* |
| 46 |
* @return InvoiceItemRepositoryInterface The invoice item repository |
| 47 |
*/ |
| 48 |
public static function getInvoiceItemRepository() { |
| 49 |
// Create the repository if it doesn't exist |
| 50 |
if (self::$repository === null) { |
| 51 |
self::$repository = new InvoiceItemRepository(); |
| 52 |
} |
| 53 |
|
| 54 |
return self::$repository; |
| 55 |
} |
| 56 |
} |