added in vendor for prod
This commit is contained in:
60
vendor/salesforce/handlebars-php/src/Handlebars/Cache/APC.php
vendored
Executable file
60
vendor/salesforce/handlebars-php/src/Handlebars/Cache/APC.php
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @category Xamin
|
||||
* @package Handlebars
|
||||
* @author Joey Baker <joey@byjoeybaker.com>
|
||||
* @author Behrooz Shabani <everplays@gmail.com>
|
||||
* @copyright 2013 (c) Meraki, LLP
|
||||
* @copyright 2013 (c) Behrooz Shabani
|
||||
* @license MIT
|
||||
* @link http://voodoophp.org/docs/handlebars
|
||||
*/
|
||||
|
||||
namespace Handlebars\Cache;
|
||||
use Handlebars\Cache;
|
||||
|
||||
class APC implements Cache
|
||||
{
|
||||
|
||||
/**
|
||||
* Get cache for $name if exist.
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return mixed data on hit, boolean false on cache not found
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (apc_exists($name)) {
|
||||
return apc_fetch($name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a cache
|
||||
*
|
||||
* @param string $name cache id
|
||||
* @param mixed $value data to store
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
apc_store($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove cache
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
apc_delete($name);
|
||||
}
|
||||
|
||||
}
|
||||
115
vendor/salesforce/handlebars-php/src/Handlebars/Cache/Disk.php
vendored
Normal file
115
vendor/salesforce/handlebars-php/src/Handlebars/Cache/Disk.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* A flat-file filesystem cache.
|
||||
*
|
||||
* @category Xamin
|
||||
* @package Handlebars
|
||||
* @author Alex Soncodi <alex@brokerloop.com>
|
||||
* @author Behrooz Shabani <everplays@gmail.com>
|
||||
* @author Mardix <https://github.com/mardix>
|
||||
* @copyright 2013 (c) Brokerloop, Inc.
|
||||
* @copyright 2013 (c) Behrooz Shabani
|
||||
* @copyright 2013 (c) Mardix
|
||||
* @license MIT
|
||||
* @link http://voodoophp.org/docs/handlebars
|
||||
*/
|
||||
|
||||
namespace Handlebars\Cache;
|
||||
use Handlebars\Cache;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
class Disk implements Cache
|
||||
{
|
||||
|
||||
private $path = '';
|
||||
private $prefix = '';
|
||||
private $suffix = '';
|
||||
|
||||
/**
|
||||
* Construct the disk cache.
|
||||
*
|
||||
* @param string $path Filesystem path to the disk cache location
|
||||
* @param string $prefix optional file prefix, defaults to empty string
|
||||
* @param string $suffix optional file extension, defaults to empty string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($path, $prefix = '', $suffix = '')
|
||||
{
|
||||
if (empty($path)) {
|
||||
throw new InvalidArgumentException('Must specify disk cache path');
|
||||
} elseif (!is_dir($path)) {
|
||||
@mkdir($path, 0777, true);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
throw new RuntimeException('Could not create cache file path');
|
||||
}
|
||||
}
|
||||
|
||||
$this->path = $path;
|
||||
$this->prefix = $prefix;
|
||||
$this->suffix = $suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full disk path for a given cache item's file,
|
||||
* taking into account the cache path, optional prefix,
|
||||
* and optional extension.
|
||||
*
|
||||
* @param string $name Name of the cache item
|
||||
*
|
||||
* @return string full disk path of cached item
|
||||
*/
|
||||
private function getPath($name)
|
||||
{
|
||||
return $this->path . DIRECTORY_SEPARATOR .
|
||||
$this->prefix . $name . $this->suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache for $name if it exists.
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return mixed data on hit, boolean false on cache not found
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
$path = $this->getPath($name);
|
||||
|
||||
return (file_exists($path)) ?
|
||||
unserialize(file_get_contents($path)) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a cache
|
||||
*
|
||||
* @param string $name cache id
|
||||
* @param mixed $value data to store
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
$path = $this->getPath($name);
|
||||
|
||||
file_put_contents($path, serialize($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove cache
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
$path = $this->getPath($name);
|
||||
|
||||
unlink($path);
|
||||
}
|
||||
|
||||
}
|
||||
62
vendor/salesforce/handlebars-php/src/Handlebars/Cache/Dummy.php
vendored
Executable file
62
vendor/salesforce/handlebars-php/src/Handlebars/Cache/Dummy.php
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* A dummy array cache
|
||||
*
|
||||
* @category Xamin
|
||||
* @package Handlebars
|
||||
* @author fzerorubigd <fzerorubigd@gmail.com>
|
||||
* @author Behrooz Shabani <everplays@gmail.com>
|
||||
* @copyright 2012 (c) ParsPooyesh Co
|
||||
* @copyright 2013 (c) Behrooz Shabani
|
||||
* @license MIT
|
||||
* @link http://voodoophp.org/docs/handlebars
|
||||
*/
|
||||
|
||||
namespace Handlebars\Cache;
|
||||
use Handlebars\Cache;
|
||||
|
||||
class Dummy implements Cache
|
||||
{
|
||||
private $cache = [];
|
||||
|
||||
/**
|
||||
* Get cache for $name if exist.
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return mixed data on hit, boolean false on cache not found
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (array_key_exists($name, $this->cache)) {
|
||||
return $this->cache[$name];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a cache
|
||||
*
|
||||
* @param string $name cache id
|
||||
* @param mixed $value data to store
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
$this->cache[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove cache
|
||||
*
|
||||
* @param string $name Cache id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
unset($this->cache[$name]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user