Format php files

This commit is contained in:
Giuseppe Criscione 2024-04-27 13:06:15 +02:00
parent 085cef77a7
commit a18df4a0f8
100 changed files with 424 additions and 468 deletions

View File

@ -24,5 +24,4 @@ return function (App $app) {
throw new ValidationException(sprintf('Invalid value for field "%s" of type "%s"', $field->name(), $field->type()));
},
];
};

View File

@ -48,5 +48,4 @@ return function (Languages $languages) {
}
},
];
};

View File

@ -30,5 +30,4 @@ return function (App $app) {
return $value;
},
];
};

View File

@ -20,5 +20,4 @@ return function (App $app) {
'names' => LanguageCodes::names(),
],
];
};

View File

@ -36,5 +36,4 @@ return function (App $app) {
return $value;
},
];
};

View File

@ -24,5 +24,4 @@ return function (App $app) {
return $value;
},
];
};

View File

@ -46,5 +46,4 @@ return function (Site $site) {
return str_replace("\r\n", "\n", (string) $value);
},
];
};

View File

@ -32,5 +32,4 @@ return function (App $app) {
return (string) $value;
},
];
};

View File

@ -30,5 +30,4 @@ return function (App $app) {
return $value;
},
];
};

View File

@ -37,5 +37,4 @@ return function (App $app) {
return array_values(array_filter($value));
},
];
};

View File

@ -32,5 +32,4 @@ return function (App $app) {
return (string) $value;
},
];
};

View File

@ -27,5 +27,4 @@ return function (App $app) {
return str_replace("\r\n", "\n", (string) $value);
},
];
};

View File

@ -14,7 +14,6 @@ class ErrorHandlers
{
public function __construct(protected ViewFactory $viewFactory, protected Request $request)
{
}
/**

View File

@ -11,7 +11,6 @@ class FieldFactory
{
public function __construct(protected Container $container, protected Config $config, protected Translations $translations)
{
}
/**

View File

@ -163,7 +163,6 @@ class File implements Arrayable, Stringable
return $this->hash = $hash;
}
throw new RuntimeException('Cannot calculate file hash');
}
public function setUriGenerator(FileUriGenerator $uriGenerator): void

View File

@ -14,7 +14,6 @@ class FileFactory
*/
public function __construct(protected Container $container, protected array $associations = [])
{
}
public function make(string $path): File

View File

@ -14,7 +14,6 @@ class FileUploader
{
public function __construct(protected Config $config)
{
}
/**

View File

@ -13,7 +13,6 @@ class FileUriGenerator
{
public function __construct(protected Config $config, protected Router $router, protected Site $site)
{
}
public function generate(File $file): string

View File

@ -35,8 +35,10 @@ class JpegHandler extends AbstractHandler
];
foreach ($this->decoder->decode($this->data) as $segment) {
if ($segment['type'] > 0xbf && $segment['type'] < 0xc3
|| $segment['type'] > 0xc8 && $segment['type'] < 0xcc) {
if (
$segment['type'] > 0xbf && $segment['type'] < 0xc3
|| $segment['type'] > 0xc8 && $segment['type'] < 0xcc
) {
$info['colorDepth'] = ord($segment['value'][0]);
$info['height'] = unpack('n', $segment['value'], 1)[1];
$info['width'] = unpack('n', $segment['value'], 3)[1];

View File

@ -9,7 +9,6 @@ class Desaturate extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class EdgeDetect extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Emboss extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Invert extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Sharpen extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Smoothen extends AbstractTransform
{
final public function __construct()
{
}
public static function fromArray(array $data): static

View File

@ -8,7 +8,6 @@ class TemplateFactory
{
public function __construct(protected Container $container)
{
}
public function make(string $name): Template

View File

@ -72,7 +72,6 @@ class BackupController extends AbstractController
return $this->redirectToReferer(default: '/dashboard/');
}
throw new RuntimeException($this->translate('panel.backup.error.cannotDelete.invalidFilename'));
} catch (TranslatedException $e) {
$this->panel()->notify($this->translate('panel.backup.error.cannotDelete', $e->getTranslatedMessage()), 'error');
return $this->redirectToReferer(default: '/dashboard/');

View File

@ -130,7 +130,6 @@ class PagesController extends AbstractController
throw new UnexpectedValueException('Unexpected missing page route');
}
return $this->redirect($this->generateRoute('panel.pages.edit.lang', ['page' => trim($page->route(), '/'), 'language' => $this->site()->languages()->default()]));
}
if ($page->languages()->available()->has($language)) {
@ -334,7 +333,6 @@ class PagesController extends AbstractController
} catch (TranslatedException $e) {
$this->panel()->notify($this->translate('upload.error', $e->getTranslatedMessage()), 'error');
return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')]));
}
}
@ -365,7 +363,6 @@ class PagesController extends AbstractController
$this->panel()->notify($this->translate('panel.pages.page.fileDeleted'), 'success');
return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')]));
}
/**

View File

@ -196,7 +196,6 @@ class UsersController extends AbstractController
$userData = [...$user->toArray(), ...$data];
Yaml::encodeToFile($userData, FileSystem::joinPaths($this->config->get('system.panel.paths.accounts'), $user->username() . '.yaml'));
}
/**

View File

@ -8,7 +8,6 @@ class UserFactory
{
public function __construct(protected Container $container)
{
}
/**

View File

@ -24,7 +24,6 @@ class Schemes
public function __construct(protected Container $container)
{
}
/**

View File

@ -166,13 +166,10 @@ class Container
$loaderInstance = $this->build($loader, $parameters);
$service = $loaderInstance->load($this);
} elseif ($object === null) {
$service = $this->build($name, $parameters);
} elseif ($object instanceof Closure) {
$service = $this->call($object, $parameters);
} else {
$service = $object;
}

View File

@ -12,7 +12,6 @@ class LanguagesServiceLoader implements ServiceLoaderInterface
{
public function __construct(protected Config $config, protected Request $request)
{
}
public function load(Container $container): Languages

View File

@ -13,7 +13,6 @@ class SchemesServiceLoader implements ResolutionAwareServiceLoaderInterface
{
public function __construct(protected Config $config, protected Languages $languages)
{
}
public function load(Container $container): object

View File

@ -15,7 +15,6 @@ class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface
{
public function __construct(protected Config $config, protected Languages $languages, protected Schemes $schemes)
{
}
public function load(Container $container): Site
@ -28,7 +27,6 @@ class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface
'path' => $this->config->get('system.content.path'),
'languages' => $this->languages,
] + $config]);
}
/**

View File

@ -12,7 +12,6 @@ class TranslationsServiceLoader implements ResolutionAwareServiceLoaderInterface
{
public function __construct(protected Config $config, protected Languages $languages)
{
}
public function load(Container $container): object

View File

@ -204,7 +204,6 @@ class Debug
. ($reference ? '<span class="__note" title="Reference">&</span>' : '')
. static::outputData($value, $indent + self::INDENT_SPACES)
. ',';
}
return sprintf("<span class=\"__type-array\">array</span>(<span class=\"__note\">%d</span>) [<span class=\"__formwork-dump-toggle\" onclick=\"__formwork_dump_toggle(this)\" data-target=\"__formwork-dump-id-%2\$d\">▼</span>\n<div class=\"__formwork-dump-collapsed\" id=\"__formwork-dump-id-%d\">%s</div>%s]", count($data), ++static::$counter, implode("\n", $parts), str_repeat(' ', $indent));

View File

@ -157,7 +157,6 @@ class MimeType
$mimeType = static::fromExtension('svg');
}
}
}
return $mimeType ?: self::DEFAULT_MIME_TYPE;

View File

@ -13,7 +13,6 @@ class ViewFactory
*/
public function __construct(protected array $methods, protected App $app, protected Config $config)
{
}
/**

View File

@ -1,3 +1,4 @@
</div>
</body>
</html>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title><?= $message ?? 'Internal Server Error' ?> | Formwork</title>
<meta charset="utf-8">
@ -19,7 +20,8 @@
text-align: center;
}
h1, h2 {
h1,
h2 {
margin-top: 0;
letter-spacing: -0.027rem;
line-height: 1.2;
@ -71,6 +73,7 @@
}
</style>
</head>
<body>
<div class="container">
<h1>

View File

@ -10,5 +10,4 @@ return function (Config $config, Panel $panel) {
'icon' => fn (string $icon) => FileSystem::read(FileSystem::joinPaths($config->get('system.panel.paths.assets'), '/icons/svg/', $icon . '.svg')),
];
};

View File

@ -13,4 +13,3 @@
'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(),
]) ?>>

View File

@ -7,25 +7,13 @@
'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(),
]) ?>>
<?php
if (!$field->isRequired()):
?>
<?php if (!$field->isRequired()) : ?>
<option value="" <?php if ($field->value() === '') : ?> selected<?php endif ?>><?= $this->translate('page.none') ?></option>
<?php
endif
?>
<?php
if ($field->get('allowSite')):
?>
<?php endif ?>
<?php if ($field->get('allowSite')) : ?>
<option value="." <?php if ($field->value() === '.') : ?> selected<?php endif ?>><?= $this->translate('panel.pages.newPage.site') ?> (/)</option>
<?php
endif
?>
<?php
foreach ($field->collection() as $page):
?>
<?php endif ?>
<?php foreach ($field->collection() as $page) : ?>
<option value="<?= $page->route() ?>" <?php if ($page->route() === $field->value()) : ?> selected<?php endif ?>><?= str_repeat('— ', $page->level() - 1) . $page->title() ?></option>
<?php
endforeach
?>
<?php endforeach ?>
</select>

View File

@ -1,6 +1,8 @@
<div id="slugModal" class="modal" aria-labelledby="slugModalLabel">
<div class="modal-container">
<div class="modal-header"><div class="caption" id="slugModalLabel"><?= $this->translate('panel.pages.changeSlug') ?></div></div>
<div class="modal-header">
<div class="caption" id="slugModalLabel"><?= $this->translate('panel.pages.changeSlug') ?></div>
</div>
<div class="modal-content">
<label class="form-label" for="page-slug"><?= $this->translate('panel.pages.newPage.slug') ?>:</label>
<span class="form-label-suggestion">(<?= $this->translate('panel.pages.newPage.slugSuggestion') ?>)</span>

View File

@ -13,4 +13,3 @@
<?php $this->insert('fields', ['fields' => $fields]) ?>
</div>
</form>

View File

@ -1,2 +1,4 @@
<script src="<?= $this->assets()->uri('js/app.min.js', true) ?>" integrity="<?= $this->assets()->integrityHash('js/app.min.js') ?>"></script>
<script>Formwork.app.load(<?= $appConfig ?>);</script>
<script>
Formwork.app.load(<?= $appConfig ?>);
</script>

View File

@ -5,7 +5,8 @@ $posts = $page->children()->published();
// If the route has the param `{tagName}`
if ($router->params()->has('tagName')) {
$posts = $posts->filterBy('tags', // Filter posts by tags...
$posts = $posts->filterBy(
'tags', // Filter posts by tags...
fn ($tags) => $tags
->map(fn ($tag) => $this->slug($tag)) // where the collection of their slugs...
->contains($router->params()->get('tagName')) // contains the value of the `tagName` param.

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="<?= $site->languages()->current() ?>">
<head>
<title><?= $page->title() ?> | <?= $site->title() ?></title>
<?= $this->insert('_meta') ?>
@ -7,6 +8,7 @@
<link rel="stylesheet" type="text/css" href="<?= $this->assets()->uri('css/style.min.css') ?>">
<script src="<?= $this->assets()->uri('js/script.min.js') ?>"></script>
</head>
<body>
<?= $this->insert('_menu') ?>
<?= $this->insert('_cover-image') ?>
@ -17,4 +19,5 @@
</div>
</footer>
</body>
</html>