Completed
Push — master ( 37876c...34238f )
by Marko
9s
created

PostArchiveAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 22 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\NewsBundle\Action;
15
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Response;
18
19
final class PostArchiveAction extends AbstractPostArchiveAction
20
{
21
    /**
22
     * @return Response
23
     */
24
    public function __invoke(Request $request)
25
    {
26
        if ($seoPage = $this->getSeoPage()) {
27
            $seoPage
28
                ->setTitle($this->trans('archive.meta_title', [
29
                    '%title%' => $this->getBlog()->getTitle(),
30
                ]))
31
                ->addMeta('property', 'og:title', $this->trans('archive.meta_title', [
32
                    '%title%' => $this->getBlog()->getTitle(),
33
                ]))
34
                ->addMeta('name', 'description', $this->trans('archive.meta_description', [
35
                    '%title%' => $this->getBlog()->getTitle(),
36
                    '%description%' => $this->getBlog()->getDescription(),
37
                ]))
38
                ->addMeta('property', 'og:description', $this->trans('archive.meta_description', [
39
                    '%title%' => $this->getBlog()->getTitle(),
40
                    '%description%' => $this->getBlog()->getDescription(),
41
                ]));
42
        }
43
44
        return $this->renderArchive($request);
45
    }
46
}
47