<commit_before><?php

/*
* This file is part of the ACache library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace ACache;

/**
 * Cache namespace decorator.
 *
 * Not specifiying a namespace will make this class a no-op wrapper.
 *
 * @author <NAME> <<EMAIL>>
 */
class NamespaceCache implements Cache
{
    protected $cache;
    protected $namespace;

    /**
     * Create new instance, decorating the given cache.
     *
     * @param Cache  $cache     The cache to decorate with a namespace.
     * @param string $namespace The namespace; default is <code>null</code> for having no namespace at all.
     */
    public function __construct(Cache $cache, $namespace = null)
    {
        $this->cache = $cache;
        // ensure we have an array
        $this->namespace = (array) $namespace;
    }

    /**
     * Get the full namespace path.
     *
     * @param  string|array $namespace Namespace - may be <code>null</code>.
     * @return array        The full namespace path.
     */
    protected function getNamespacePath($namespace)
    {
        return array_merge($this->namespace, (array) $namespace);
    }

    /**
     * {@inheritDoc}
     */
    public function fetch($id, $namespace = null)
    {
        return $this->cache->fetch($id, $this->getNamespacePath($namespace));
    }
<commit_msg>add getCache() method to access the decorated cache<commit_after><?php

/*
* This file is part of the ACache library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace ACache;

/**
 * Cache namespace decorator.
 *
 * Not specifiying a namespace will make this class a no-op wrapper.
 *
 * @author <NAME> <<EMAIL>z.net>
 */
class NamespaceCache implements Cache
{
    protected $cache;
    protected $namespace;

    /**
     * Create new instance, decorating the given cache.
     *
     * @param Cache  $cache     The cache to decorate with a namespace.
     * @param string $namespace The namespace; default is <code>null</code> for having no namespace at all.
     */
    public function __construct(Cache $cache, $namespace = null)
    {
        $this->cache = $cache;
        // ensure we have an array
        $this->namespace = (array) $namespace;
    }

    /**
     * Get the decorated cache.
     *
     * @return ACache\Cache The decorated cache instance.
     */
    public function getCache()
    {
        return $this->cache;
    }

    /**
     * Get the full namespace path.
     *
     * @param  string|array $namespace Namespace - may be <code>null</code>.
     * @return array        The full namespace path.
     */
    protected function getNamespacePath($namespace)
    {
        return array_merge($this->namespace, (array) $namespace);
    }

    /**
     * {@inheritDoc}
     */
    public function fetch($id, $namespace = null)
    {
        return $this->cache->fetch($id, $this->getNamespacePath($namespace));
    }

{'fraction_non_alphanumeric': 0.1167151632719043, 'fraction_numerical': 0.0, 'mean_word_length': 2.5481651376146788, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 36, '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': '791403', 'n_tokens_mistral': 873, 'n_tokens_neox': 867, 'n_words': 300}