<commit_before><?php

namespace Kanboard\Core\Cache;

/**
 * Base class for cache drivers
 *
 * @package  cache
 * @author   <NAME>
 */
abstract class Base
{
    /**
     * Fetch value from cache
     *
     * @abstract
     * @access public
     * @param  string  $key
     * @return mixed            Null when not found, cached value otherwise
     */
    abstract public function get($key);

    /**
     * Save a new value in the cache
     *
     * @abstract
     * @access public
     * @param  string  $key
     * @param  mixed   $value
     */
    abstract public function set($key, $value);

    /**
     * Proxy cache
     *
     * Note: Arguments must be scalar types
     *
     * @access public
     * @param  string    $class        Class instance
     * @param  string    $method       Container method
     * @return mixed
     */
    public function proxy($class, $method)
    {
        $args = func_get_args();
        array_shift($args);

        $key = 'proxy:'.get_class($class).':'.implode(':', $args);
        $result = $this->get($key);

        if ($result === null) {
            $result = call_user_func_array(array($class, $method), array_splice($args, 1));
            $this->set($key, $result);
        }

        return $result;
    }
}<commit_msg>Fix compatibility issue with PHP 5.3<commit_after><?php

namespace Kanboard\Core\Cache;

/**
 * Base class for cache drivers
 *
 * @package  cache
 * @author   <NAME>
 */
abstract class Base
{
    /**
     * Proxy cache
     *
     * Note: Arguments must be scalar types
     *
     * @access public
     * @param  string    $class        Class instance
     * @param  string    $method       Container method
     * @return mixed
     */
    public function proxy($class, $method)
    {
        $args = func_get_args();
        array_shift($args);

        $key = 'proxy:'.get_class($class).':'.implode(':', $args);
        $result = $this->get($key);

        if ($result === null) {
            $result = call_user_func_array(array($class, $method), array_splice($args, 1));
            $this->set($key, $result);
        }

        return $result;
    }
}
{'fraction_non_alphanumeric': 0.13704396632366697, 'fraction_numerical': 0.0018709073900841909, 'mean_word_length': 1.95850622406639, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7212476', 'n_tokens_mistral': 651, 'n_tokens_neox': 640, 'n_words': 171}