Skip to content

Commit b360e24

Browse files
committed
Merge pull request #3 from kptLucek/master
Made things more flexible
2 parents f516138 + 76f61bf commit b360e24

8 files changed

Lines changed: 29 additions & 23 deletions

File tree

CacheTagsBundle/Invalidator/Invalidator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace lbarulski\CacheTagsBundle\Invalidator;
44

55
use lbarulski\CacheTagsBundle\Service\Repository;
6-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
6+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
77

88
class Invalidator implements InvalidatorInterface
99
{
@@ -20,7 +20,10 @@ public function __construct(Repository $repository)
2020
$this->repository = $repository;
2121
}
2222

23-
public function invalidate(TagInterface $tag)
23+
/**
24+
* @param CacheTagInterface $tag
25+
*/
26+
public function invalidate(CacheTagInterface $tag)
2427
{
2528
$this->repository->add($tag);
2629
}

CacheTagsBundle/Invalidator/InvalidatorInterface.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
namespace lbarulski\CacheTagsBundle\Invalidator;
44

5-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
5+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
66

77
interface InvalidatorInterface
88
{
9-
public function invalidate(TagInterface $tag);
9+
/**
10+
* @param CacheTagInterface $tag
11+
*/
12+
public function invalidate(CacheTagInterface $tag);
1013
}

CacheTagsBundle/Listener/InvalidatorListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use lbarulski\CacheTagsBundle\Invalidator\Proxy\ManagerInterface;
66
use lbarulski\CacheTagsBundle\Service\Repository;
7-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
7+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
88

99
class InvalidatorListener
1010
{
@@ -35,11 +35,11 @@ public function invalidate()
3535
}
3636

3737
/**
38-
* @param TagInterface $tag
38+
* @param CacheTagInterface $tag
3939
*/
40-
private function invalidateTag(TagInterface $tag)
40+
private function invalidateTag(CacheTagInterface $tag)
4141
{
42-
$tagValue = $tag->getTag();
42+
$tagValue = $tag->getCacheTag();
4343
$proxies = $this->manager->getProxies();
4444
foreach ($proxies as $proxy)
4545
{

CacheTagsBundle/Service/Repository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66

77
namespace lbarulski\CacheTagsBundle\Service;
88

9-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
9+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
1010

1111
class Repository
1212
{
1313
/**
14-
* @var TagInterface[]
14+
* @var CacheTagInterface[]
1515
*/
1616
private $tags = [];
1717

1818
/**
19-
* @param TagInterface $tag
19+
* @param CacheTagInterface $tag
2020
*/
21-
public function add(TagInterface $tag)
21+
public function add(CacheTagInterface $tag)
2222
{
2323
$this->tags[] = $tag;
2424
}
2525

2626
/**
27-
* @return TagInterface[]
27+
* @return CacheTagInterface[]
2828
*/
2929
public function getTags()
3030
{

CacheTagsBundle/Service/Tagger.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace lbarulski\CacheTagsBundle\Service;
88

9-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
9+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
1010
use Symfony\Component\HttpFoundation\Response;
1111

1212
class Tagger
@@ -24,15 +24,15 @@ public function __construct($headerName)
2424

2525
/**
2626
* @param Response $response
27-
* @param TagInterface[] $tags
27+
* @param CacheTagInterface[] $tags
2828
* @param bool $replace
2929
*/
3030
public function tagResponse(Response $response, $tags, $replace = false)
3131
{
3232
$tagValues = [];
3333
foreach ($tags as $tag)
3434
{
35-
$tagValues[] = $tag->getTag();
35+
$tagValues[] = $tag->getCacheTag();
3636
}
3737

3838
if (!$replace && $response->headers->has($this->headerName))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace lbarulski\CacheTagsBundle\Tag;
88

9-
interface TagInterface
9+
interface CacheTagInterface
1010
{
1111
/**
1212
* @return string
1313
*/
14-
public function getTag();
14+
public function getCacheTag();
1515
}

CacheTagsBundle/Tag/Plain.php

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

77
namespace lbarulski\CacheTagsBundle\Tag;
88

9-
class Plain implements TagInterface
9+
class Plain implements CacheTagInterface
1010
{
1111
/**
1212
* @var string
@@ -22,7 +22,7 @@ public function __construct($value)
2222
}
2323

2424
/** {@inheritdoc} */
25-
public function getTag()
25+
public function getCacheTag()
2626
{
2727
return $this->value;
2828
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ public function articleAction(Request $request)
111111
```php
112112
// Acme\MainBundle\Entity\Article.php
113113

114-
use lbarulski\CacheTagsBundle\Tag\TagInterface;
114+
use lbarulski\CacheTagsBundle\Tag\CacheTagInterface;
115115

116-
class Article implements TagInterface
116+
class Article implements CacheTagInterface
117117
{
118118
...
119119

120-
public function getTag()
120+
public function getCacheTag()
121121
{
122122
return 'article_'.$this->getId();
123123
}

0 commit comments

Comments
 (0)