Skip to content

Commit

Permalink
rename the with-functions to be camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
ata-no-one committed Sep 6, 2024
1 parent be915d8 commit 35a3bf3
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions php/examples/VaasExample/GetVerdictByFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
);

$vaas = (new Vaas())
->WithAuthenticator($authenticator)
->WithUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->withAuthenticator($authenticator)
->withUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->build();

$scanPath = getenv("SCAN_PATH");
Expand Down
4 changes: 2 additions & 2 deletions php/examples/VaasExample/GetVerdictByHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
getenv("TOKEN_URL") ?: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
);
$vaas = (new Vaas())
->WithAuthenticator($authenticator)
->WithUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->withAuthenticator($authenticator)
->withUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->build();

// EICAR
Expand Down
4 changes: 2 additions & 2 deletions php/examples/VaasExample/GetVerdictByUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
getenv("TOKEN_URL") ?: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
);
$vaas = (new Vaas())
->WithAuthenticator($authenticator)
->WithUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->withAuthenticator($authenticator)
->withUrl(getenv("VAAS_URL") ?? "wss://gateway.production.vaas.gdatasecurity.de")
->build();

// EICAR
Expand Down
2 changes: 1 addition & 1 deletion php/examples/wordpress/src/gd-scan/Vaas/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct()
getenv("TOKEN_URL") ?: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
);
$this->vaas = (new Vaas())
->WithAuthenticator($authenticator)
->withAuthenticator($authenticator)
->build();
}

Expand Down
22 changes: 11 additions & 11 deletions php/src/vaas/Vaas.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,37 @@ public function __destruct() {
}
}

public function WithOptions(VaasOptions $options): self
public function withOptions(VaasOptions $options): self
{
$this->options = $options;
return $this;
}

public function WithHtttpClient(HttpClient $httpClient): self
public function withHtttpClient(HttpClient $httpClient): self
{
$this->httpClient = $httpClient;
return $this;
}

public function WithAuthenticator(AuthenticatorInterface $authenticator): self
public function withAuthenticator(AuthenticatorInterface $authenticator): self
{
$this->authenticator = $authenticator;
return $this;
}

public function WithLogger(LoggerInterface $logger): self
public function withLogger(LoggerInterface $logger): self
{
$this->logger = $logger;
return $this;
}

public function WithUrl(string $vaasUrl): self
public function withUrl(string $vaasUrl): self
{
$this->vaasUrl = $vaasUrl;
return $this;
}

public function WithVaasConnection(VaasConnection $vaasConnection): self
public function withVaasConnection(VaasConnection $vaasConnection): self
{
$this->vaasConnection = $vaasConnection;
return $this;
Expand All @@ -90,14 +90,14 @@ public function build(): self
}
if (!isset($this->vaasConnection) && isset($this->authenticator)) {
$this->vaasConnection = (new VaasConnection())
->WithAuthenticator($this->authenticator)
->WithUrl($this->vaasUrl)
->WithLogger($this->logger)
->withAuthenticator($this->authenticator)
->withUrl($this->vaasUrl)
->withLogger($this->logger)
->build();
} else if (!isset($this->vaasConnection)) {
$this->vaasConnection = (new VaasConnection())
->WithUrl($this->vaasUrl)
->WithLogger($this->logger)
->withUrl($this->vaasUrl)
->withLogger($this->logger)
->build();
}
if (!isset($this->options)) {
Expand Down
10 changes: 5 additions & 5 deletions php/src/vaas/VaasConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ public function close(): void {
$this->loop->ignore();
}

public function WithAuthenticator(AuthenticatorInterface $authenticator): VaasConnection {
public function withAuthenticator(AuthenticatorInterface $authenticator): VaasConnection {
$this->authenticator = $authenticator;
return $this;
}

public function WithConnection(WebsocketConnection $WebSocketClient): VaasConnection {
public function withConnection(WebsocketConnection $WebSocketClient): VaasConnection {
$this->WebSocketClient = $WebSocketClient;
return $this;
}

public function WithUrl(string $url): VaasConnection {
public function withUrl(string $url): VaasConnection {
$this->url = $url;
return $this;
}

public function WithLogger(LoggerInterface $logger): VaasConnection {
public function withLogger(LoggerInterface $logger): VaasConnection {
$this->logger = $logger;
return $this;
}

public function WithTimeout(int $timeoutInSeconds): VaasConnection {
public function withTimeout(int $timeoutInSeconds): VaasConnection {
$this->waitTimeoutInSeconds = $timeoutInSeconds;
return $this;
}
Expand Down
12 changes: 6 additions & 6 deletions php/tests/vaas/ProtocolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public function testConnectionGetsClosedAfterConnecting_ThrowsVaasConnectionClos
$fakeWebsocket->method('receive')
->willReturn(WebsocketMessage::fromText('{"kind": "AuthResponse", "success": true, "session_id": "id"}'));
$vaasConnection = (new VaasConnection())
->WithConnection($fakeWebsocket)
->withConnection($fakeWebsocket)
->build();

$vaas = (new Vaas())
->WithUrl("wws://url.de")
->WithVaasConnection($vaasConnection)
->withUrl("wws://url.de")
->withVaasConnection($vaasConnection)
->build();
$vaas->Connect("valid");
$vaas->ForSha256("000005c43196142f01d615a67b7da8a53cb0172f8e9317a2ec9a0a39a1da6fe8");
Expand All @@ -64,12 +64,12 @@ public function testConnectionGetsClosedBeforeConnect_ThrowsVaasConnectionClosed
$fakeWebsocket->method('receive')
->willReturn(WebsocketMessage::fromText('{"kind": "AuthResponse", "success": true, "session_id": "id"}'));
$vaasConnection = (new VaasConnection())
->WithConnection($fakeWebsocket)
->withConnection($fakeWebsocket)
->build();

$vaas = (new Vaas())
->WithUrl("wws://url.de")
->WithVaasConnection($vaasConnection)
->withUrl("wws://url.de")
->withVaasConnection($vaasConnection)
->build();
$vaas->Connect("valid");
}
Expand Down
6 changes: 3 additions & 3 deletions php/tests/vaas/VaasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public function setUp(): void
private function _getVaas(bool $useCache = false, bool $useHashLookup = true, LoggerInterface $logger = null): Vaas
{
return (new Vaas())
->WithUrl($_ENV["VAAS_URL"])
->WithLogger($logger ?? $this->_getDebugLogger())
->WithOptions(new VaasOptions($useCache, $useHashLookup))
->withUrl($_ENV["VAAS_URL"])
->withLogger($logger ?? $this->_getDebugLogger())
->withOptions(new VaasOptions($useCache, $useHashLookup))
->build();
}

Expand Down

0 comments on commit 35a3bf3

Please sign in to comment.