Skip to content

Commit 765ce4d

Browse files
SWR-15367
1 parent ea57d84 commit 765ce4d

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Only the latest version will get new features. Bug fixes will be provided using
1111

1212
| Package Version | Laravel Version | Bug Fixes Until | |
1313
|-----------------|-----------------|-------------------|---------------------------------------------------------------------------------------------|
14-
| 1 | 05 | December 24th, 2024 | [Documentation](https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/README.md) |
14+
| 1 | 06 | December 24th, 2024 | [Documentation](https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/README.md) |
1515

1616
## Installation
1717

1818
You can install this package via composer using this command:
1919

2020
```
21-
composer require salesmessage/php-lib-rabbitmq:^1.05 --ignore-platform-reqs
21+
composer require salesmessage/php-lib-rabbitmq:^1.06 --ignore-platform-reqs
2222
```
2323

2424
The package will automatically register itself.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"extra": {
3636
"branch-alias": {
37-
"dev-master": "1.05-dev"
37+
"dev-master": "1.06-dev"
3838
},
3939
"laravel": {
4040
"providers": [

src/Services/GroupsService.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Salesmessage\LibRabbitMQ\Services;
44

55
use Symfony\Component\Yaml\Yaml;
6+
use Throwable;
67

78
class GroupsService
89
{
@@ -13,13 +14,7 @@ class GroupsService
1314

1415
public function __construct()
1516
{
16-
try {
17-
$configData = (array) Yaml::parseFile(base_path() . '/rabbit-groups.yml');
18-
} catch (Throwable $exception) {
19-
$configData = [];
20-
}
21-
22-
$this->configData = $configData;
17+
$this->configData = $this->loadConfigData();
2318
}
2419

2520
/**
@@ -42,5 +37,24 @@ public function getAllGroupsNames(): array
4237

4338
return array_filter(array_keys($this->configData['groups']));
4439
}
40+
41+
/**
42+
* @return array
43+
*/
44+
private function loadConfigData(): array
45+
{
46+
$filePath = base_path() . '/rabbit-groups.yml';
47+
if (!file_exists($filePath)) {
48+
return [];
49+
}
50+
51+
try {
52+
$configData = (array) Yaml::parseFile($filePath);
53+
} catch (Throwable $exception) {
54+
$configData = [];
55+
}
56+
57+
return $configData;
58+
}
4559
}
4660

0 commit comments

Comments
 (0)