corvée(formatage) màj de la configuration Mago

This commit is contained in:
gcch 2026-05-02 10:31:24 +02:00
commit 1455d81b3b
33 changed files with 1107 additions and 845 deletions

View file

@ -24,15 +24,13 @@ return new Config()
'blank_line_after_namespace' => true, 'blank_line_after_namespace' => true,
'blank_lines_before_namespace' => ['min_line_breaks' => 1, 'max_line_breaks' => 2], 'blank_lines_before_namespace' => ['min_line_breaks' => 1, 'max_line_breaks' => 2],
'cast_spaces' => true, 'cast_spaces' => true,
'class_attributes_separation' => [ 'class_attributes_separation' => ['elements' => [
'elements' => [
'case' => 'none', 'case' => 'none',
'const' => 'none', 'const' => 'none',
'method' => 'one', 'method' => 'one',
'property' => 'one', 'property' => 'one',
'trait_import' => 'none', 'trait_import' => 'none',
], ]],
],
'class_reference_name_casing' => true, 'class_reference_name_casing' => true,
'clean_namespace' => true, 'clean_namespace' => true,
'combine_consecutive_issets' => true, 'combine_consecutive_issets' => true,
@ -56,7 +54,11 @@ return new Config()
'full_opening_tag' => true, 'full_opening_tag' => true,
'fully_qualified_strict_types' => ['import_symbols' => true], 'fully_qualified_strict_types' => ['import_symbols' => true],
'function_to_constant' => true, 'function_to_constant' => true,
'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], 'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'heredoc_to_nowdoc' => true, 'heredoc_to_nowdoc' => true,
'integer_literal_case' => true, 'integer_literal_case' => true,
'lambda_not_used_import' => true, 'lambda_not_used_import' => true,
@ -75,7 +77,11 @@ return new Config()
'multiline_comment_opening_closing' => true, 'multiline_comment_opening_closing' => true,
'native_constant_invocation' => true, 'native_constant_invocation' => true,
'native_function_casing' => true, 'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true], 'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
],
'native_type_declaration_casing' => true, 'native_type_declaration_casing' => true,
'new_expression_parentheses' => true, 'new_expression_parentheses' => true,
'no_alias_functions' => ['sets' => ['@all']], 'no_alias_functions' => ['sets' => ['@all']],
@ -95,8 +101,7 @@ return new Config()
'no_trailing_comma_in_singleline' => true, 'no_trailing_comma_in_singleline' => true,
'no_trailing_whitespace_in_comment' => true, 'no_trailing_whitespace_in_comment' => true,
'no_unneeded_braces' => ['namespaces' => true], 'no_unneeded_braces' => ['namespaces' => true],
'no_unneeded_control_parentheses' => [ 'no_unneeded_control_parentheses' => ['statements' => [
'statements' => [
'break', 'break',
'clone', 'clone',
'continue', 'continue',
@ -107,8 +112,7 @@ return new Config()
'switch_case', 'switch_case',
'yield', 'yield',
'yield_from', 'yield_from',
], ]],
],
'no_unneeded_final_method' => true, 'no_unneeded_final_method' => true,
'no_unneeded_import_alias' => true, 'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true, 'no_unreachable_default_argument_value' => true,
@ -139,9 +143,11 @@ return new Config()
'pow_to_exponentiation' => true, 'pow_to_exponentiation' => true,
'protected_to_private' => true, 'protected_to_private' => true,
'psr_autoloading' => true, 'psr_autoloading' => true,
'random_api_migration' => [ 'random_api_migration' => ['replacements' => [
'replacements' => ['getrandmax' => 'mt_getrandmax', 'rand' => 'mt_rand', 'srand' => 'mt_srand'], 'getrandmax' => 'mt_getrandmax',
], 'rand' => 'mt_rand',
'srand' => 'mt_srand',
]],
'return_assignment' => true, 'return_assignment' => true,
'self_accessor' => true, 'self_accessor' => true,
'self_static_accessor' => true, 'self_static_accessor' => true,
@ -216,8 +222,7 @@ return new Config()
// The type of @return annotations of methods returning a reference to itself must the configured one. // The type of @return annotations of methods returning a reference to itself must the configured one.
'phpdoc_return_self_reference' => true, 'phpdoc_return_self_reference' => true,
// Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double. // Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double.
'phpdoc_scalar' => [ 'phpdoc_scalar' => ['types' => [
'types' => [
'boolean', 'boolean',
'callback', 'callback',
'double', 'double',
@ -227,8 +232,7 @@ return new Config()
'no-return', 'no-return',
'real', 'real',
'str', 'str',
], ]],
],
// Annotations in PHPDoc should be grouped together so that annotations of the same type immediately follow each other. Annotations of a different type are separated by a single blank line. // Annotations in PHPDoc should be grouped together so that annotations of the same type immediately follow each other. Annotations of a different type are separated by a single blank line.
'phpdoc_separation' => [ 'phpdoc_separation' => [
'groups' => [ 'groups' => [

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@ threads = 0
no-else-clause = { enabled = false } no-else-clause = { enabled = false }
[analyzer] [analyzer]
allow-implicit-pipe-callable-types = false
allow-possibly-undefined-array-keys = false allow-possibly-undefined-array-keys = false
allow-side-effects-in-conditions = true allow-side-effects-in-conditions = true
analyze-dead-code = true analyze-dead-code = true

View file

@ -25,7 +25,7 @@ $templates = ['404.twig'];
function load_page_resources(): void { function load_page_resources(): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-a-propos', handle: 'haiku-atelier-2024-styles-page-a-propos',
path: '/assets/css/pages/page-modele-simple.css', path : '/assets/css/pages/page-modele-simple.css',
); );
} }

View file

@ -40,14 +40,14 @@ $context['page_states'] = $page_states;
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-boutique', handle: 'haiku-atelier-2024-styles-page-boutique',
path: '/assets/css/pages/page-boutique.css', path : '/assets/css/pages/page-boutique.css',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-boutique', id : 'haiku-atelier-2024-scripts-page-boutique',
path: '/assets/js/scripts-page-boutique.js', path: '/assets/js/scripts-page-boutique.js',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-menu-categories', id : 'haiku-atelier-2024-scripts-menu-categories',
path: '/assets/js/scripts-menu-categories.js', path: '/assets/js/scripts-menu-categories.js',
); );
}); });

View file

@ -18,12 +18,12 @@ $templates = ['accueil.twig'];
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-accueil', id : 'haiku-atelier-2024-scripts-page-accueil',
path: '/assets/js/scripts-page-accueil.js', path: '/assets/js/scripts-page-accueil.js',
); );
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-accueil', handle: 'haiku-atelier-2024-styles-page-accueil',
path: '/assets/css/pages/page-accueil.css', path : '/assets/css/pages/page-accueil.css',
); );
}); });

View file

@ -24,21 +24,21 @@ Timber::$dirname = ['views'];
// Charge les Scripts du thème (report d'erreurs) // Charge les Scripts du thème (report d'erreurs)
function load_scripts(): void { function load_scripts(): void {
wp_enqueue_script_module( wp_enqueue_script_module(
id: 'haiku-atelier-2024-bouton-panier', id : 'haiku-atelier-2024-bouton-panier',
deps: [], deps : [],
src: get_template_directory_uri() . '/assets/js/scripts-bouton-panier.js', src : get_template_directory_uri() . '/assets/js/scripts-bouton-panier.js',
version: filemtime(get_template_directory() . '/assets/js/scripts-bouton-panier.js'), version: filemtime(get_template_directory() . '/assets/js/scripts-bouton-panier.js'),
); );
wp_enqueue_script_module( wp_enqueue_script_module(
id: 'haiku-atelier-2024-menu-mobile', id : 'haiku-atelier-2024-menu-mobile',
deps: [], deps : [],
src: get_template_directory_uri() . '/assets/js/scripts-menu-mobile.js', src : get_template_directory_uri() . '/assets/js/scripts-menu-mobile.js',
version: filemtime(get_template_directory() . '/assets/js/scripts-menu-mobile.js'), version: filemtime(get_template_directory() . '/assets/js/scripts-menu-mobile.js'),
); );
wp_enqueue_script_module( wp_enqueue_script_module(
id: 'haiku-atelier-2024-bouton-retour-sommet', id : 'haiku-atelier-2024-bouton-retour-sommet',
deps: [], deps : [],
src: get_template_directory_uri() . '/assets/js/scripts-bouton-retour-sommet.js', src : get_template_directory_uri() . '/assets/js/scripts-bouton-retour-sommet.js',
version: filemtime(get_template_directory() . '/assets/js/scripts-bouton-retour-sommet.js'), version: filemtime(get_template_directory() . '/assets/js/scripts-bouton-retour-sommet.js'),
); );
} }
@ -49,10 +49,10 @@ add_action('wp_enqueue_scripts', 'load_scripts');
function charge_styles_haiku_atelier_2024(): void { function charge_styles_haiku_atelier_2024(): void {
wp_enqueue_style( wp_enqueue_style(
handle: 'haiku-atelier-2024-styles', handle: 'haiku-atelier-2024-styles',
src: get_template_directory_uri() . '/assets/css/main.css', src : get_template_directory_uri() . '/assets/css/main.css',
deps: [], deps : [],
ver: filemtime(get_template_directory() . '/assets/css/main.css'), ver : filemtime(get_template_directory() . '/assets/css/main.css'),
media: 'all', media : 'all',
); );
} }

View file

@ -32,10 +32,10 @@ $context['image_dimensions'] = $image_dimensions;
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-a-propos', handle: 'haiku-atelier-2024-styles-page-a-propos',
path: '/assets/css/pages/page-a-propos.css', path : '/assets/css/pages/page-a-propos.css',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-a-propos', id : 'haiku-atelier-2024-scripts-page-a-propos',
path: '/assets/js/scripts-page-a-propos.js', path: '/assets/js/scripts-page-a-propos.js',
); );
}); });

View file

@ -54,7 +54,7 @@ foreach (WC()->cart->get_cart() as $cle_panier => $article_panier) {
'id_produit' => $article_panier['product_id'], 'id_produit' => $article_panier['product_id'],
'id_variation' => $article_panier['variation_id'], 'id_variation' => $article_panier['variation_id'],
'image' => pipe($article_panier['data']?->get_image_id(), static fn($id): string => Resource::output_multi_formats_img_tag( 'image' => pipe($article_panier['data']?->get_image_id(), static fn($id): string => Resource::output_multi_formats_img_tag(
id: (string) $id, id : (string) $id,
lazy: true, lazy: true,
)), )),
'prix' => $article_panier['data']?->get_price(), 'prix' => $article_panier['data']?->get_price(),
@ -97,10 +97,10 @@ $context['methodes_livraison'] = $methodes_livraison;
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-panier', handle: 'haiku-atelier-2024-styles-page-panier',
path: '/assets/css/pages/page-panier.css', path : '/assets/css/pages/page-panier.css',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-panier', id : 'haiku-atelier-2024-scripts-page-panier',
path: '/assets/js/scripts-page-panier.js', path: '/assets/js/scripts-page-panier.js',
); );
}); });

View file

@ -19,7 +19,7 @@ $templates = ['contact.twig'];
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-contact', handle: 'haiku-atelier-2024-styles-page-contact',
path: '/assets/css/pages/page-contact.min.css', path : '/assets/css/pages/page-contact.min.css',
); );
}); });

View file

@ -19,7 +19,7 @@ $templates = ['echec-commande.twig'];
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-modele-simple', handle: 'haiku-atelier-2024-styles-page-modele-simple',
path: '/assets/css/pages/page-modele-simple.css', path : '/assets/css/pages/page-modele-simple.css',
); );
}); });

View file

@ -87,7 +87,7 @@ try {
'attribut' => $attribut, 'attribut' => $attribut,
'id_produit' => $id_produit, 'id_produit' => $id_produit,
'image' => pipe($produit->get_image_id(), static fn($id): string => Resource::output_multi_formats_img_tag( 'image' => pipe($produit->get_image_id(), static fn($id): string => Resource::output_multi_formats_img_tag(
id: $id, id : $id,
lazy: true, lazy: true,
)), )),
'permalien' => $produit->get_permalink(), 'permalien' => $produit->get_permalink(),
@ -103,10 +103,10 @@ try {
function charge_scripts_styles_page_succes_commande(): void { function charge_scripts_styles_page_succes_commande(): void {
wp_enqueue_style( wp_enqueue_style(
handle: 'haiku-atelier-2024-styles-page-succes-commande', handle: 'haiku-atelier-2024-styles-page-succes-commande',
src: get_template_directory_uri() . '/assets/css/pages/page-succes-commande.css', src : get_template_directory_uri() . '/assets/css/pages/page-succes-commande.css',
deps: [], deps : [],
ver: filemtime(get_template_directory() . '/assets/css/pages/page-succes-commande.css'), ver : filemtime(get_template_directory() . '/assets/css/pages/page-succes-commande.css'),
media: 'all', media : 'all',
); );
} }

View file

@ -19,7 +19,7 @@ $templates = ['cgv.twig'];
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: '/assets/css/pages/page-modele-simple.css', handle: '/assets/css/pages/page-modele-simple.css',
path: '/assets/css/pages/page-modele-simple.css', path : '/assets/css/pages/page-modele-simple.css',
); );
}); });

View file

@ -61,7 +61,7 @@ $context['maximum_price'] = $maximum_price;
$context['same_collection_products'] = $same_collection_products; $context['same_collection_products'] = $same_collection_products;
$product_tags = $raw_product->get_tag_ids() $product_tags = $raw_product->get_tag_ids()
|> (static fn($tags_ids) => Arr::map($tags_ids, static fn($id) => Term::get_term_by_id( |> (static fn($tags_ids) => Arr::map($tags_ids, static fn($id) => Term::get_term_by_id(
id: $id, id : $id,
taxonomy: 'product_tag', taxonomy: 'product_tag',
))) )))
|> (static fn(/** @var list<Option<WC_Term>> */ $tags) => Arr::reject($tags, static fn($tag) => $tag->isNone())) |> (static fn(/** @var list<Option<WC_Term>> */ $tags) => Arr::reject($tags, static fn($tag) => $tag->isNone()))
@ -84,11 +84,11 @@ $context['page_states'] = $page_states;
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-produit', id : 'haiku-atelier-2024-scripts-page-produit',
path: '/assets/js/scripts-page-produit.js', path: '/assets/js/scripts-page-produit.js',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-menu-categories', id : 'haiku-atelier-2024-scripts-menu-categories',
path: '/assets/js/scripts-menu-categories.js', path: '/assets/js/scripts-menu-categories.js',
); );
}); });

View file

@ -68,7 +68,7 @@ final class StarterSite extends Site {
// Logo personnalisée // Logo personnalisée
$context['logo'] = pipe(get_theme_mod('custom_logo'), static fn($id) => wp_get_attachment_image_src( $context['logo'] = pipe(get_theme_mod('custom_logo'), static fn($id) => wp_get_attachment_image_src(
attachment_id: $id, attachment_id: $id,
size: 'full', size : 'full',
)); ));
// Informations des Pages // Informations des Pages
@ -95,8 +95,7 @@ final class StarterSite extends Site {
$url_courante = URLHelper::get_current_url(); $url_courante = URLHelper::get_current_url();
$context['page_courante'] = $url_courante; $context['page_courante'] = $url_courante;
$context['est_page_tous_produits'] = preg_match(pattern: '/(\bshop\b)/', subject: $url_courante); $context['est_page_tous_produits'] = preg_match(pattern: '/(\bshop\b)/', subject: $url_courante);
$context['est_page_boutique'] = $context['est_page_boutique'] = preg_match(pattern: '/(\bshop\b)/', subject: $url_courante)
preg_match(pattern: '/(\bshop\b)/', subject: $url_courante)
|| preg_match(pattern: '/(\bproduct\b)/', subject: $url_courante) || preg_match(pattern: '/(\bproduct\b)/', subject: $url_courante)
|| preg_match(pattern: '/(\bproduct-category\b)/', subject: $url_courante); || preg_match(pattern: '/(\bproduct-category\b)/', subject: $url_courante);

View file

@ -27,10 +27,10 @@ function enregistre_controle_personnalise_tinymce(): void {
public function enqueue(): void { public function enqueue(): void {
wp_enqueue_script( wp_enqueue_script(
handle: 'controle-personnalise-tinymce', handle: 'controle-personnalise-tinymce',
src: get_template_directory_uri() . '/assets/vendor/controle-personnalise-tinymce.js', src : get_template_directory_uri() . '/assets/vendor/controle-personnalise-tinymce.js',
deps: ['jquery'], deps : ['jquery'],
ver: '1.3', ver : '1.3',
args: true, args : true,
); );
wp_enqueue_editor(); wp_enqueue_editor();
} }

View file

@ -26,8 +26,10 @@ final readonly class Attribute {
public static function new(WC_Product_Attribute $attribute): self { public static function new(WC_Product_Attribute $attribute): self {
$name = wc_attribute_label($attribute->get_name()); $name = wc_attribute_label($attribute->get_name());
$slug = $attribute->get_name(); $slug = $attribute->get_name();
/** @var list<WP_Term> */ /** @var list<WP_Term> */
$terms = $attribute->get_terms() ?? []; $terms = $attribute->get_terms() ?? [];
/** @var list<AttributeOption> */ /** @var list<AttributeOption> */
$options = Arr::map($terms, AttributeOption::new(...)) $options = Arr::map($terms, AttributeOption::new(...))
|> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id)) |> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id))

View file

@ -112,10 +112,10 @@ final readonly class Cart {
private static function format_number(int|float $number): string { private static function format_number(int|float $number): string {
$formatted_number = Number::format( $formatted_number = Number::format(
number: $number, number : $number,
// precision et max_precision sont mutuellement exclusifs. // precision et max_precision sont mutuellement exclusifs.
precision: 2, precision: 2,
locale: 'fr', locale : 'fr',
); );
return is_bool($formatted_number) ? self::DEFAULT_VALUE : $formatted_number; return is_bool($formatted_number) ? self::DEFAULT_VALUE : $formatted_number;

View file

@ -18,9 +18,12 @@ use function Psl\Option\from_nullable;
use function wc_get_products; use function wc_get_products;
use function wpautop; use function wpautop;
/**
* Représente un **Produit** (selon _WooCommerce_) avec de nombreuses données d'intérêt pour les opérations courantes.
*/
final readonly class Product { final readonly class Product {
/** /**
* @param list<Attribute> $attributes * @param list<Attribute> $attributes La liste des `Attribute` appliquées.
* @param list<string> $left_column_photos * @param list<string> $left_column_photos
* @param list<string> $right_column_photos * @param list<string> $right_column_photos
* @param array<ProductVariation> $variations * @param array<ProductVariation> $variations
@ -80,21 +83,21 @@ final readonly class Product {
$url = $product->get_permalink(); $url = $product->get_permalink();
return new self( return new self(
attributes: $attributes, attributes : $attributes,
category: $category, category : $category,
collection: $collection, collection : $collection,
details: $details, details : $details,
id: $id, id : $id,
name: $name, name : $name,
price: $price, price : $price,
left_column_photos: $left_column_photos, left_column_photos : $left_column_photos,
right_column_photos: $right_column_photos, right_column_photos: $right_column_photos,
default_photo: $default_photo, default_photo : $default_photo,
hover_photo: $hover_photo, hover_photo : $hover_photo,
slug: $slug, slug : $slug,
stock: $stock, stock : $stock,
variations: $variations, variations : $variations,
url: $url, url : $url,
); );
} }

View file

@ -143,11 +143,11 @@ function genere_balises_img_dans_produit_dans_reponse_rest(
$response->data['image_repos'] = pipe( $response->data['image_repos'] = pipe(
$response->data['meta_data'], $response->data['meta_data'],
static fn($metadata): array => array_filter( static fn($metadata): array => array_filter(
array: $metadata, array : $metadata,
callback: static fn($entree): bool => '_photos_colonne_gauche|||0|value' === $entree->key, callback: static fn($entree): bool => '_photos_colonne_gauche|||0|value' === $entree->key,
), ),
static fn($metadata): array => array_map(array: $metadata, callback: static fn($entree): string => Resource::output_multi_formats_img_tag( static fn($metadata): array => array_map(array: $metadata, callback: static fn($entree): string => Resource::output_multi_formats_img_tag(
id: $entree?->value, id : $entree?->value,
lazy: true, lazy: true,
)), )),
static fn($image) => array_values(array: $image)[0], static fn($image) => array_values(array: $image)[0],
@ -157,11 +157,11 @@ function genere_balises_img_dans_produit_dans_reponse_rest(
$response->data['image_survol'] = pipe( $response->data['image_survol'] = pipe(
$response->data['meta_data'], $response->data['meta_data'],
static fn($metadata): array => array_filter( static fn($metadata): array => array_filter(
array: $metadata, array : $metadata,
callback: static fn($entree): bool => '_photos_colonne_droite|||0|value' === $entree->key, callback: static fn($entree): bool => '_photos_colonne_droite|||0|value' === $entree->key,
), ),
static fn($metadata): array => array_map(array: $metadata, callback: static fn($entree): string => Resource::output_multi_formats_img_tag( static fn($metadata): array => array_map(array: $metadata, callback: static fn($entree): string => Resource::output_multi_formats_img_tag(
id: $entree?->value, id : $entree?->value,
lazy: true, lazy: true,
)), )),
static fn($image) => array_values(array: $image)[0], static fn($image) => array_values(array: $image)[0],

View file

@ -78,14 +78,13 @@ final readonly class Resource {
$formats = pipe( $formats = pipe(
[$avif, $jxl], [$avif, $jxl],
static fn($tableau): array => array_filter( static fn($tableau): array => array_filter(
array: $tableau, array : $tableau,
callback: static fn($chemin_format): bool => false !== $chemin_format, callback: static fn($chemin_format): bool => false !== $chemin_format,
), ),
static fn($tableau): array => array_map(array: $tableau, callback: static fn($chemin_format): array => [ static fn($tableau): array => array_map(array: $tableau, callback: static fn($chemin_format): array => [
'format' => pathinfo((string) $chemin_format)['extension'], 'format' => pathinfo((string) $chemin_format)['extension'],
'taille' => filesize($chemin_format), 'taille' => filesize($chemin_format),
'url' => 'url' => pathinfo($url)['dirname']
pathinfo($url)['dirname']
. '/' . '/'
. pathinfo($url)['filename'] . pathinfo($url)['filename']
. '.' . '.'

View file

@ -67,14 +67,14 @@ $context['page_states'] = $page_states;
add_action('wp_enqueue_scripts', function (): void { add_action('wp_enqueue_scripts', function (): void {
Resource::enqueue_style_file( Resource::enqueue_style_file(
handle: 'haiku-atelier-2024-styles-page-boutique', handle: 'haiku-atelier-2024-styles-page-boutique',
path: '/assets/css/pages/page-boutique.css', path : '/assets/css/pages/page-boutique.css',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-page-boutique', id : 'haiku-atelier-2024-scripts-page-boutique',
path: '/assets/js/scripts-page-boutique.js', path: '/assets/js/scripts-page-boutique.js',
); );
Resource::enqueue_script_module_file( Resource::enqueue_script_module_file(
id: 'haiku-atelier-2024-scripts-menu-categories', id : 'haiku-atelier-2024-scripts-menu-categories',
path: '/assets/js/scripts-menu-categories.js', path: '/assets/js/scripts-menu-categories.js',
); );
}); });

View file

@ -31,7 +31,10 @@ $commande = $order;
$date = new Carbon($commande->get_date_created()); $date = new Carbon($commande->get_date_created());
$email = [ $email = [
'adresses' => ['facturation' => $commande->get_address('billing'), 'livraison' => $commande->get_address('shipping')], 'adresses' => [
'facturation' => $commande->get_address('billing'),
'livraison' => $commande->get_address('shipping'),
],
'commande' => ['date' => $date->toDateString(), 'id' => $commande->get_id()], 'commande' => ['date' => $date->toDateString(), 'id' => $commande->get_id()],
'livraison' => [ 'livraison' => [
'methode' => $commande->get_shipping_method(), 'methode' => $commande->get_shipping_method(),