Commit 3e3b5477 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Supprime le cache.

Probablement peu utile.
No related merge requests found
Showing with 1 addition and 64 deletions
+1 -64
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
"ext-json": "*", "ext-json": "*",
"beberlei/assert": "^3.2", "beberlei/assert": "^3.2",
"friendsofphp/php-cs-fixer": "^2.16", "friendsofphp/php-cs-fixer": "^2.16",
"symfony/event-dispatcher-contracts": "^1.1",
"symfony/cache": "^4.3",
"symfony/cache-contracts": "^1.1"
}, },
"require-dev": { "require-dev": {
"irstea/composer-require-checker-shim": "^2.0.0", "irstea/composer-require-checker-shim": "^2.0.0",
......
...@@ -13,7 +13,6 @@ namespace Irstea\CS; ...@@ -13,7 +13,6 @@ namespace Irstea\CS;
use Irstea\CS\Composer\ComposerPackage; use Irstea\CS\Composer\ComposerPackage;
use Irstea\CS\Composer\ComposerPackageInterface; use Irstea\CS\Composer\ComposerPackageInterface;
use Irstea\CS\FileLocator\FileLocator; use Irstea\CS\FileLocator\FileLocator;
use Irstea\CS\Git\CachedGitRepository;
use Irstea\CS\Git\GitRepository; use Irstea\CS\Git\GitRepository;
use Irstea\CS\HeaderComment\ChainTemplateProvider; use Irstea\CS\HeaderComment\ChainTemplateProvider;
use Irstea\CS\HeaderComment\FormattedHeaderProvider; use Irstea\CS\HeaderComment\FormattedHeaderProvider;
...@@ -22,7 +21,6 @@ use Irstea\CS\HeaderComment\LicenseTemplateProvider; ...@@ -22,7 +21,6 @@ use Irstea\CS\HeaderComment\LicenseTemplateProvider;
use Irstea\CS\HeaderComment\TemplateFormatter; use Irstea\CS\HeaderComment\TemplateFormatter;
use Irstea\CS\HeaderComment\UserDefinedTemplateProvider; use Irstea\CS\HeaderComment\UserDefinedTemplateProvider;
use PhpCsFixer\Config as PhpCsFixerConfig; use PhpCsFixer\Config as PhpCsFixerConfig;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
/** /**
* Class Config. * Class Config.
...@@ -168,10 +166,7 @@ final class Config extends PhpCsFixerConfig ...@@ -168,10 +166,7 @@ final class Config extends PhpCsFixerConfig
$fileLocator = new FileLocator($callerPath); $fileLocator = new FileLocator($callerPath);
$composerPackage = new ComposerPackage($fileLocator); $composerPackage = new ComposerPackage($fileLocator);
$cache = new ArrayAdapter(); $gitRepository = new GitRepository($callerPath);
$backendGitRepository = new GitRepository($callerPath);
$gitRepository = new CachedGitRepository($backendGitRepository, $cache);
$headerProvider = new FormattedHeaderProvider( $headerProvider = new FormattedHeaderProvider(
new ChainTemplateProvider( new ChainTemplateProvider(
......
<?php declare(strict_types=1);
/*
* irstea/php-cs-fixer-config - Jeux de règles pour php-cs-fixer.
* Copyright (C) 2018-2020 IRSTEA
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
namespace Irstea\CS\Git;
use Symfony\Contracts\Cache\CacheInterface;
/**
* Class CachedGitRepository.
*/
final class CachedGitRepository implements GitRepositoryInterface
{
/**
* @var GitRepositoryInterface
*/
private $inner;
/**
* @var CacheInterface
*/
private $cache;
/**
* CachedGitRepository constructor.
*/
public function __construct(GitRepositoryInterface $inner, CacheInterface $cache)
{
$this->inner = $inner;
$this->cache = $cache;
}
/**
* {@inheritdoc}
*/
public function getHeadCommit(): string
{
// Jamais mis en cache !
return $this->inner->getHeadCommit();
}
/**
* {@inheritdoc}
*/
public function getYearRange(): string
{
return $this->cache->get('git.year-range', [$this->inner, 'getYearRange']);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment