<commit_before><?php

namespace Fastly\Cdn\Helper;

use \Magento\Framework\App\Helper\AbstractHelper;

class CacheTags extends AbstractHelper
{
    /**
     * Replaces long Magento Cache tags with a shorter version
     *
     * @param string
     * @return string
     */
    public function convertCacheTags($tags)
    {
        $fastlyTags = array(
            'catalog_product_' => 'p',
            'catalog_category_' => 'c',
            'cms_page' => 'cpg',
            'cms_block' => 'cb',
            'brands_brand_' => 'b'
        );

        return str_replace(array_keys($fastlyTags), $fastlyTags, $tags);<commit_msg>Add new style of tags to mapper array<commit_after><?php

namespace Fastly\Cdn\Helper;

use \Magento\Framework\App\Helper\AbstractHelper;

class CacheTags extends AbstractHelper
{
    /**
     * Replaces long Magento Cache tags with a shorter version
     *
     * @param string
     * @return string
     */
    public function convertCacheTags($tags)
    {
        $fastlyTags = array(
            // <= 2.1.*
            'catalog_product_' => 'p',
            'catalog_category_' => 'c',
            'cms_page' => 'cpg',
            'cms_block' => 'cb',

            // > 2.2.*
            'cat_p_' => 'p',
            'cat_c_' => 'c',
            'cms_p' => 'cpg',
            'cms_b' => 'cb',

            'brands_brand_' => 'b'
        );

        return str_replace(array_keys($fastlyTags), $fastlyTags, $tags);
{'fraction_non_alphanumeric': 0.1376210235131397, 'fraction_numerical': 0.0027662517289073307, 'mean_word_length': 1.977366255144033, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 18, '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': '3351884', 'n_tokens_mistral': 464, 'n_tokens_neox': 453, 'n_words': 98}