Create a cache string from function attributes

@return null|string
191679
protected static function cacheString()
    {
        $string = "";
        foreach (func_get_args() as $functionArgument) {
            $string .= md5(serialize($functionArgument));
        }

        return $string;
    }
1313221
function load() {

		if ($this->cacheConf['type'] == 'noop') {
			return null; // do nothing
		}
		else { // non-noop

			$loadedState = null;

			if ($this->cacheConf['type'] == 'file') {
				$username = \get_current_user();
				$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
				$cachePath = $cacheDir.'/freia.'.(\php_sapi_name() === 'cli' ? 'cli' : 'server').'.'.$username.'.symbols.json';
				if ($this->file_exists($cachePath)) {
					try {
						$loadedState = \json_decode($this->file_get_contents($cachePath), true);
					}
					catch (\Exception $e) {
						$this->error_log('Failed to load cache file: '.$cachePath);
						return null;
					}
				}
				else { // couldn't find cache file
					return null;
				}
			}
			else if ($this->cacheConf['type'] == 'memcached') {
				$mc = $this->memcachedInstance();
				try {
					$loadedState = $mc->get('freia-symbols');
				}
				catch (\Exception $e) {
					$loadedState = null;
				}
			}

			// Process Loaded State
			// ====================

			if ($loadedState == null) {
				return null;
			}

			if ($loadedState['version'] == $this->state['version']) {
				return $loadedState;
			}
			else { // deprecated state
				return null;
			}
		}
	}
599077
function &_smarty_cache_attrs($cache_serial, $count) {
		$_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];

		if ($this->_cache_including) {
			/* return next set of cache_attrs */
			$_return = current($_cache_attrs);
			next($_cache_attrs);
			return $_return;

		} else {
			/* add a reference to a new set of cache_attrs */
			$_cache_attrs[] = array();
			return $_cache_attrs[count($_cache_attrs)-1];

		}

	}
655485
public function getCreatedBy()
    {
        $createdByAttribute = $this->createdByAttribute;
        return (!is_string($createdByAttribute) || empty($createdByAttribute)) ? null : $this->$createdByAttribute->getData();
    }
472305
protected function paramsToString() {
		$out = "";
		foreach( $this->attributes as $name => $value ) {
			$out .= " {$name}=\"{$value}\"";
		}
		return $this->standalone ? $out." /" : $out;
	}
116709
function cached (fn) {
  var cache = Object.create(null);
  return (function cachedFn (str) {
    var hit = cache[str];
    return hit || (cache[str] = fn(str))
  })
}
602696
private function getCached() {
        if (isset($_GET['noCache'])) return null;
        $cacheDir = DATA . 'select' . DIRECTORY_SEPARATOR;
        if (!is_dir($cacheDir)) mkdir($cacheDir, 0777, true);

        $cache = $cacheDir . base64_encode($this->getName()) . '.php';
        if (!is_readable($cache)) return null;
        $cached = include $cache;
        return $this->decode($cached[$this->encode($this->query . serialize($this->values))]);
    }
932031
public function renderAttributes() : string
    {
        $pairs = array_map(function(string $value, string $key) {
            return sprintf('%s="%s"', helpers\e($key), helpers\e($value));
        }, $this->attributes, array_keys($this->attributes));

        return implode(' ', $pairs);
    }
1254710
public function tostring()
    {

        if (empty($this->value)) {

            return (empty($this->function)) ? "$this->function(`$this->name`)" : " `$this->name`";
        }

        $str = strtoupper($this->condition) . " `$this->name`";

        if (is_array($this->value)) {
            $str .= " IN (" . implode("','", $this->value) . "')";
        } else {
            $str .= " = '$this->value'";
        }

        return $str;
    }
1270044
public function getAttribute($key)
    {
        if (! $this->isValueObject($key)) {
            return parent::getAttribute($key);
        }

        if (! $this->isValueObjectCached($key)) {

            // Allow other mutators and such to do their work first.
            $value = parent::getAttribute($key);

            // Don't cast empty $value.
            if ($value === null || $value === '') {
                return null;
            }

            // Cache the instantiated value for future access.
            // This allows tests such as ($model->casted === $model->casted) to be true.
            $this->cacheValueObject($key, $this->createValueObject($key, $value));
        }

        return $this->getCachedValueObject($key);
    }
750888
public function toString()
    {
        if ($this->isClosure()) {
            throw new LogicException('You cannot serialize a closure.');
        }

        if ($this->isFunction()) {
            return $this->getCallMethod();
        }

        $separator = $this->isStaticMethod() ? '::' : '->';

        return $this->getCallClass() . $separator . $this->getCallMethod();

    }
614990
protected function getCachedInfo()
    {
        $cached = Cache::get($this->dataCacheKey, false);

        if (
            $cached !== false &&
            ($cached = @unserialize(@base64_decode($cached))) !== false
        ) {
            return $cached;
        }

        return null;
    }
595643
public function cache()
    {
        foreach($this->getRoutes() as $key => $r) {
            if (!is_string($r['callback'])) {
                throw new Exception(sprintf('Routes cannot contain a Closure/Function callback while caching.'));
            }
        }

        $cacheContent = '<?php return '.var_export($this->getRoutes(), true).';' . PHP_EOL;
        if (false === file_put_contents($this->cacheFile, $cacheContent)) {
            throw new Exception(sprintf('Routes cache file could not be written.'));
        }

        return true;
    }
75389
private function createCache()
    {
        $cachePath = $this->getCachePath();
        $content   = json_encode([], JSON_PRETTY_PRINT);

        $this->files->put($cachePath, $content);

        return collect(json_decode($content, true));
    }
577417
public function buildAttributes()
    {
        if (is_string($this->attributes))
            return $this->attributes;

        if (count($this->attributes)<1)
            return "";

        $compiled = '';
        foreach ($this->attributes as $key => $val) {
            $compiled .= ' '.$key.'="'.$val.'"';
        }

        return $compiled;
    }
1154120
protected function getAttributesString()
    {
        $result = '';
        ksort($this->props);
        foreach ($this->props as $k => $v) {
            if (substr($k, 0, 1) !== '_') {
                if ($v === true) {
                    $result .= $k . ' ';
                } else {
                    $result .= $k . '="' . $this->escapeAttr($v) . '" ';
                }
            }
        }
        if ($result) {
            $result = ' ' . trim($result);
        }

        return $result;
    }
1030271
protected static function cacheReqData()
	{
		//fetch relevant vars
		$host = rtrim(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'], '/');
		$pathInfo = !empty($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : (!empty($_SERVER['ORIG_PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : '');

		$hostParts = array_reverse(explode('.', $host));
		$pathParts = explode('/', $pathInfo);

		static::$RCACHE = [
			'protocol'=>!empty($_SERVER['HTTPS']) ? 'https' : 'http',
			'host'=>$host,
			'uri'=>$_SERVER['REQUEST_URI'],
			'queryString'=>$_SERVER['QUERY_STRING'],
			'hostParts'=>$hostParts,
			'numParts'=>count($hostParts),
			'pathParts'=>$pathParts,
			'numPathParts'=>count($pathParts),
		];
	}