-
Notifications
You must be signed in to change notification settings - Fork 3
/
DefaultDetector.php
37 lines (30 loc) · 910 Bytes
/
DefaultDetector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace Aeon\Automation\Changes\Detector;
use Aeon\Automation\Changes\Change;
use Aeon\Automation\Changes\Changes;
use Aeon\Automation\Changes\ChangesDetector;
use Aeon\Automation\Changes\ChangesSource;
use Aeon\Automation\Changes\DescriptionPurifier;
use Aeon\Automation\Changes\Type;
final class DefaultDetector implements ChangesDetector
{
/**
* @var DescriptionPurifier
*/
private DescriptionPurifier $purifier;
public function __construct(DescriptionPurifier $purifier)
{
$this->purifier = $purifier;
}
public function support(ChangesSource $changesSource) : bool
{
return true;
}
public function detect(ChangesSource $changesSource) : Changes
{
return new Changes(
new Change($changesSource, Type::changed(), $this->purifier->purify($changesSource->title()))
);
}
}