<commit_before><?php

namespace Oro\Component\Layout\Loader;

use Oro\Component\Layout\LayoutManipulatorInterface;

/**
 * Example of config
 * $config = [
 *     'oro_layout' => [
 *         'items' => [
 *             'root' => ['type' => 'root'],
 *             'header' => ['type' => 'header'],
 *             'logo' => ['type' => 'logo', 'options' => ['title' => 'test']],
 *         ],
 *         'tree' => [
 *             'root' => [
 *                 'header' => [
 *                     'logo' => []
 *                 ]
 *             ]
 *         ]
 *     ]
 * ];
 *
 */
class RawLayoutLoader
{
    const LAYOUT_CONFIG_KEY = 'oro_layout';

    /** @var array */
    protected $items = [];

    /** @var LayoutManipulatorInterface */
    protected $layoutManipulator;

    public function __construct(LayoutManipulatorInterface $layoutManipulator)
    {
        $this->layoutManipulator = $layoutManipulator;
    }

    /**
     * @param array $config Full config from merged configuration files
     */
    public function load(array $config)
    {
        if (!$config) {
            return;
        }

        if (isset($config[self::LAYOUT_CONFIG_KEY])) {
            $layoutConfig = $config[self::LAYOUT_CONFIG_KEY];
            if (isset($layoutConfig['items'])) {
                $this->items = $layoutConfig['items'];
            }
            if (isset($layoutConfig['tree'])) {
                foreach ($layoutConfig['tree'] as $block => $configPart) {
                    $this->appendBlock($block, $configPart);
                }
            }
            if (isset($layoutConfig['aliases'])) {
                foreach ($layoutConfig['aliases'] as $alias => $id) {
                    $this->layoutManipulator->addAlias($alias, $id);
                }
            }
        }<commit_msg>BAP-7346: Loader config layout - updated condition<commit_after><?php

namespace Oro\Component\Layout\Loader;

use Oro\Component\Layout\LayoutManipulatorInterface;

/**
 * Example of config
 * $config = [
 *     'oro_layout' => [
 *         'items' => [
 *             'root' => ['type' => 'root'],
 *             'header' => ['type' => 'header'],
 *             'logo' => ['type' => 'logo', 'options' => ['title' => 'test']],
 *         ],
 *         'tree' => [
 *             'root' => [
 *                 'header' => [
 *                     'logo' => []
 *                 ]
 *             ]
 *         ],
 *         'aliases' => [
 *             'root_alias' => 'root',
 *             'logo_1' => 'logo',
 *             'logo_2' => 'logo'
 *         ]
 *     ]
 * ];
 *
 */
class RawLayoutLoader
{
    const LAYOUT_CONFIG_KEY = 'oro_layout';

    /** @var array */
    protected $items = [];

    /** @var LayoutManipulatorInterface */
    protected $layoutManipulator;

    public function __construct(LayoutManipulatorInterface $layoutManipulator)
    {
        $this->layoutManipulator = $layoutManipulator;
    }

    /**
     * @param array $config Full config from merged configuration files
     */
    public function load(array $config)
    {
        if (isset($config[self::LAYOUT_CONFIG_KEY])) {
            return;
        }

        $layoutConfig = $config[self::LAYOUT_CONFIG_KEY];

        if (isset($layoutConfig['items'])) {
            $this->items = $layoutConfig['items'];
        }

        if (isset($layoutConfig['tree'])) {
            foreach ($layoutConfig['tree'] as $block => $configPart) {
                $this->appendBlock($block, $configPart);
            }
        }

        if (isset($layoutConfig['aliases'])) {
            foreach ($layoutConfig['aliases'] as $alias => $id) {
                $this->layoutManipulator->addAlias($alias, $id);
            }
        }
{'fraction_non_alphanumeric': 0.16478494623655915, 'fraction_numerical': 0.0016129032258064516, 'mean_word_length': 1.7300073367571533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1455969', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1049, 'n_words': 186}