Content-Length: 339975 | pFad | http://github.com/sulu/SuluArticleBundle/commit/276abbc17643141789b057624146faa959cdacd1

02 Implement CacheLifetimeBehaviourInterface in ArticleBridge (#621) · sulu/SuluArticleBundle@276abbc · GitHub
Skip to content

Commit

Permalink
Implement CacheLifetimeBehaviourInterface in ArticleBridge (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-rath authored Sep 20, 2022
1 parent 95911e5 commit 276abbc
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
'phpdoc_types_order' => false,
'single_line_throw' => false,
'single_line_comment_spacing' => false,
'phpdoc_to_comment' => [
'ignored_tags' => ['todo', 'var', 'see', 'phpstan-ignore-next-line'],
],
])
->setFinder($finder);

Expand Down
18 changes: 17 additions & 1 deletion Document/Structure/ArticleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Own structure bridge for articles.
*/
class ArticleBridge extends StructureBridge
class ArticleBridge extends StructureBridge implements RoutableStructureInterface
{
/**
* @var string
Expand All @@ -30,9 +30,25 @@ class ArticleBridge extends StructureBridge

public function getView(): string
{
/** @var string */
return $this->structure->getView();
}

public function getController(): string
{
/** @var string */
return $this->structure->getController();
}

/**
* @return array{type: string, value: string}
*/
public function getCacheLifeTime(): array
{
/** @var array{type: string, value: string} */
return $this->structure->getCacheLifetime();
}

public function getUuid()
{
// is set for structure loaded with document from document-manager
Expand Down
61 changes: 61 additions & 0 deletions Document/Structure/RoutableStructureInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

declare(strict_types=1);

/*
* This file is part of Sulu.
*
* (c) Sulu GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\ArticleBundle\Document\Structure;

use Sulu\Component\Content\Compat\RoutableStructureInterface as SuluRoutableStructureInterface;

if (\interface_exists(SuluRoutableStructureInterface::class)) {
/**
* @deprecated will be removed, as soon as the ArticleBundle rises the minimum requirement of sulu to a version,
* where this interface exists
*
* @internal
*/
interface RoutableStructureInterface extends SuluRoutableStructureInterface
{
}
} else {
/**
* @deprecated will be removed, as soon as the ArticleBundle rises the minimum requirement of sulu to a version,
* where this interface exists
*
* @internal
*/
interface RoutableStructureInterface
{
/**
* twig template of template definition.
*
* @return string
*/
public function getView();

/**
* controller which renders the twig template.
*
* @return string
*/
public function getController();

/**
* cacheLifeTime of template definition.
*
* @return array{
* type: string,
* value: string,
* }
*/
public function getCacheLifeTime();
}
}
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1525,11 +1525,6 @@ parameters:
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:getView\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:setUuid\\(\\) has no return type specified\\.$#"
count: 1
Expand Down

0 comments on commit 276abbc

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sulu/SuluArticleBundle/commit/276abbc17643141789b057624146faa959cdacd1

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy