Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 958fe2e

Browse files
committed
FIX: sf4 compatibility
1 parent 46bebd7 commit 958fe2e

File tree

12 files changed

+44
-43
lines changed

12 files changed

+44
-43
lines changed

Command/PhpfastcacheCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace Phpfastcache\Bundle\Command;
1818

1919
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20-
use Phpfastcache\Exceptions\phpFastCacheDriverCheckException;
20+
use Phpfastcache\Exceptions\PhpfastcacheDriverCheckException;
2121
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
2222
use Symfony\Component\Console\Input\InputArgument;
2323
use Symfony\Component\Console\Input\InputInterface;
@@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
5959
$output->writeln("<fg=green>Cache instance {$name} cleared</>");
6060
}
61-
}catch (phpFastCacheDriverCheckException $e){
61+
}catch (PhpfastcacheDriverCheckException $e){
6262
$failedInstances[] = $name;
6363
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
6464
$output->writeln("<fg=red>Cache instance {$name} not cleared, got exception: " . "<bg=red;options=bold>" . $e->getMessage() ."</>");

DataCollector/CacheCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class CacheCollector extends DataCollector
2828
{
2929
/**
30-
* @var \phpFastCache\Bundle\Service\Cache
30+
* @var \Phpfastcache\Bundle\Service\Cache
3131
*/
3232
private $cache;
3333

@@ -39,7 +39,7 @@ class CacheCollector extends DataCollector
3939
/**
4040
* CacheCollector constructor.
4141
*
42-
* @param \phpFastCache\Bundle\Service\Cache $cache
42+
* @param \Phpfastcache\Bundle\Service\Cache $cache
4343
*/
4444
public function __construct(Cache $cache)
4545
{

DependencyInjection/PhpfastcacheExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace Phpfastcache\Bundle\DependencyInjection;
1818

19-
use Phpfastcache\Exceptions\phpFastCacheDriverException;
19+
use Phpfastcache\Exceptions\PhpfastcacheDriverException;
2020
use Symfony\Component\DependencyInjection\ContainerBuilder;
2121
use Symfony\Component\Config\FileLocator;
2222
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
@@ -31,8 +31,8 @@ class PhpfastcacheExtension extends Extension
3131
/**
3232
* {@inheritDoc}
3333
*
34-
* @throws \phpFastCache\Exceptions\phpFastCacheDriverCheckException
35-
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
34+
* @throws \Phpfastcache\Exceptions\PhpfastcacheDriverCheckException
35+
* @throws \Phpfastcache\Exceptions\PhpfastcacheDriverException
3636
* @throws \Exception
3737
* @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
3838
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
@@ -55,10 +55,10 @@ public function load(array $configs, ContainerBuilder $container)
5555
$config = $this->processConfiguration($configuration, $configs);
5656

5757
foreach ($config['drivers'] as $name => $driver) {
58-
$class = "phpFastCache\\Drivers\\" . $driver['type'] . '\Driver';
58+
$class = "Phpfastcache\\Drivers\\" . $driver['type'] . '\Driver';
5959
foreach ($driver['parameters'] as $parameter_name => $parameter) {
6060
if (!$class::isValidOption($parameter_name, $parameter)) {
61-
throw new phpFastCacheDriverException("Option $parameter_name in driver {$driver['type']} doesn't exists");
61+
throw new PhpfastcacheDriverException("Option $parameter_name in driver {$driver['type']} doesn't exists");
6262
}
6363
}
6464
}

Docs/Example/Controller/DefaultController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Routing\Annotation\Route;
66
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
77
use Symfony\Component\HttpFoundation\Request;
8-
use Phpfastcache\Exceptions\phpFastCacheDriverCheckException;
8+
use Phpfastcache\Exceptions\PhpfastcacheDriverCheckException;
99

1010
class DefaultController extends Controller
1111
{
@@ -31,7 +31,7 @@ public function indexAction(Request $request)
3131
try{
3232
$cache9 = $this->get('phpfastcache')->get('apccache');
3333
$cache10 = $this->get('phpfastcache')->get('apcucache');
34-
}catch(phpFastCacheDriverCheckException $e){
34+
}catch(PhpfastcacheDriverCheckException $e){
3535
$cache11 = $this->get('phpfastcache')->get('xcachecache');
3636
}
3737

Docs/Example/app/AppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function registerBundles()
1919
/**
2020
* PhpFastCache Bundle
2121
*/
22-
new phpFastCache\Bundle\phpFastCacheBundle(),
22+
new Phpfastcache\Bundle\phpFastCacheBundle(),
2323
];
2424

2525
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ php_fast_cache:
3333
#### :wrench: Step 3: Setup your AppKernel.php by adding the phpFastCache Bundle
3434
3535
```php
36-
$bundles[] = new phpFastCache\Bundle\phpFastCacheBundle();
36+
$bundles[] = new Phpfastcache\Bundle\phpFastCacheBundle();
3737
```
3838

3939
* See the file Docs/Example/app/AppKernel.php for more information.

Resources/config/services.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
parameters:
2-
php_fast_cache.cache.class: phpFastCache\Bundle\Service\Cache
3-
php_fast_cache.human_readable.class: phpFastCache\Bundle\Twig\HumanReadableExtension\Extension
4-
php_fast_cache.twig_cache.class: phpFastCache\Bundle\Twig\CacheExtension\Extension
5-
php_fast_cache.twig_cache_stategy.class: phpFastCache\Bundle\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy
6-
php_fast_cache.twig_cache_provider.class: phpFastCache\Bundle\Twig\CacheExtension\CacheProvider\PsrCacheAdapter
2+
php_fast_cache.cache.class: Phpfastcache\Bundle\Service\Cache
3+
php_fast_cache.human_readable.class: Phpfastcache\Bundle\Twig\HumanReadableExtension\Extension
4+
php_fast_cache.twig_cache.class: Phpfastcache\Bundle\Twig\CacheExtension\Extension
5+
php_fast_cache.twig_cache_stategy.class: Phpfastcache\Bundle\Twig\CacheExtension\CacheStrategy\LifetimeCacheStrategy
6+
php_fast_cache.twig_cache_provider.class: Phpfastcache\Bundle\Twig\CacheExtension\CacheProvider\PsrCacheAdapter
77

88
services:
9-
phpfastcache:
10-
class: "%php_fast_cache.cache.class%"
9+
Phpfastcache\Bundle\Service\Cache:
10+
autowire: true
11+
public: false
1112
arguments:
1213
- "%phpfastcache%"
1314
- "@?debug.stopwatch"
@@ -17,7 +18,7 @@ services:
1718
- { name: twig.extension }
1819
phpfastcache.twig_cache_driver_provider:
1920
class: "%php_fast_cache.cache.class%"
20-
factory: [ "@phpfastcache", "getTwigCacheInstance" ]
21+
factory: 'Phpfastcache\Bundle\Service\Cache:getTwigCacheInstance'
2122
phpfastcache.twig_cache_provider:
2223
class: "%php_fast_cache.twig_cache_provider.class%"
2324
arguments:
@@ -33,4 +34,4 @@ services:
3334
arguments:
3435
- "@phpfastcache.twig_cache_stategy"
3536
tags:
36-
- { name: twig.extension }
37+
- { name: twig.extension }

Resources/config/services_dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
parameters:
2-
php_fast_cache.data_collector.class: phpFastCache\Bundle\DataCollector\CacheCollector
2+
php_fast_cache.data_collector.class: Phpfastcache\Bundle\DataCollector\CacheCollector
33

44
services:
55
phpfastcache.request_collector:
66
class: "%php_fast_cache.data_collector.class%"
77
arguments:
8-
- "@phpfastcache"
8+
- '@Phpfastcache\Bundle\Service\Cache'
99
public: false
1010
tags:
1111
-
1212
name: data_collector
13-
template: '@phpFastCache/data_collector/template.html.twig'
13+
template: '@Phpfastcache/data_collector/template.html.twig'
1414
id: 'phpfastcache'
1515
priority: 300

Resources/views/data_collector/template.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
{% block toolbar %}
1616
{% set icon %}
17-
<span class="icon">{{ include('@phpFastCache/data_collector/icon.svg') }}</span>
17+
<span class="icon">{{ include('@Phpfastcache/data_collector/icon.svg') }}</span>
1818
<span class="sf-toolbar-value">{{ collector.size|sizeFormat(1) }}</span>
1919
{% endset %}
2020

@@ -68,7 +68,7 @@
6868

6969
{% block menu %}
7070
<span class="label{% if collector.stats|length == 0 %} disabled{% endif %}">
71-
<span class="icon">{{ include('@phpFastCache/data_collector/icon.svg') }}</span>
71+
<span class="icon">{{ include('@Phpfastcache/data_collector/icon.svg') }}</span>
7272
<strong>PhpFastCache</strong>
7373
{% if collector.stats|length > 0 %}
7474
<span class="count">

Service/Cache.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
1919
use Phpfastcache\CacheManager;
20-
use Phpfastcache\Exceptions\phpFastCacheDriverException;
20+
use Phpfastcache\Exceptions\PhpfastcacheDriverException;
2121
use Symfony\Component\Stopwatch\Stopwatch;
2222

2323
/**
@@ -39,7 +39,7 @@ class Cache
3939
/**
4040
* Contains all cache instances
4141
*
42-
* @var \phpFastCache\Cache\ExtendedCacheItemPoolInterface[]
42+
* @var \Phpfastcache\Cache\ExtendedCacheItemPoolInterface[]
4343
*/
4444
private $cacheInstances = [];
4545

@@ -49,7 +49,7 @@ class Cache
4949
* @param array $config
5050
* @param Stopwatch $stopwatch
5151
*
52-
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
52+
* @throws \Phpfastcache\Exceptions\phpFastCacheDriverException
5353
*/
5454
public function __construct($config, Stopwatch $stopwatch = null)
5555
{
@@ -63,12 +63,12 @@ public function __construct($config, Stopwatch $stopwatch = null)
6363
* @param string $name
6464
* @param ExtendedCacheItemPoolInterface $instance
6565
*
66-
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
66+
* @throws \Phpfastcache\Exceptions\phpFastCacheDriverException
6767
*/
6868
public function createInstance($name, ExtendedCacheItemPoolInterface $instance)
6969
{
7070
if (array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) {
71-
throw new phpFastCacheDriverException("Cache instance '{$name}' already exists");
71+
throw new PhpfastcacheDriverException("Cache instance '{$name}' already exists");
7272
}
7373
$this->cacheInstances[ $name ] = $instance;
7474
}
@@ -78,9 +78,9 @@ public function createInstance($name, ExtendedCacheItemPoolInterface $instance)
7878
*
7979
* @param string $name Name of configured driver
8080
*
81-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface
81+
* @return \Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface
8282
*
83-
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
83+
* @throws \Phpfastcache\Exceptions\phpFastCacheDriverException
8484
*/
8585
public function get($name)
8686
{
@@ -92,10 +92,10 @@ public function get($name)
9292
if (array_key_exists($name, $this->config[ 'drivers' ])) {
9393
$this->createInstance($name, CacheManager::getInstance($this->config[ 'drivers' ][ $name ][ 'type' ], $this->config[ 'drivers' ][ $name ][ 'parameters' ]));
9494
if (!$this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) {
95-
throw new phpFastCacheDriverException("Cache instance '{$name}' does not implements ExtendedCacheItemPoolInterface");
95+
throw new PhpfastcacheDriverException("Cache instance '{$name}' does not implements ExtendedCacheItemPoolInterface");
9696
}
9797
} else {
98-
throw new phpFastCacheDriverException("Cache instance '{$name}' not exists, check your config.yml");
98+
throw new PhpfastcacheDriverException("Cache instance '{$name}' not exists, check your config.yml");
9999
}
100100
}
101101

@@ -106,7 +106,7 @@ public function get($name)
106106
}
107107

108108
/**
109-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface
109+
* @return \Phpfastcache\Cache\ExtendedCacheItemPoolInterface
110110
*/
111111
public function getTwigCacheInstance()
112112
{
@@ -126,7 +126,7 @@ public function getConfig()
126126
/**
127127
* Return all cache instances
128128
*
129-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface[]
129+
* @return \Phpfastcache\Cache\ExtendedCacheItemPoolInterface[]
130130
*/
131131
public function getInstances()
132132
{

Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ class LifetimeCacheStrategy implements CacheStrategyInterface
4343
private $config = [];
4444

4545
/**
46-
* @var \phpFastCache\Bundle\Twig\CacheExtension\CacheProviderInterface
46+
* @var \Phpfastcache\Bundle\Twig\CacheExtension\CacheProviderInterface
4747
*/
4848
private $cache;
4949

5050
/**
51-
* @var \phpFastCache\Bundle\DataCollector\CacheCollector
51+
* @var \Phpfastcache\Bundle\DataCollector\CacheCollector
5252
*/
5353
private $cacheCollector;
5454

5555
/**
5656
* LifetimeCacheStrategy constructor.
57-
* @param \phpFastCache\Bundle\Twig\CacheExtension\CacheProviderInterface $cache
58-
* @param \phpFastCache\Bundle\DataCollector\CacheCollector $cacheCollector
57+
* @param \Phpfastcache\Bundle\Twig\CacheExtension\CacheProviderInterface $cache
58+
* @param \Phpfastcache\Bundle\DataCollector\CacheCollector $cacheCollector
5959
* @param array $config
6060
*/
6161
public function __construct(CacheProviderInterface $cache, CacheCollector $cacheCollector = null, $config)

Twig/CacheExtension/Node/CacheNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function compile(\Twig_Compiler $compiler)
4646
$i = self::$cacheCount++;
4747

4848
if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
49-
$extension = 'phpFastCache\Bundle\Twig\CacheExtension\Extension';
49+
$extension = 'Phpfastcache\Bundle\Twig\CacheExtension\Extension';
5050
} else {
5151
$extension = 'phpfastcache_cache';
5252
}

0 commit comments

Comments
 (0)