Code Duplication    Length = 10-10 lines in 2 locations

src/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php 2 locations

@@ 79-88 (lines=10) @@
76
        $generationTime = \microtime(true) - $generationTimeMc;
77
        $unprefixedKey = \substr($key[ 'key' ], \strlen($this->twigCachePrefix));
78
79
        if ($this->cacheCollector instanceof CacheCollector) {
80
            $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [
81
              'cacheHit' => $cacheData !== null,
82
              'cacheTtl' => $key[ 'lifetime' ],
83
              'cacheSize' => mb_strlen((string)$cacheData),
84
              'cacheGenTime' => $generationTime,
85
              'cacheFileName' => $sourceContext->getName(),
86
              'cacheFilePath' => $sourceContext->getPath(),
87
            ]);
88
        }
89
90
        if (!empty($cacheData) && $this->config[ 'twig_block_debug' ]) {
91
            return "<!-- BEGIN CACHE BLOCK OUTPUT '{$unprefixedKey}' -->\n{$cacheData}\n<!-- // END CACHE BLOCK OUTPUT '{$unprefixedKey}' -->";
@@ 119-128 (lines=10) @@
116
    {
117
        $unprefixedKey = \substr($key[ 'key' ], \strlen($this->twigCachePrefix));
118
119
        if ($this->cacheCollector instanceof CacheCollector) {
120
            $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [
121
              'cacheHit' => false,
122
              'cacheTtl' => $key[ 'lifetime' ],
123
              'cacheSize' => \mb_strlen((string)$block),
124
              'cacheGenTime' => $generationTime,
125
              'cacheFileName' => $sourceContext->getName(),
126
              'cacheFilePath' => $sourceContext->getPath(),
127
            ]);
128
        }
129
130
        return $this->cache->save($key[ 'key' ], $block, $key[ 'lifetime' ]);
131
    }