Skip to content

Commit ef14f96

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent da85356 commit ef14f96

29 files changed

Lines changed: 166 additions & 173 deletions

File tree

config/inspirecms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
'permissions' => [
168168
'skip_access_right_permission_on_resource' => false,
169169
'guard_actions' => [
170-
170+
171171
],
172172
'guard_widgets' => [
173173
\SolutionForest\InspireCms\Filament\Widgets\CmsInfoWidget::class,

database/seeders/SampleSeeder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ protected function getSampleDocumentTypes()
392392
->merge($allSlugs)
393393
->unique()
394394
->filter()
395-
->where(fn ($slug) => !in_array($slug, [
396-
'homepage', //self
395+
->where(fn ($slug) => ! in_array($slug, [
396+
'homepage', // self
397397
'case-study',
398398
'blog',
399399
]))

resources/lang/en/resources/document-type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
'label' => 'Inheriting to :name',
6060
'description' => 'The document types that inherit from this document type.',
6161
],
62-
62+
6363
'allowed_document_types' => [
6464
'label' => 'Allowed document types',
6565
'description' => 'The document types that are allowed as child items.',

resources/lang/zh_TW/resources/document-type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
'label' => '繼承至 :name',
6060
'description' => '繼承此文件類型的文件類型。',
6161
],
62-
62+
6363
'allowed_document_types' => [
6464
'label' => '允許的文件類型',
6565
'description' => '作為子項允許的文件類型。',

src/Base/Enums/CacheKeys.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ enum CacheKeys: string
66
{
77
case CURRENT_THEME = 'current_theme';
88
}
9-

src/Base/KeyValueCache.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class KeyValueCache
2424
protected $cacheExpirationTime;
2525

2626
/**
27-
* @param CacheManager $cacheManager
27+
* @param CacheManager $cacheManager
2828
*/
29-
public function __construct($cacheManager, \DateInterval|int|null $ttl = null)
29+
public function __construct($cacheManager, \DateInterval | int | null $ttl = null)
3030
{
3131
$this->cacheManager = $cacheManager;
3232
$this->cacheExpirationTime = $ttl ?? InspireCmsConfig::get('cache.key_value.ttl') ?? \DateInterval::createFromDateString('24 hours');
@@ -39,47 +39,46 @@ public function cacheAll(): void
3939
{
4040
$model = $this->attemptRetrieveModel();
4141

42-
if (!$model) {
42+
if (! $model) {
4343
return;
4444
}
4545

4646
$keyValues = $model::all();
47-
47+
4848
foreach ($keyValues as $keyValue) {
4949
$this->set($keyValue->key, $keyValue->value);
5050
}
5151
}
5252

5353
/**
5454
* Get a value by key from cache or database
55-
*
56-
* @param string $key
57-
* @param mixed $default
55+
*
56+
* @param mixed $default
5857
* @return mixed
5958
*/
6059
public function get(string $key, $default = null)
6160
{
6261
$model = $this->attemptRetrieveModel();
6362

64-
if (!$model) {
63+
if (! $model) {
6564
return;
6665
}
6766

6867
return $this->cacheManager->remember(
6968
$this->getCacheKey($key),
70-
$this->cacheExpirationTime,
69+
$this->cacheExpirationTime,
7170
function () use ($key, $default, $model) {
7271
$keyValue = $model::findKeyValue($key);
72+
7373
return $keyValue ? $keyValue->value : $default;
7474
}
7575
);
7676
}
7777

7878
/**
7979
* Set a value in the cache
80-
*
81-
* @param string $key
82-
* @param mixed $value
80+
*
81+
* @param mixed $value
8382
*/
8483
public function set(string $key, $value): void
8584
{
@@ -101,12 +100,12 @@ public function clear(): void
101100
{
102101
$model = $this->attemptRetrieveModel();
103102

104-
if (!$model) {
103+
if (! $model) {
105104
return;
106105
}
107106

108107
$keyValues = $model::all();
109-
108+
110109
foreach ($keyValues as $keyValue) {
111110
$this->forget($keyValue->key);
112111
}
@@ -123,7 +122,7 @@ protected function getCacheKey(string $key): string
123122
/**
124123
* @return bool|class-string<Model & KeyValue>
125124
*/
126-
protected function attemptRetrieveModel(): bool|string
125+
protected function attemptRetrieveModel(): bool | string
127126
{
128127
try {
129128
$model = InspireCmsConfig::getKeyValueModelClass();
@@ -140,4 +139,4 @@ protected function attemptRetrieveModel(): bool|string
140139
return false;
141140
}
142141
}
143-
}
142+
}

src/Base/TemplateManager.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TemplateManager implements TemplateManagerInterface
1414
protected ?string $theme = null;
1515

1616
protected array $themes = [];
17-
17+
1818
public function __construct()
1919
{
2020
$this->loadCurrentTheme();
@@ -77,15 +77,17 @@ public function getComponentDirectoryForTheme(?string $theme = null, ?string $co
7777
$componentPrefix = static::getComponentPrefix();
7878

7979
$theme ??= static::getCurrentTheme();
80-
80+
8181
$relativePath = str($theme)
8282
->when(filled($componentPrefix), fn ($str) => $str->prepend($componentPrefix . '.'))
8383
->trim('.')
8484
->replace('.', '/')
8585
->trim('/')
86-
->when(filled($component), fn ($str) => $str
87-
->finish('/')
88-
->finish(str($component)->trim()->trim('.')->finish('.blade.php'))
86+
->when(
87+
filled($component),
88+
fn ($str) => $str
89+
->finish('/')
90+
->finish(str($component)->trim()->trim('.')->finish('.blade.php'))
8991
)
9092
->toString();
9193

@@ -109,6 +111,7 @@ public function assignDefaultTemplateIfNotSet($templateable, $template)
109111
public function retrieveDefaultContent()
110112
{
111113
$componentName = static::getDefaultLayoutComponentName();
114+
112115
return <<<HTML
113116
@php
114117
\$locale ??= \$content->getLocale();
@@ -159,7 +162,7 @@ public function ensureThemeLayoutComponentExists(string $theme, ?string $compone
159162
// create directory if not exists
160163
FileHelper::ensureDirectoryExists(dirname($fullPath));
161164

162-
if (!file_exists($fullPath)) {
165+
if (! file_exists($fullPath)) {
163166
$content = $this->retrieveDefaultLayoutContent();
164167

165168
file_put_contents($fullPath, $content);

src/Base/TemplateManagerInterface.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function resetCurrentTheme(): void;
2626
public function getComponentPrefix(): string;
2727

2828
public function getComponentWithTheme(string $component, ?string $theme = null): string;
29-
29+
3030
public function getComponentDirectoryForTheme(?string $theme = null, ?string $component = null): string;
3131

3232
public function getThemeDefaultLayoutPath(?string $theme = null): string;
@@ -63,9 +63,8 @@ public function getExportedTemplateDir(): string;
6363
*
6464
* This method checks if the specified theme layout component exists. If not, will create it.
6565
*
66-
* @param string $theme The name of the theme.
67-
* @param string|null $component The name of the component. If null, a default component will be used.
68-
* @return void
66+
* @param string $theme The name of the theme.
67+
* @param string|null $component The name of the component. If null, a default component will be used.
6968
*/
7069
public function ensureThemeLayoutComponentExists(string $theme, ?string $component = null): void;
7170
}

src/Commands/ImportDefaultData.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use SolutionForest\InspireCms\Helpers\PermissionHelper;
1010
use SolutionForest\InspireCms\Helpers\TemplateHelper;
1111
use SolutionForest\InspireCms\InspireCmsConfig;
12-
use SolutionForest\InspireCms\Models\Contracts\KeyValue;
1312
use Symfony\Component\Console\Attribute\AsCommand;
1413

1514
#[AsCommand(name: 'inspirecms:import-default-data', description: 'Import default data for InspireCMS')]

src/Facades/KeyValueCache.php

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

33
namespace SolutionForest\InspireCms\Facades;
44

5-
65
use Illuminate\Support\Facades\Facade;
76

87
/**
@@ -23,4 +22,4 @@ protected static function getFacadeAccessor()
2322
{
2423
return \SolutionForest\InspireCms\Base\KeyValueCache::class;
2524
}
26-
}
25+
}

0 commit comments

Comments
 (0)