Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from jhallbachner/master

PSR-0 Update
  • Loading branch information...
commit cfd3ba892c7cbb86a836112af2e5e65db6650799 2 parents 7e1ccb0 + 92b4015
@tedivm tedivm authored
View
16 Collector/CacheDataCollector.php
@@ -4,8 +4,8 @@
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
-use Stash;
-use StashHandlers;
+use Stash\Cache;
+use Stash\Handlers;
/**
@@ -28,7 +28,7 @@ public function __construct($type, $options)
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $record = Stash::$queryRecord;
+ $record = Cache::$queryRecord;
if(!isset($record))
$record = array();
@@ -36,12 +36,14 @@ public function collect(Request $request, Response $response, \Exception $except
foreach($record as $query => $calls)
$data[$query] = array('calls' => count($calls), 'returns' => array_sum($calls));
- $info = array('calls' => Stash::$cacheCalls, 'returns' => Stash::$cacheReturns, 'record' => $data);
+ $info = array('calls' => Cache::$cacheCalls, 'returns' => Cache::$cacheReturns, 'record' => $data);
$info['handlerType'] = $this->handlerType;
$info['handlerOptions'] = $this->handlerOptions;
- $handlers = StashHandlers::getHandlers();
- foreach($handlers as $handler)
- $info['availableHandlers'][] = substr($handler, 5);
+ $handlers = Handlers::getHandlers();
+ foreach($handlers as $handler) {
+ $pieces = explode('\\', $handler);
+ $info['availableHandlers'][] = array_pop($pieces);
+ }
$info['availableHandlers'] = join(', ', $info['availableHandlers']);
if($this->handlerType === 'MultiHandler') {
View
13 Controller/DefaultController.php
@@ -1,13 +0,0 @@
-<?php
-
-namespace Tedivm\StashBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-
-class DefaultController extends Controller
-{
- public function indexAction()
- {
- return $this->render('TedivmStashBundle:Default:index.html.twig');
- }
-}
View
6 DependencyInjection/Configuration.php
@@ -5,7 +5,7 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
-use StashHandlers;
+use Stash\Handlers;
class Configuration implements ConfigurationInterface
{
@@ -38,7 +38,7 @@ public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('tedivm_stash');
- $handlers = array_keys(StashHandlers::getHandlers());
+ $handlers = array_keys(Handlers::getHandlers());
$default = current($handlers);
$next = $rootNode
@@ -110,7 +110,7 @@ public function addMultiHandlerSettings($rootNode)
$node = $node
->end();
- $handlers = array_keys(StashHandlers::getHandlers());
+ $handlers = array_keys(Handlers::getHandlers());
foreach($handlers as $handler) {
if($handler !== 'MultiHandler') {
$this->addHandlerSettings($handler, $node);
View
4 Factory/HandlerFactory.php
@@ -1,13 +1,13 @@
<?php
namespace Tedivm\StashBundle\Factory;
-use StashHandlers;
+use Stash\Handlers;
class HandlerFactory {
static function createHandler($type, $options)
{
- $handlers = StashHandlers::getHandlers();
+ $handlers = Handlers::getHandlers();
$class = $handlers[$type];
View
1  Resources/views/Default/index.html.twig
@@ -1 +0,0 @@
-Hello!
View
12 Service/Cache.php
@@ -1,8 +1,8 @@
<?php
namespace Tedivm\StashBundle\Service;
-use Stash;
-use StashHandlers;
+use Stash\Cache;
+use Stash\Handlers;
/**
* Simple result-object provider for the Stash class.
@@ -24,7 +24,7 @@ public function __construct($handler)
}
/**
- * Returns a Stash caching object for the specified key. The key can be either a series of string arguments,
+ * Returns a Stash caching object for the specified key. The key can be either a series of string arguments,
* or an array.
*
* @param array|string $key, $key, $key...
@@ -38,7 +38,7 @@ public function get()
$args = $args[0];
$handler = (isset($this->handler)) ? $this->handler : null;
- $stash = new Stash($handler, 'stashbox');
+ $stash = new Cache($handler);
if(count($args) > 0)
$stash->setupKey($args);
@@ -47,7 +47,7 @@ public function get()
}
/**
- * Clears the cache for the key, or if none is specified clears the entire cache. The key can be either
+ * Clears the cache for the key, or if none is specified clears the entire cache. The key can be either
* a series of string arguments, or an array.
*
* @param null|string|array $key, $key, $key...
@@ -77,6 +77,6 @@ public function purge()
*/
public function getHandlers()
{
- return StashHandlers::getHandlers();
+ return Handlers::getHandlers();
}
}
View
3  Tests/Factory/HandlerFactoryTest.php
@@ -3,6 +3,7 @@
namespace Tedivm\StashBundle\Tests\Factory;
use Tedivm\StashBundle\Factory\HandlerFactory;
+use Stash\Utilities;
class HandlerFactoryExtensionTest extends \PHPUnit_Framework_TestCase
{
@@ -14,7 +15,7 @@ public function testManufactureHandlers($class, $type, $options, $tests)
$handler = HandlerFactory::createHandler($type, $options);
if(isset($tests['path']) && $tests['path'] === 'GETPATH')
- $tests['path'] = \StashUtilities::getBaseDirectory($handler);
+ $tests['path'] = Utilities::getBaseDirectory($handler);
$this->assertInstanceOf($class, $handler);
foreach($tests as $attribute => $value) {
View
3  Tests/Service/CacheTest.php
@@ -3,6 +3,7 @@
namespace Tedivm\StashBundle\Tests\Service;
use Tedivm\StashBundle\Service\Cache;
+use Stash\Handler\Ephemeral;
class CacheTest extends \PHPUnit_Framework_TestCase
{
@@ -15,7 +16,7 @@ public static function setUpBeforeClass()
protected function setUp()
{
- $handler = new \StashArray(array());
+ $handler = new Ephemeral(array());
$this->cache = new Cache($handler);
}
Please sign in to comment.
Something went wrong with that request. Please try again.