Skip to content

Commit 0665f13

Browse files
Merge pull request #78 from hexadog/develop
Develop
2 parents c1237f6 + 7296907 commit 0665f13

File tree

12 files changed

+660
-785
lines changed

12 files changed

+660
-785
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"require-dev": {
2323
"phpunit/phpunit": "^7.0|^8.0|^9.0|^10.0",
2424
"laravel/pint": "^1.10",
25-
"nunomaduro/larastan": "^2.0",
2625
"orchestra/testbench": "^8.3"
2726
},
2827
"autoload": {

composer.lock

Lines changed: 620 additions & 751 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

helpers/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function page_title(string $title, bool $withAppName = true, string $separator =
3030
/**
3131
* Set theme.
3232
*/
33-
function theme(string $themeName = null): Hexadog\ThemesManager\Theme
33+
function theme(?string $themeName = null): Hexadog\ThemesManager\Theme
3434
{
3535
if ($themeName) {
3636
\Theme::set($themeName);

src/Components/PageTitle.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ public function __construct(mixed $title = null, mixed $withAppName = true, mixe
2323
$title = View::getSection('title');
2424
}
2525

26-
if (! empty($title) && $withAppName) {
27-
if ($invert) {
26+
if (! empty($title)) {
27+
if (! filter_var($withAppName, FILTER_VALIDATE_BOOLEAN)) {
28+
$this->title = $title;
29+
} elseif ($invert) {
2830
$this->title = $title . ' ' . trim(e($separator)) . ' ' . config('app.name');
2931
} else {
3032
$this->title = config('app.name') . ' ' . trim(e($separator)) . ' ' . $title;

src/Events/ThemeDisabled.php

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

55
namespace Hexadog\ThemesManager\Events;
66

7+
use Hexadog\ThemesManager\Theme;
8+
79
class ThemeDisabled
810
{
9-
public array|string $theme;
11+
public Theme $theme;
1012

11-
public function __construct($theme)
13+
public function __construct(Theme $theme)
1214
{
1315
$this->theme = $theme;
1416
}

src/Events/ThemeDisabling.php

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

55
namespace Hexadog\ThemesManager\Events;
66

7+
use Hexadog\ThemesManager\Theme;
8+
79
class ThemeDisabling
810
{
9-
public array|string $theme;
11+
public Theme $theme;
1012

11-
public function __construct($theme)
13+
public function __construct(Theme $theme)
1214
{
1315
$this->theme = $theme;
1416
}

src/Events/ThemeEnabled.php

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

55
namespace Hexadog\ThemesManager\Events;
66

7+
use Hexadog\ThemesManager\Theme;
8+
79
class ThemeEnabled
810
{
9-
public array|string $theme;
11+
public Theme $theme;
1012

11-
public function __construct($theme)
13+
public function __construct(Theme $theme)
1214
{
1315
$this->theme = $theme;
1416
}

src/Events/ThemeEnabling.php

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

55
namespace Hexadog\ThemesManager\Events;
66

7+
use Hexadog\ThemesManager\Theme;
8+
79
class ThemeEnabling
810
{
9-
public array|string $theme;
11+
public Theme $theme;
1012

11-
public function __construct($theme)
13+
public function __construct(Theme $theme)
1214
{
1315
$this->theme = $theme;
1416
}

src/Helpers/Json.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class Json
2929
/**
3030
* The constructor.
3131
*/
32-
public function __construct(string $path, Filesystem $filesystem = null)
32+
public function __construct(string $path, ?Filesystem $filesystem = null)
3333
{
3434
$this->path = $path;
3535
$this->filesystem = $filesystem ? $filesystem : new Filesystem();
@@ -103,7 +103,7 @@ public function setPath(string $path): Json
103103
/**
104104
* Make new instance.
105105
*/
106-
public static function make(string $path, Filesystem $filesystem = null): Json
106+
public static function make(string $path, ?Filesystem $filesystem = null): Json
107107
{
108108
return new self($path, $filesystem);
109109
}
@@ -136,7 +136,7 @@ public function getAttributes(): array
136136
/**
137137
* Convert the given array data to pretty json.
138138
*/
139-
public function toJsonPretty(array $data = null): false|string
139+
public function toJsonPretty(?array $data = null): false|string
140140
{
141141
return json_encode($data ? $data : $this->attributes, JSON_PRETTY_PRINT);
142142
}

src/Http/Middleware/ThemeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ThemeLoader
1212
/**
1313
* Handle an incoming request.
1414
*/
15-
public function handle(Request $request, \Closure $next, string $theme = null)
15+
public function handle(Request $request, \Closure $next, ?string $theme = null)
1616
{
1717
// Do not load theme if API request or App is running in console
1818
if ($request->expectsJson() || app()->runningInConsole()) {

0 commit comments

Comments
 (0)