Skip to content

wip - modernize bundle config #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
13 changes: 12 additions & 1 deletion src/DependencyInjection/KnpUOAuth2ClientExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\YahooProviderConfigurator;
use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\YandexProviderConfigurator;
use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\ZendeskProviderConfigurator;
use KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
Expand Down Expand Up @@ -172,11 +173,13 @@ public function __construct($checkExternalClassExistence = true)
*/
public function load(array $configs, ContainerBuilder $container): void
{
trigger_deprecation('OA2CBundle', '99999', 'Load() deprecated... Moving to %s', KnpUOAuth2ClientBundle::class);

$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__, 2).'/config'));
$loader->load('services.xml');

$httpClient = $config['http_client'];
Expand Down Expand Up @@ -311,6 +314,8 @@ private function configureProviderAndClient(ContainerBuilder $container, $provid

public static function getAllSupportedTypes(): array
{
trigger_deprecation('OA2CBundle', '99999', 'getAllSupportedTypes() deprecated... Moving to %s', KnpUOAuth2ClientBundle::class);

return array_keys(self::$supportedProviderTypes);
}

Expand All @@ -319,6 +324,8 @@ public static function getAllSupportedTypes(): array
*/
public function getConfigurator($type): ProviderConfiguratorInterface
{
trigger_deprecation('OA2CBundle', '99999', 'getConfigurator() deprecated... Moving to %s', KnpUOAuth2ClientBundle::class);

if (!isset($this->configurators[$type])) {
$class = self::$supportedProviderTypes[$type];

Expand All @@ -333,6 +340,8 @@ public function getConfigurator($type): ProviderConfiguratorInterface
*/
public function getAlias(): string
{
trigger_deprecation('OA2CBundle', '99999', 'getAlias() deprecated... Moving to %s', KnpUOAuth2ClientBundle::class);

return 'knpu_oauth2_client';
}

Expand Down Expand Up @@ -366,6 +375,8 @@ private function buildConfigurationForType(NodeDefinition $node, $type)
*/
public static function configuratorNeedsClientSecret(ProviderConfiguratorInterface $configurator): bool
{
trigger_deprecation('OA2CBundle', '99999', 'configuratorNeedsClientSecret() deprecated... Moving to %s', KnpUOAuth2ClientBundle::class);

if (!$configurator instanceof ProviderWithoutClientSecretConfiguratorInterface) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/KnpUOAuth2ClientBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

use KnpU\OAuth2ClientBundle\DependencyInjection\KnpUOAuth2ClientExtension;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;

class KnpUOAuth2ClientBundle extends Bundle
class KnpUOAuth2ClientBundle extends AbstractBundle
{
/**
* Overridden to allow for the custom extension alias.
Expand Down