-
Notifications
You must be signed in to change notification settings - Fork 0
/
PhishingService.php
56 lines (47 loc) · 1.5 KB
/
PhishingService.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace SomeCompanyNamespace\Services\Phishing;
use SomeCompanyNamespace\Services\Phishing\Handlers\GetScanUrlReportHandler;
use SomeCompanyNamespace\Services\Phishing\Handlers\UrlScanRequestHandler;
use SomeCompanyNamespace\Services\Phishing\Handlers\ScanUrlHandler;
use SomeCompanyNamespace\Services\Phishing\Requests\ScanUrlRequest;
final class PhishingService
{
/**
* This is the entry point for scanning URLs
*
* @param string $url
* @param int $customerId
* @param int|null $surveyId
*/
public static function scan(string $url, int $customerId, ?int $surveyId = null, int $priority = ScanUrlRequest::PRIORITY_HIGH): void
{
$urlScanRequestHandler = new UrlScanRequestHandler();
$scanUrlRequest = new ScanUrlRequest();
$scanUrlRequest->setUrl($url);
$scanUrlRequest->setCustomerId($customerId);
$scanUrlRequest->setSurveyId($surveyId);
$scanUrlRequest->setPriority($priority);
$scanUrlRequest->setState(PhishingState::RECEIVED);
$urlScanRequestHandler->process($scanUrlRequest);
}
/**
* This is the entry point for getting the scan report
*
* @return void
*/
public static function getReport(): void
{
$getScanUrlReportHandler = new GetScanUrlReportHandler();
$getScanUrlReportHandler->process(new ScanUrlRequest());
}
/**
* This is the entry point for sending urls to vendor for beign scanned
*
* @return void
*/
public static function scanUrl(): void
{
$scanUrlHandler = new ScanUrlHandler();
$scanUrlHandler->process(new ScanUrlRequest());
}
}