Skip to content

Commit d4e4d5d

Browse files
lukasleitschgithub-actions[bot]
authored andcommitted
Apply pint changes
1 parent 5cc550b commit d4e4d5d

File tree

8 files changed

+23
-19
lines changed

8 files changed

+23
-19
lines changed

helpers.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
/**
88
* Render a blade component.
9-
* @param string $name Component name, exclude component folder (i.e use "card" instead of "components.card")
10-
* @param array $props Component properties
11-
* @param array $attributes Component attributes
9+
*
10+
* @param string $name Component name, exclude component folder (i.e use "card" instead of "components.card")
11+
* @param array $props Component properties
12+
* @param array $attributes Component attributes
1213
* @return \Illuminate\Contracts\View\View
1314
*/
1415
if (! function_exists('component')) {

index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
use Leitsch\Blade\Snippet;
99
use Leitsch\Blade\Template;
1010

11-
@include_once __DIR__ . '/vendor/autoload.php';
11+
@include_once __DIR__.'/vendor/autoload.php';
1212

1313
Kirby::plugin('leitsch/blade', [
1414
'options' => [
1515
'views' => function () {
16-
return kirby()->roots()->cache() . '/views';
16+
return kirby()->roots()->cache().'/views';
1717
},
1818
'directives' => [],
1919
'ifs' => [],
2020
],
2121
'components' => [
22-
'template' => function (Kirby $kirby, string $name, string $contentType = null) {
22+
'template' => function (Kirby $kirby, string $name, ?string $contentType = null) {
2323
return new Template($kirby, $name, $contentType);
2424
},
2525
'snippet' => function (Kirby $kirby, $name, array $data = []): ?string {

src/App.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
class App extends Container
88
{
99
/**
10-
* @return string
11-
*
1210
* @see \Illuminate\Contracts\Foundation\Application::getNamespace()
1311
*/
1412
public function getNamespace(): string

src/BladeDirectives.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static function register()
1818

1919
Blade::directive('csrf', function (string $expression) {
2020
if (strlen($expression) === 0) {
21-
return "<?php echo csrf() ?>";
21+
return '<?php echo csrf() ?>';
2222
}
2323

2424
return "<?php echo csrf({$expression}) ?>";
@@ -129,7 +129,7 @@ public static function register()
129129
});
130130

131131
Blade::directive('uuid', function () {
132-
return "<?php echo uuid() ?>";
132+
return '<?php echo uuid() ?>';
133133
});
134134

135135
Blade::directive('video', function (string $expression) {

src/BladeFactory.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public static function register(array $pathsToTemplates, string $pathToCompiledT
4343
$container->instance(Factory::class, $viewFactory);
4444
$container->alias(
4545
Factory::class,
46-
(new class extends View {
46+
(new class extends View
47+
{
4748
public static function getFacadeAccessor()
4849
{
4950
return parent::getFacadeAccessor();
@@ -53,7 +54,8 @@ public static function getFacadeAccessor()
5354
$container->instance(BladeCompiler::class, $bladeCompiler);
5455
$container->alias(
5556
BladeCompiler::class,
56-
(new class extends \Illuminate\Support\Facades\Blade {
57+
(new class extends \Illuminate\Support\Facades\Blade
58+
{
5759
public static function getFacadeAccessor()
5860
{
5961
return parent::getFacadeAccessor();

src/Paths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static function getPathTemplates(): string
1313
}
1414

1515
if ($path !== null) {
16-
return kirby()->roots()->index() . '/' . $path;
16+
return kirby()->roots()->index().'/'.$path;
1717
}
1818

1919
return kirby()->root('templates');

src/Snippet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function load(): string
3737

3838
public function getFile(string $name): ?string
3939
{
40-
$bladeFile = $this->kirby->root('snippets') . '/' . $name . '.' . Template::EXTENSION_BLADE;
41-
$fallbackFile = $this->kirby->root('snippets') . '/' . $name . '.' . Template::EXTENSION_FALLBACK;
40+
$bladeFile = $this->kirby->root('snippets').'/'.$name.'.'.Template::EXTENSION_BLADE;
41+
$fallbackFile = $this->kirby->root('snippets').'/'.$name.'.'.Template::EXTENSION_FALLBACK;
4242

4343
// blade snippet exists
4444
if (file_exists($bladeFile)) {

src/Template.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
use Exception;
66
use Illuminate\Support\Facades\View;
77
use Kirby\Cms\App;
8-
use Kirby\Template\Template as KirbyTemplate;
98
use Kirby\Filesystem\F;
9+
use Kirby\Template\Template as KirbyTemplate;
1010
use Kirby\Toolkit\Tpl;
1111

1212
class Template extends KirbyTemplate
1313
{
1414
public const EXTENSION_BLADE = 'blade.php';
15+
1516
public const EXTENSION_FALLBACK = 'php';
1617

1718
protected string $templatesPath;
19+
1820
protected string $viewsPath;
21+
1922
protected ?string $extension = null;
2023

2124
public function __construct(App $kirby, string $name, string $type = 'html', string $defaultType = 'html')
@@ -78,7 +81,7 @@ public function file(): ?string
7881
if ($this->type() === 'blade') {
7982
return null;
8083
} else {
81-
$name = $this->name() . "." . $this->type();
84+
$name = $this->name().'.'.$this->type();
8285
}
8386

8487
return $this->getFilename($name);
@@ -88,14 +91,14 @@ public function getFilename(string $name): ?string
8891
{
8992
try {
9093
// Try the default blade template in the default template directory.
91-
return F::realpath("{$this->templatesPath}/{$name}." . self::EXTENSION_BLADE, $this->templatesPath);
94+
return F::realpath("{$this->templatesPath}/{$name}.".self::EXTENSION_BLADE, $this->templatesPath);
9295
} catch (Exception) {
9396
// ignore errors, continue searching
9497
}
9598

9699
try {
97100
// Try the default vanilla php template in the default template directory.
98-
return F::realpath("{$this->templatesPath}/{$name}." . self::EXTENSION_FALLBACK, $this->templatesPath);
101+
return F::realpath("{$this->templatesPath}/{$name}.".self::EXTENSION_FALLBACK, $this->templatesPath);
99102
} catch (Exception) {
100103
// ignore errors, continue searching
101104
}

0 commit comments

Comments
 (0)