Skip to content

Commit

Permalink
Styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sztyup committed Jul 8, 2020
1 parent 7a6404b commit baa9e2f
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/LAuth/Entities/Account.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Entities;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Entities/User.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Entities;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Events/Login.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Events;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Events/ProviderLogin.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Events;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Exceptions/InvalidStateException.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Exceptions;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Exceptions/LauthException.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Exceptions;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/Exceptions/ProviderNotFound.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth\Exceptions;
Expand Down
36 changes: 22 additions & 14 deletions src/LAuth/LAuthServiceProvider.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth;
Expand All @@ -19,18 +20,22 @@ public function register(): void
$this->app->singleton(LAuth::class);

// Hook into doctrine as early as possible
$this->app->booting(function (Application $application) {
/** @var DoctrineManager $doctrineManager */
$doctrineManager = $application->make(DoctrineManager::class);

$doctrineManager->addPaths([__DIR__ . '/Entities']);
$doctrineManager->extendAll(function ($conf, $conn, EventManager $eventManager) use ($application) {
$eventManager->addEventListener(
Events::loadClassMetadata,
$application->make(ProviderRegistry::class)
$this->app->booting(
function (Application $application) {
/** @var DoctrineManager $doctrineManager */
$doctrineManager = $application->make(DoctrineManager::class);

$doctrineManager->addPaths([__DIR__ . '/Entities']);
$doctrineManager->extendAll(
function ($conf, $conn, EventManager $eventManager) use ($application) {
$eventManager->addEventListener(
Events::loadClassMetadata,
$application->make(ProviderRegistry::class)
);
}
);
});
});
}
);

$this->mergeConfigFrom(
__DIR__ . '/../config/lauth.php',
Expand All @@ -40,8 +45,11 @@ public function register(): void

public function boot(): void
{
$this->publishes([
__DIR__ . '/../config/lauth.php' => config_path('lauth.php'),
], 'config');
$this->publishes(
[
__DIR__ . '/../config/lauth.php' => config_path('lauth.php'),
],
'config'
);
}
}
15 changes: 10 additions & 5 deletions src/LAuth/ProviderRegistry.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth;
Expand Down Expand Up @@ -26,9 +27,9 @@ class ProviderRegistry

public function __construct(Container $container, DoctrineManager $doctrineManager, Repository $config)
{
$this->container = $container;
$this->container = $container;
$this->doctrineManager = $doctrineManager;
$this->config = $config;
$this->config = $config;
}

public function register(string $name, string $providerClass): void
Expand All @@ -39,9 +40,12 @@ public function register(string $name, string $providerClass): void

public function getProvider($name): ProviderInterface
{
return $this->container->make($this->providers[$name], [
'config' => $this->config->get('lauth.providers.' . $name, [])
]);
return $this->container->make(
$this->providers[$name],
[
'config' => $this->config->get('lauth.providers.' . $name, [])
]
);
}

public function loadClassMetadata(LoadClassMetadataEventArgs $event): void
Expand All @@ -60,6 +64,7 @@ protected function baseAccount(ClassMetadata $metadata): void
}

$userClass = $this->container->make(Repository::class)->get('lauth.user_class');

$metadata->associationMappings['user']['targetEntity'] = $userClass;
}
}
1 change: 1 addition & 0 deletions src/LAuth/ProviderUser.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/TokenResponse.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth;
Expand Down
1 change: 1 addition & 0 deletions src/LAuth/UserInterface.php
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Sztyup\LAuth;
Expand Down

0 comments on commit baa9e2f

Please sign in to comment.