| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Core; |
| 6 |
|
| 7 |
/** |
| 8 |
* Base Service Class |
| 9 |
* |
| 10 |
* Abstract base class for all Yatra services |
| 11 |
* Provides common functionality and structure |
| 12 |
* |
| 13 |
* @package Yatra\Core |
| 14 |
*/ |
| 15 |
abstract class Service |
| 16 |
{ |
| 17 |
/** |
| 18 |
* Service constructor |
| 19 |
*/ |
| 20 |
public function __construct() |
| 21 |
{ |
| 22 |
$this->init(); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Initialize the service |
| 27 |
* Override this method in child classes |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
protected function init(): void |
| 32 |
{ |
| 33 |
// Override in child classes |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Get service name |
| 38 |
* Override this method in child classes |
| 39 |
* |
| 40 |
* @return string |
| 41 |
*/ |
| 42 |
public function getName(): string |
| 43 |
{ |
| 44 |
return static::class; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Check if service is active |
| 49 |
* Override this method in child classes |
| 50 |
* |
| 51 |
* @return bool |
| 52 |
*/ |
| 53 |
public function isActive(): bool |
| 54 |
{ |
| 55 |
return true; |
| 56 |
} |
| 57 |
} |
| 58 |
|