Skip to content

Commit cd3a19d

Browse files
committed
- Configurator renamed to LaravelGitHooks
- LaravelGitHooksFacade created
1 parent cec0896 commit cd3a19d

File tree

9 files changed

+44
-31
lines changed

9 files changed

+44
-31
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
"laravel": {
5757
"providers": [
5858
"Igorsgm\\LaravelGitHooks\\LaravelGitHooksServiceProvider"
59-
]
59+
],
60+
"aliases": {
61+
"LaravelGitHooks": "Igorsgm\\LaravelGitHooks\\LaravelGitHooksFacade"
62+
}
6063
}
6164
},
6265
"minimum-stability": "dev",

src/Console/Commands/RegisterHooks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Igorsgm\LaravelGitHooks\Console\Commands;
44

5-
use Igorsgm\LaravelGitHooks\Contracts\Configurator;
5+
use Igorsgm\LaravelGitHooks\LaravelGitHooks;
66
use Illuminate\Console\Command;
77

88
class RegisterHooks extends Command
@@ -24,11 +24,11 @@ class RegisterHooks extends Command
2424
/**
2525
* Execute the console command.
2626
*
27-
* @param Configurator $configurator
27+
* @param LaravelGitHooks $laravelGitHooks
2828
*/
29-
public function handle(Configurator $configurator)
29+
public function handle(LaravelGitHooks $laravelGitHooks)
3030
{
31-
$configurator->run();
31+
$laravelGitHooks->run();
3232

3333
$this->info('Git hooks have been successfully created');
3434
}

src/Contracts/Configurator.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Configurator.php renamed to src/LaravelGitHooks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Igorsgm\LaravelGitHooks\Contracts\HookStorage;
66
use Illuminate\Contracts\Foundation\Application;
77

8-
class Configurator implements Contracts\Configurator
8+
class LaravelGitHooks
99
{
1010
/**
1111
* @var HookStorage

src/LaravelGitHooksFacade.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Igorsgm\LaravelGitHooks;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
/**
8+
* @see \Igorsgm\LaravelGitHooks\LaravelGitHooks
9+
*/
10+
class LaravelGitHooksFacade extends Facade
11+
{
12+
/**
13+
* Get the registered name of the component.
14+
*
15+
* @return string
16+
*/
17+
protected static function getFacadeAccessor()
18+
{
19+
return 'laravel-git-hooks';
20+
}
21+
}

src/LaravelGitHooksServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function register()
5353
$this->mergeConfigFrom(__DIR__.'/../config/git-hooks.php', 'git-hooks');
5454

5555
if ($this->app->runningInConsole()) {
56-
$this->app->singleton(Contracts\Configurator::class, function ($app) {
56+
$this->app->singleton('laravel-git-hooks', function ($app) {
5757
$hooks = [
5858
'pre-commit',
5959
'prepare-commit-msg',
@@ -74,7 +74,7 @@ public function register()
7474

7575
$storage = $app[Contracts\HookStorage::class];
7676

77-
return new Configurator($app, $storage, $hooks);
77+
return new LaravelGitHooks($app, $storage, $hooks);
7878
});
7979

8080
$this->app->bind(Contracts\HookStorage::class, HookStorage::class);

tests/Console/Commands/RegisterHooksTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public function test_get_command_name()
1616
$this->assertEquals('git-hooks:register-hooks', $command->getName());
1717
}
1818

19-
public function test_run_configurator()
19+
public function test_run_laravel_git_hooks()
2020
{
21-
$configurator = $this->makeConfigurator();
21+
$laravelGitHooks = $this->makeLaravelGitHooks();
2222

23-
$configurator
23+
$laravelGitHooks
2424
->expects('run');
2525

2626
$command = new RegisterHooks();
@@ -30,7 +30,7 @@ public function test_run_configurator()
3030
$output->expects('writeLn')
3131
->with('<info>Git hooks have been successfully created</info>', 32);
3232

33-
$command->handle($configurator);
33+
$command->handle($laravelGitHooks);
3434

3535
$this->assertTrue(true);
3636
}

tests/ConfiguratorTest.php renamed to tests/LaravelGitHooksTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Igorsgm\LaravelGitHooks\Tests;
44

5-
use Igorsgm\LaravelGitHooks\Configurator;
5+
use Igorsgm\LaravelGitHooks\LaravelGitHooks;
66
use Igorsgm\LaravelGitHooks\Contracts\HookStorage;
77
use Mockery;
88

9-
class ConfiguratorTest extends TestCase
9+
class LaravelGitHooksTest extends TestCase
1010
{
1111
public function test_files_for_hooks_should_be_created()
1212
{
@@ -33,12 +33,12 @@ public function test_files_for_hooks_should_be_created()
3333
EOL
3434
);
3535

36-
$configurator = new Configurator($app, $storage, [
36+
$laravelGitHooks = new LaravelGitHooks($app, $storage, [
3737
'pre-commit',
3838
'post-commit',
3939
]);
4040

41-
$configurator->run();
41+
$laravelGitHooks->run();
4242

4343
$this->assertTrue(true);
4444
}

tests/TestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Igorsgm\LaravelGitHooks\Tests;
44

55
use Igorsgm\LaravelGitHooks\Contracts\CommitMessageStorage;
6-
use Igorsgm\LaravelGitHooks\Contracts\Configurator;
6+
use Igorsgm\LaravelGitHooks\LaravelGitHooks;
77
use Igorsgm\LaravelGitHooks\Tests\Concerns\WithTmpFiles;
88
use Illuminate\Contracts\Config\Repository;
99
use Illuminate\Contracts\Foundation\Application;
@@ -88,11 +88,11 @@ protected function makeApplication()
8888
}
8989

9090
/**
91-
* @return Configurator|Mockery\LegacyMockInterface|Mockery\MockInterface
91+
* @return LaravelGitHooks|Mockery\LegacyMockInterface|Mockery\MockInterface
9292
*/
93-
protected function makeConfigurator()
93+
protected function makeLaravelGitHooks()
9494
{
95-
return Mockery::mock(Configurator::class);
95+
return Mockery::mock(LaravelGitHooks::class);
9696
}
9797

9898
/**

0 commit comments

Comments
 (0)