Passed
Branch dev (b7aeac)
by Dispositif
03:10
created

GoogleBooksWorker   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A processDomain() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of dispositif/wikibot application
5
 * 2019 : Philippe M. <[email protected]>
6
 * For the full copyright and MIT license information, please view the LICENSE file.
7
 */
8
declare(strict_types=1);
9
10
namespace App\Application;
11
12
use App\Domain\GoogleTransformer;
13
use Throwable;
14
15
/**
16
 * todo Refac duplication
17
 * externe goo
18
 * Class GoogleBooksWorker
19
 *
20
 * @package App\Application\Examples
21
 */
22
class GoogleBooksWorker extends AbstractBotTaskWorker
23
{
24
    const TASK_NAME           = "Amélioration bibliographique : lien Google Books ⇒ {ouvrage}"; // 😎
25
    const SLEEP_AFTER_EDITION = 300;
26
    protected $botFlag = false;
27
28
    protected $modeAuto = true;
29
30
    /**
31
     * @param string      $title
32
     * @param string|null $text
33
     *
34
     * @return string|null
35
     * @throws Throwable
36
     */
37
    protected function processDomain(string $title, ?string $text): ?string
38
    {
39
        $ref = new GoogleTransformer();
40
41
        return $ref->process($text);
0 ignored issues
show
Bug introduced by
It seems like $text can also be of type null; however, parameter $text of App\Domain\GoogleTransformer::process() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
        return $ref->process(/** @scrutinizer ignore-type */ $text);
Loading history...
42
    }
43
}
44
45
46
47
48
49
50
51
52