-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* multiple watchdog support * code fixes & yaml dep in req-dev * few refactors * extension flexibility add * reverts & refactors * legacy support & config & test * compound unit infection cover fix Co-authored-by: marek <marek@choosit.com>
- Loading branch information
Showing
33 changed files
with
739 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Raneomik\WatchdogBundle\DependencyInjection\WatchdogExtension; | ||
use Raneomik\WatchdogBundle\Handler\WatchdogHandlerInterface; | ||
use Raneomik\WatchdogBundle\Subscriber\WatchdogEventSubscriber; | ||
use Raneomik\WatchdogBundle\Watchdog\Watchdog; | ||
use Raneomik\WatchdogBundle\Watchdog\WatchdogInterface; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set(Watchdog::class) | ||
->public() | ||
->arg('$watchdogParameters', '%watchdog_config%') | ||
->tag(WatchdogExtension::SERVICE_TAG, ['id' => 'default']) | ||
|
||
->alias(WatchdogInterface::class, Watchdog::class) | ||
; | ||
|
||
$container->services() | ||
->instanceof(WatchdogHandlerInterface::class) | ||
->tag(WatchdogExtension::HANDLER_SERVICE_TAG) | ||
; | ||
|
||
$container->services() | ||
->set(WatchdogEventSubscriber::class) | ||
->arg('$watchdogCollection', tagged_iterator(WatchdogExtension::SERVICE_TAG, 'id')) | ||
->arg('$watchdogHandlers', tagged_iterator(WatchdogExtension::HANDLER_SERVICE_TAG)) | ||
->tag('kernel.event_subscriber') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<services> | ||
<service id="Raneomik\WatchdogBundle\Watchdog\Watchdog" class="Raneomik\WatchdogBundle\Watchdog\Watchdog"> | ||
<tag name="raneomik_watchdog" id="default"/> | ||
<argument>%watchdog_config%</argument> | ||
</service> | ||
<service id="Raneomik\WatchdogBundle\Watchdog\WatchdogInterface" alias="Raneomik\WatchdogBundle\Watchdog\Watchdog" /> | ||
|
||
<instanceof id="Raneomik\WatchdogBundle\Handler\WatchdogHandlerInterface" autowire="true"> | ||
<tag name="raneomik_watchdog.handler"/> | ||
</instanceof > | ||
|
||
<service id="Raneomik\WatchdogBundle\Subscriber\WatchdogEventSubscriber" class="Raneomik\WatchdogBundle\Subscriber\WatchdogEventSubscriber"> | ||
<tag name="kernel.event_subscriber"/> | ||
<argument type="tagged_iterator" tag="raneomik_watchdog" index-by="id"/> | ||
<argument type="tagged_iterator" tag="raneomik_watchdog.handler"/> | ||
</service> | ||
</services> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/DependencyInjection/SymfonyVersionChecker/LegacyChecker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Raneomik\WatchdogBundle\DependencyInjection\SymfonyVersionChecker; | ||
|
||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
class LegacyChecker | ||
{ | ||
public function isLegacy(): bool | ||
{ | ||
/* @phpstan-ignore-next-line */ | ||
return 5 > Kernel::MAJOR_VERSION; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/DependencyInjection/SymfonyVersionChecker/LegacyCheckerFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Raneomik\WatchdogBundle\DependencyInjection\SymfonyVersionChecker; | ||
|
||
class LegacyCheckerFactory | ||
{ | ||
private static bool $testMode = false; | ||
|
||
public static function create(bool $forceLegacy = false): LegacyChecker | ||
{ | ||
if ($forceLegacy) { | ||
return new LegacyFaker($forceLegacy); | ||
} | ||
|
||
return self::$testMode | ||
? new LegacyFaker() | ||
: new LegacyChecker() | ||
; | ||
} | ||
|
||
public static function testMode(): void | ||
{ | ||
self::$testMode = true; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/DependencyInjection/SymfonyVersionChecker/LegacyFaker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Raneomik\WatchdogBundle\DependencyInjection\SymfonyVersionChecker; | ||
|
||
class LegacyFaker extends LegacyChecker | ||
{ | ||
private bool $isLegacy; | ||
|
||
public function __construct(bool $isLegacy = false) | ||
{ | ||
$this->isLegacy = $isLegacy; | ||
} | ||
|
||
public function isLegacy(): bool | ||
{ | ||
return $this->isLegacy; | ||
} | ||
} |
Oops, something went wrong.