Completed
Push — master ( 36e41a...20c634 )
by Paweł
11:07
created

ArticleAuthorProcessor::processArticleAuthors()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Content Bundle.
7
 *
8
 * Copyright 2018 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2018 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\ContentBundle\Processor;
18
19
use SWP\Bundle\ContentBundle\Model\ArticleAuthor;
20
use SWP\Bundle\ContentBundle\Model\ArticleInterface;
21
22
class ArticleAuthorProcessor
23
{
24
    public static function processArticleAuthors(ArticleInterface $article): void
25
    {
26
        foreach ($article->getAuthors() as $articleAuthor) {
27
            self::setSlugInArticleAuthor($articleAuthor);
28
        }
29
    }
30
31
    public static function setSlugInArticleAuthor(ArticleAuthor $articleAuthor): void
32
    {
33
        if (null === $articleAuthor->getSlug()) {
34
            $articleAuthor->setSlug($articleAuthor->getName());
35
        }
36
    }
37
}
38