Skip to content

Commit d1e2f03

Browse files
Merge pull request #23 from hexadog/develop
Develop
2 parents 8082e93 + 65bc44a commit d1e2f03

21 files changed

+208
-135
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check and fix code styling with php-cs-fixer
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
style:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
with:
15+
ref: ${{ github.head_ref }}
16+
17+
- name: Run php-cs-fixer
18+
uses: docker://oskarstark/php-cs-fixer-ga
19+
with:
20+
args: --config=.php_cs.dist --allow-risky=yes
21+
22+
- name: Commit changes
23+
uses: stefanzweifel/git-auto-commit-action@v4.10.0
24+
with:
25+
commit_message: Automatically applied php-cs-fixer changes

.php_cs.dist

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('vendor/*')
5+
->notPath('resources/*')
6+
->notPath('database/*')
7+
->notPath('storage/*')
8+
->notPath('node_modules/*')
9+
->in([
10+
__DIR__ . '/config',
11+
__DIR__ . '/src',
12+
])
13+
->name('*.php')
14+
->notName('*.blade.php')
15+
->ignoreDotFiles(true)
16+
->ignoreVCS(true);
17+
18+
return PhpCsFixer\Config::create()
19+
->setRules([
20+
'@PSR2' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
23+
'no_unused_imports' => true,
24+
'not_operator_with_successor_space' => true,
25+
'trailing_comma_in_multiline_array' => true,
26+
'phpdoc_scalar' => true,
27+
'unary_operator_spaces' => true,
28+
'binary_operator_spaces' => true,
29+
'blank_line_before_statement' => [
30+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
31+
],
32+
'phpdoc_single_line_var_spacing' => true,
33+
'phpdoc_var_without_name' => true,
34+
'class_attributes_separation' => [
35+
'elements' => [
36+
'method',
37+
],
38+
],
39+
'method_argument_space' => [
40+
'on_multiline' => 'ensure_fully_multiline',
41+
'keep_multiple_spaces_after_comma' => true,
42+
],
43+
'single_trait_insert_per_statement' => true,
44+
])
45+
->setFinder($finder);

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"illuminate/view": "^7.0|^8.0"
1717
},
1818
"require-dev": {
19+
"friendsofphp/php-cs-fixer": "^2.18",
1920
"squizlabs/php_codesniffer": "3.*",
2021
"phpunit/phpunit": "^7.0|^8.0|^9.0",
2122
"orchestra/testbench": "~5.2"
@@ -48,6 +49,6 @@
4849
"test": "vendor/bin/phpunit",
4950
"test:windows": "vendor\\bin\\phpunit",
5051
"check-style": "vendor/bin/phpcs --extensions=php ./src",
51-
"fix-style": "vendor/bin/phpcbf --extensions=php ./src"
52+
"fix-style": "vendor/bin/php-cs-fixer fix"
5253
}
5354
}

config/config.php

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
11
<?php
22

33
return [
4-
/*
5-
|--------------------------------------------------------------------------
6-
| Path to lookup theme
7-
|--------------------------------------------------------------------------
8-
|
9-
| The root path contains themes collections.
10-
|
11-
*/
12-
'directory' => env('THEMES_DIR', 'themes'),
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Path to lookup theme
7+
|--------------------------------------------------------------------------
8+
|
9+
| The root path contains themes collections.
10+
|
11+
*/
12+
'directory' => env('THEMES_DIR', 'themes'),
1313

14-
/*
14+
/*
1515
|--------------------------------------------------------------------------
1616
| Symbolic link path
1717
|--------------------------------------------------------------------------
1818
|
1919
| you can change the public themes path used for assets.
2020
|
2121
*/
22-
'symlink_path' => 'themes',
22+
'symlink_path' => 'themes',
2323

24-
/*
24+
/*
2525
|--------------------------------------------------------------------------
2626
| Symbolic link relative
2727
|--------------------------------------------------------------------------
2828
|
2929
| Determine if relative symlink should be used instead of absolute one.
3030
|
3131
*/
32-
'symlink_relative' => false,
32+
'symlink_relative' => false,
3333

34-
/*
35-
|--------------------------------------------------------------------------
36-
| Fallback Theme
37-
|--------------------------------------------------------------------------
38-
|
39-
| If you don't set a theme at runtime (through middleware for example)
40-
| the fallback theme will be used automatically.
41-
|
42-
*/
43-
'fallback_theme' => null,
34+
/*
35+
|--------------------------------------------------------------------------
36+
| Fallback Theme
37+
|--------------------------------------------------------------------------
38+
|
39+
| If you don't set a theme at runtime (through middleware for example)
40+
| the fallback theme will be used automatically.
41+
|
42+
*/
43+
'fallback_theme' => null,
4444

45-
/*
45+
/*
4646
|--------------------------------------------------------------------------
4747
| Caching
4848
|--------------------------------------------------------------------------
4949
|
5050
| Config for caching feature.
5151
|
5252
*/
53-
'cache' => [
54-
'enabled' => false,
55-
'key' => 'themes-manager',
56-
'lifetime' => 86400,
57-
],
53+
'cache' => [
54+
'enabled' => false,
55+
'key' => 'themes-manager',
56+
'lifetime' => 86400,
57+
],
5858

59-
/*
59+
/*
6060
|--------------------------------------------------------------------------
6161
| Composer File Template
6262
|--------------------------------------------------------------------------
6363
|
64-
| Config for composer.json file, generated for new theme
65-
| If null then information will be asked at generation process
66-
| If not null, values will be used at generation process
64+
| Config for composer.json file, generated for new theme
65+
| If null then information will be asked at generation process
66+
| If not null, values will be used at generation process
6767
|
6868
*/
69-
'composer' => [
70-
'vendor' => null,
71-
'author' => [
72-
'name' => null,
73-
'email' => null,
74-
],
75-
],
69+
'composer' => [
70+
'vendor' => null,
71+
'author' => [
72+
'name' => null,
73+
'email' => null,
74+
],
75+
],
7676
];

src/Components/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Hexadog\ThemesManager\Components;
44

5-
use ThemesManager;
65
use Illuminate\View\Component;
6+
use ThemesManager;
77

88
class Image extends Component
99
{

src/Components/PageTitle.php

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

33
namespace Hexadog\ThemesManager\Components;
44

5-
use Illuminate\View\Component;
65
use Illuminate\Support\Facades\View;
6+
use Illuminate\View\Component;
77

88
class PageTitle extends Component
99
{
@@ -27,7 +27,7 @@ public function __construct($title = null, $withAppName = true, $separator = '-'
2727
$title = View::getSection('title');
2828
}
2929

30-
if (!empty($title) && $withAppName) {
30+
if (! empty($title) && $withAppName) {
3131
if ($invert) {
3232
$this->title = $title . " " . trim(e($separator)) . " " . config('app.name');
3333
} else {

src/Components/Script.php

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

33
namespace Hexadog\ThemesManager\Components;
44

5-
use ThemesManager;
65
use Illuminate\View\Component;
6+
use ThemesManager;
77

88
class Script extends Component
99
{
@@ -23,7 +23,7 @@ class Script extends Component
2323
*/
2424
public function __construct($src = null, $absolutePath = true)
2525
{
26-
if (!is_null($src)) {
26+
if (! is_null($src)) {
2727
$this->source = ThemesManager::asset($src, $absolutePath);
2828
} else {
2929
$this->source = null;

src/Components/Style.php

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

33
namespace Hexadog\ThemesManager\Components;
44

5-
use ThemesManager;
65
use Illuminate\View\Component;
6+
use ThemesManager;
77

88
class Style extends Component
99
{
@@ -23,7 +23,7 @@ class Style extends Component
2323
*/
2424
public function __construct($src, $absolutePath = true)
2525
{
26-
if (!is_null($src)) {
26+
if (! is_null($src)) {
2727
$this->source = ThemesManager::asset($src, $absolutePath);
2828
} else {
2929
$this->source = null;

src/Console/Commands/AbstractCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
abstract class AbstractCommand extends Command
1010
{
11-
use BlockMessage,
12-
SectionMessage;
11+
use BlockMessage;
12+
use SectionMessage;
1313

1414
/**
1515
* @var mixed
@@ -21,7 +21,7 @@ protected function validateName()
2121
$name = $this->argument('name');
2222

2323
$this->theme = \Theme::get($name);
24-
if (!$this->theme) {
24+
if (! $this->theme) {
2525
$this->error("Theme with name ${name} does not exists!");
2626
exit();
2727
}

src/Console/Commands/ActivateTheme.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Hexadog\ThemesManager\Console\Commands;
44

5-
use Hexadog\ThemesManager\Console\Commands\AbstractCommand;
6-
75
class ActivateTheme extends AbstractCommand
86
{
97
/**

src/Console/Commands/Cache.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Hexadog\ThemesManager\Console\Commands;
44

55
use Hexadog\ThemesManager\Facades\ThemesManager;
6-
use Hexadog\ThemesManager\Console\Commands\AbstractCommand;
76

87
class Cache extends AbstractCommand
98
{

src/Console/Commands/ClearCache.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Hexadog\ThemesManager\Console\Commands;
44

55
use Hexadog\ThemesManager\Facades\ThemesManager;
6-
use Hexadog\ThemesManager\Console\Commands\AbstractCommand;
76

87
class ClearCache extends AbstractCommand
98
{

src/Console/Commands/DeactivateTheme.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Hexadog\ThemesManager\Console\Commands;
44

5-
use Hexadog\ThemesManager\Console\Commands\AbstractCommand;
6-
75
class DeactivateTheme extends AbstractCommand
86
{
97
/**
@@ -38,7 +36,7 @@ public function handle()
3836
{
3937
$this->validateName();
4038

41-
if (!$this->theme->isActive()) {
39+
if (! $this->theme->isActive()) {
4240
$this->error("Theme with name {$this->argument('name')} is already deactivated!");
4341

4442
return false;

src/Console/Commands/ListThemes.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public function handle()
4949

5050
foreach ($themes as $theme) {
5151
$this->themes[] = [
52-
'name' => $theme->getName(),
53-
'vendor' => $theme->getVendor(),
54-
'version' => $theme->get('version'),
55-
'description' => $theme->get('description'),
56-
'extends' => $theme->getParent() ? $theme->getParent() : '',
57-
'default' => $theme->getName() === config('themes-manager.fallback_theme') ? 'X' : '',
58-
'active' => $theme->isActive() ? 'Yes' : 'No',
52+
'name' => $theme->getName(),
53+
'vendor' => $theme->getVendor(),
54+
'version' => $theme->get('version'),
55+
'description' => $theme->get('description'),
56+
'extends' => $theme->getParent() ? $theme->getParent() : '',
57+
'default' => $theme->getName() === config('themes-manager.fallback_theme') ? 'X' : '',
58+
'active' => $theme->isActive() ? 'Yes' : 'No',
5959
];
6060
}
6161

0 commit comments

Comments
 (0)