Skip to content

Commit 887b4b9

Browse files
committed
Chore: Enhancement
- Added an exception message to ServiceNotRegisteredException exception; - Added a property `serviceId` to ServiceNotRegisteredException; - Added .gitattributes files to avoid unused files in vendor folder; Signed-off-by: Oleksii Bulba <oleksii_bulba@epam.com>
1 parent f00f3d9 commit 887b4b9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpcs.xml export-ignore
9+
/phpmd.xml export-ignore
10+
/phpunit.xml export-ignore

src/Exception/ServiceNotRegisteredException.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,17 @@
77
class ServiceNotRegisteredException extends \RuntimeException
88
implements NotFoundExceptionInterface
99
{
10+
private string $serviceId;
11+
12+
public function __construct(string $serviceId, int $code = 0, ?\Throwable $previous = null)
13+
{
14+
$this->serviceId = $serviceId;
15+
16+
parent::__construct(sprintf('Service "%s" not registered.', $this->serviceId), $code, $previous);
17+
}
18+
19+
public function getServiceId(): string
20+
{
21+
return $this->serviceId;
22+
}
1023
}

0 commit comments

Comments
 (0)