Skip to content

Commit

Permalink
Fixed CS, removed obsolete test parts
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixJacobi committed Aug 23, 2024
1 parent b2a7a0d commit e0f653e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/BigBlueButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class BigBlueButton
public function __construct(?string $baseUrl = null, ?string $secret = null, ?TransportInterface $transport = null, protected HashingAlgorithm $hashingAlgorithm = HashingAlgorithm::SHA_1)
{
if (null === $baseUrl) {
@trigger_error(\sprintf('Constructing "%s" without passing a server base URL is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
@trigger_error(sprintf('Constructing "%s" without passing a server base URL is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
}

if (null === $secret) {
@trigger_error(\sprintf('Constructing "%s" without passing a secret is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
@trigger_error(sprintf('Constructing "%s" without passing a secret is deprecated and will throw an exception 6.0.', self::class), \E_USER_DEPRECATED);
}

if (getenv('BBB_SECURITY_SALT') !== false || getenv('BBB_SECRET') !== false) {
Expand All @@ -117,7 +117,7 @@ public function __construct(?string $baseUrl = null, ?string $secret = null, ?Tr

if (false === $securitySecret) {
// @codeCoverageIgnoreStart
@trigger_error(\sprintf('Constructing "%s" without passing a secret is deprecated since 6.0 and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED);
@trigger_error(sprintf('Constructing "%s" without passing a secret is deprecated since 6.0 and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED);
$this->securitySecret = ''; // previous behaviour
// @codeCoverageIgnoreEnd
} else {
Expand All @@ -128,7 +128,7 @@ public function __construct(?string $baseUrl = null, ?string $secret = null, ?Tr

if (false === $bbbServerBaseUrl) {
// @codeCoverageIgnoreStart
@trigger_error(\sprintf('Constructing "%s" without passing a server base URL is deprecated since 6.0 and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED);
@trigger_error(sprintf('Constructing "%s" without passing a server base URL is deprecated since 6.0 and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED);
$this->bbbServerBaseUrl = ''; // previous behaviour
// @codeCoverageIgnoreEnd
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

// @codeCoverageIgnoreStart
if (!interface_exists(ClientInterface::class)) {
throw new \LogicException(\sprintf(
throw new \LogicException(sprintf(
'The "%s" interface was not found. '.
'You cannot use "%s" without it.'.
'Try running "composer require" for a package which provides psr/http-client-implementation.',
Expand All @@ -44,7 +44,7 @@
}

if (!interface_exists(RequestFactoryInterface::class)) {
throw new \LogicException(\sprintf(
throw new \LogicException(sprintf(
'The "%s" interface was not found. '.
'You cannot use "%s" without it.'.
'Try running "composer require" for a package which provides psr/http-factory-implementation.',
Expand All @@ -54,7 +54,7 @@
}

if (!interface_exists(StreamFactoryInterface::class)) {
throw new \LogicException(\sprintf(
throw new \LogicException(sprintf(
'The "%s" interface was not found. '.
'You cannot use "%s" without it.'.
'Try running "composer require" for a package which provides psr/http-factory-implementation.',
Expand Down Expand Up @@ -93,7 +93,7 @@ public function request(TransportRequest $request): TransportResponse
try {
$psrResponse = $this->httpClient->sendRequest($psrRequest);
} catch (ClientExceptionInterface $e) {
throw new RuntimeException(\sprintf('HTTP request failed: %s', $e->getMessage()), 0, $e);
throw new RuntimeException(sprintf('HTTP request failed: %s', $e->getMessage()), 0, $e);
}

if ($psrResponse->getStatusCode() < 200 || $psrResponse->getStatusCode() >= 300) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

// @codeCoverageIgnoreStart
if (!interface_exists(HttpClientInterface::class)) {
throw new \LogicException(\sprintf(
throw new \LogicException(sprintf(
'The "%s" interface was not found. '.
'You cannot use "%s" without it.'.
'Try running "composer require" for a package which provides symfony/http-client-implementation.',
Expand Down Expand Up @@ -71,7 +71,7 @@ public static function create(array $defaultHeaders = [], array $defaultOptions
{
// @codeCoverageIgnoreStart
if (!class_exists(HttpClient::class)) {
throw new \LogicException(\sprintf(
throw new \LogicException(sprintf(
'Cannot create an instance of "%s" when Symfony HttpClient is not installed. '.
'Either instantiate the class by yourself and pass a proper implementation or '.
'try to run "composer require symfony/http-client".',
Expand Down Expand Up @@ -113,7 +113,7 @@ public function request(TransportRequest $request): TransportResponse

return new TransportResponse($symfonyResponse->getContent(), self::extractJsessionCookie($symfonyResponse));
} catch (TransportExceptionInterface $e) {
throw new RuntimeException(\sprintf('HTTP request failed: %s', $e->getMessage()), 0, $e);
throw new RuntimeException(sprintf('HTTP request failed: %s', $e->getMessage()), 0, $e);
} catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $e) {
throw new NetworkException('Bad response.', $e->getCode(), $e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Transport/CurlTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private static function getHeadersAndContentFromCurlHandle(\CurlHandle $curlHand
$splitHeader = explode(': ', $line, 2);
// @codeCoverageIgnoreStart
if (!isset($splitHeader[0], $splitHeader[1])) {
throw new \InvalidArgumentException(\sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $line));
throw new \InvalidArgumentException(sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $line));
}
// @codeCoverageIgnoreEnd

Expand Down
6 changes: 3 additions & 3 deletions src/Http/Transport/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public static function mergeCurlHeaders(array ...$headers): array
foreach ($headers as $headerSet) {
foreach ($headerSet as $header) {
if (!\is_string($header)) {
throw new \InvalidArgumentException(\sprintf(
throw new \InvalidArgumentException(sprintf(
'Non-string header with type "%s" passed.',
get_debug_type($header)
));
}

$splitHeader = explode(': ', $header, 2);
if (!isset($splitHeader[0], $splitHeader[1])) {
throw new \InvalidArgumentException(\sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $header));
throw new \InvalidArgumentException(sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $header));
}

// Enforce lower case for header names to avoid duplicates in mixed case. The case of header names should
Expand All @@ -62,7 +62,7 @@ public static function mergeCurlHeaders(array ...$headers): array

$result = [];
foreach ($mergedHeaders as $header => $value) {
$result[] = \sprintf('%s: %s', $header, $value);
$result[] = sprintf('%s: %s', $header, $value);
}

return $result;
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/AbstractBigBlueButtonFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function testJoinMeeting(): void
$params = $this->generateJoinMeetingParams();
$joinMeetingParams = new JoinMeetingParameters($result->getMeetingId(), $params['fullName'], $params['role']);
$joinMeetingParams->setRedirect(false);
$joinMeetingParams->setCreateTime((int) \sprintf('%.0f', $creationTime));
$joinMeetingParams->setCreateTime((int) sprintf('%.0f', $creationTime));

$joinMeeting = $this->bbb->joinMeeting($joinMeetingParams);
$this->assertEquals('SUCCESS', $joinMeeting->getReturnCode(), 'Join meeting');
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Http/Transport/HeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function provideBadlyFormattedHeaders(): iterable
public function testMergeCurlHeadersWithBadHeaders(string $badHeader): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(\sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $badHeader));
$this->expectExceptionMessage(sprintf('Header value "%s" is invalid. Expected format is "Header-Name: value".', $badHeader));

Header::mergeCurlHeaders([$badHeader]);
}
Expand All @@ -82,7 +82,7 @@ public function provideNonStringHeaders(): iterable
public function testMergeCurlHeadersWithNonStringHeaders(mixed $badHeader): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(\sprintf(
$this->expectExceptionMessage(sprintf(
'Non-string header with type "%s" passed.',
get_debug_type($badHeader)
));
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/Parameters/JoinMeetingParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ public function testJoinMeetingParameters(): void
$joinMeetingParams->setRole($newRole = Role::VIEWER);
$joinMeetingParams->setAvatarURL($avatarUrl = $this->faker->url);
$joinMeetingParams->setRedirect($redirect = $this->faker->boolean(50));
$joinMeetingParams->setClientURL($clientUrl = $this->faker->url);
$joinMeetingParams->setErrorRedirectUrl($newErrorRedirectUrl = $this->faker->url);
$joinMeetingParams->setGuest($guest = $this->faker->boolean(50));
$this->assertEquals($newId, $joinMeetingParams->getMeetingID());
$this->assertEquals($newName, $joinMeetingParams->getFullName());
$this->assertEquals($newRole, $joinMeetingParams->getRole());
$this->assertEquals($avatarUrl, $joinMeetingParams->getAvatarURL());
$this->assertEquals($redirect, $joinMeetingParams->isRedirect());
$this->assertEquals($clientUrl, $joinMeetingParams->getClientURL());
$this->assertEquals($newErrorRedirectUrl, $joinMeetingParams->getErrorRedirectUrl());
$this->assertEquals($guest, $joinMeetingParams->isGuest());
}
Expand Down

0 comments on commit e0f653e

Please sign in to comment.