Skip to content

Commit

Permalink
Var type adjustements
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Jun 26, 2016
1 parent 5773ed0 commit 20f09cd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/phpFastCache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
use phpFastCache\Core\DriverAbstract;
use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
use CouchbaseCluster;

/**
* Class CacheManager
Expand Down Expand Up @@ -57,8 +56,8 @@ class CacheManager
'default_chmod' => 0777, // 0777 recommended
'path' => '',// if not set will be the value of sys_get_temp_dir()
'fallback' => false, //Fall back when old driver is not support
"limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory
"compress_data" => false, // compress stored data, if the backend supports it
'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory
'compress_data' => false, // compress stored data, if the backend supports it
];

/**
Expand Down Expand Up @@ -181,6 +180,7 @@ public static function setNamespacePath($path)
* @param $name
* @param string $value
* @deprecated Method "setup" is deprecated and will be removed in 5.1. Use method "setDefaultConfig" instead.
* @throws \InvalidArgumentException
*/
public static function setup($name, $value = '')
{
Expand All @@ -191,6 +191,7 @@ public static function setup($name, $value = '')
/**
* @param $name string|array
* @param mixed $value
* @throws \InvalidArgumentException
*/
public static function setDefaultConfig($name, $value = null)
{
Expand Down
12 changes: 6 additions & 6 deletions src/phpFastCache/Core/PathSeekerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getPath($getBasePath = false)
$securityKey .= '/';
}

$securityKey = $this->cleanFileName($securityKey);
$securityKey = static::cleanFileName($securityKey);

$full_path = rtrim($path, '/') . '/' . $securityKey;
$full_pathx = md5($full_path);
Expand Down Expand Up @@ -201,18 +201,18 @@ protected static function cleanFileName($filename)
*/
protected function htaccessGen($path, $create = true)
{
if ($create == true) {
if ($create === true) {
if (!is_writable($path)) {
try {
chmod($path, 0777);
if(!chmod($path, 0777)){
throw new phpFastCacheDriverException('Chmod failed on : ' . $path);
}
} catch (phpFastCacheDriverException $e) {
throw new phpFastCacheDriverException('PLEASE CHMOD ' . $path . ' - 0777 OR ANY WRITABLE PERMISSION!',
92);
throw new phpFastCacheDriverException('PLEASE CHMOD ' . $path . ' - 0777 OR ANY WRITABLE PERMISSION!', 0, $e);
}
}

if (!file_exists($path . "/.htaccess")) {
// echo "write me";
$html = "order deny, allow \r\n
deny from all \r\n
allow from 127.0.0.1";
Expand Down
8 changes: 4 additions & 4 deletions src/phpFastCache/Entities/driverStatistic.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class driverStatistic implements ArrayAccess
/**
* @var string
*/
protected $size = '';
protected $size = 0;

/**
* @var string
Expand Down Expand Up @@ -73,7 +73,7 @@ public function getData()
*/
public function setInfo($info)
{
$this->info = ($info ?: false);
$this->info = ($info ?: '');

return $this;
}
Expand All @@ -85,7 +85,7 @@ public function setInfo($info)
*/
public function setSize($size)
{
$this->size = ($size ?: false);
$this->size = ($size ?: 0);

return $this;
}
Expand All @@ -96,7 +96,7 @@ public function setSize($size)
*/
public function setData($data)
{
$this->data = ($data ?: false);
$this->data = ($data ?: '');

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace phpFastCache\Exceptions;

/**
* Class phpFastCacheDriverException
* Class phpFastCacheDriverCheckException
* @package phpFastCache\Exceptions
*/
class phpFastCacheDriverCheckException extends phpFastCacheDriverException
Expand Down
2 changes: 1 addition & 1 deletion src/phpFastCache/Proxy/phpFastCacheAbstractProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class phpFastCacheAbstractProxy
* @param string $driver
* @param array $config
*/
public function __construct($driver = '', array $config = [])
public function __construct($driver = 'auto', array $config = [])
{
$this->instance = CacheManager::getInstance($driver, $config);
}
Expand Down

0 comments on commit 20f09cd

Please sign in to comment.