1<?php
2
3namespace ComboStrap;
4
5
6use ComboStrap\Tag\BarTag;
7
8/**
9 * @deprecated see :container:deprecated
10 */
11class ContainerTag
12{
13
14
15    public const CONTAINER_ATTRIBUTE = "container";
16    public const CONTAINER_VALUES = [ContainerTag::DEFAULT_LAYOUT_CONTAINER_DEFAULT_VALUE, Breakpoint::MD, Breakpoint::LG, Breakpoint::XL, Breakpoint::XXL, Breakpoint::FLUID];
17    public const DEFAULT_LAYOUT_CONTAINER_DEFAULT_VALUE = Breakpoint::SM;
18    public const CANONICAL = ContainerTag::TAG;
19    /**
20     * The value of the default layout container
21     * Page Header and Footer have a {@link BarTag} that permits to set the layout container value
22     *
23     * The page core does not have any It's by default contained for all layout
24     * generally applied on the page-core element ie
25     * <div id="page-core" data-layout-container="true">
26     */
27    public const DEFAULT_LAYOUT_CONTAINER_CONF = "defaultLayoutContainer";
28    public const TAG = "container";
29
30    public static function getClassName(?string $type): string
31    {
32        $containerPrefix = "";
33        if ($type !== Breakpoint::SM) {
34            $containerPrefix = "-$type";
35        }
36        return "container{$containerPrefix}";
37    }
38
39    public static function renderEnterXhtml(TagAttributes $tagAttributes): string
40    {
41        $type = $tagAttributes->getType();
42        $tagAttributes->addClassName(ContainerTag::getClassName($type));
43        LogUtility::warning("The container syntax has been deprecated", ":container:deprecated");
44        return $tagAttributes->toHtmlEnterTag("div");
45
46    }
47
48    public static function renderExitXhtml(): string
49    {
50        return '</div>';
51    }
52}
53