/var/www/html_de/wp-content/plugins/elementor/modules/atomic-widgets/memo.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace Elementor\Modules\AtomicWidgets;

if ( ! 
defined'ABSPATH' ) ) {
    exit; 
// Exit if accessed directly.
}

class 
Memo {
    private array 
$cache = [];

    public function 
memoizestring $key, callable $callback ) {
        return function() use ( 
$key$callback ) {
            if ( 
array_key_exists$key$this->cache ) ) {
                return 
$this->cache$key ];
            }

            
$this->cache$key ] = call_user_func$callback );
            return 
$this->cache$key ];
        };
    }
}