Skip to content

Commit

Permalink
Merge pull request #405 from AntonShevchuk/master
Browse files Browse the repository at this point in the history
Fixed error with FileSystemCache
  • Loading branch information
Anton authored Apr 7, 2017
2 parents 98de1ca + 408cd7d commit 0ea9e76
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2016 by Bluz PHP Team
Copyright (c) 2012-2017 by Bluz PHP Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 16 additions & 3 deletions src/Proxy/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Bluz\Proxy;

use Bluz\Common\Exception\ComponentException;
use Cache\Hierarchy\HierarchicalPoolInterface;
use Cache\Taggable\TaggablePoolInterface as Instance;

/**
Expand All @@ -34,9 +35,6 @@
*
* @method static bool clear()
* @see CacheItemPoolInterface::clear()
*
* @method static bool clearTags(array $tags)
* @see TaggablePoolInterface::clearTags()
*/
class Cache
{
Expand Down Expand Up @@ -147,4 +145,19 @@ public static function prepare($key)
{
return str_replace(['-', '/'], '_', $key);
}

/**
* Clear cache items by tags
*
* @see TaggablePoolInterface::clearTags()
*
* @return bool
*/
public static function clearTags(array $tags)
{
if (self::getInstance() instanceof HierarchicalPoolInterface) {
return self::getInstance()->clearTags($tags);
}
return false;
}
}
5 changes: 5 additions & 0 deletions src/Proxy/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ public static function getAccept($allowTypes = [])
// get header from request
$header = self::getHeader('accept');

// nothing ...
if (!$header) {
return null;
}

// make array if types
$header = explode(',', $header);
$header = array_map('trim', $header);
Expand Down
2 changes: 1 addition & 1 deletion tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
define('PATH_APPLICATION', PATH_ROOT . '/tests');
define('PATH_VENDOR', PATH_ROOT . '/vendor');

// init autoloader
// Use composer autoload
$loader = require PATH_ROOT . '/vendor/autoload.php';
$loader->addPsr4('Bluz\\Tests\\', __DIR__ .'/src');

0 comments on commit 0ea9e76

Please sign in to comment.