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

PostArchiveAction::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
rs 9.568
cc 2
nc 2
nop 1
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