Skip to content

Commit

Permalink
Using exit as a function
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Jan 3, 2025
1 parent f9c36b9 commit fcc4104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<exclude name="SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed.DisallowedPartiallyKeyed"/>
<exclude name="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature.RequiredSingleLineSignature"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses.UsedWithParentheses"/>
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses"/>
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse.MissingTrailingComma"/>
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration.MissingTrailingComma"/>
Expand Down
12 changes: 6 additions & 6 deletions src/php/frontend/class-video-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function ajax_handler_body() {

if ( false === $transient ) {
http_response_code( 404 );
die;
exit();

Check warning on line 60 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L60

Added line #L60 was not covered by tests
}

header( 'Accept-Ranges: bytes' );
Expand Down Expand Up @@ -87,7 +87,7 @@ public static function ajax_handler_body() {

if ( is_null( $stream ) ) {
http_response_code( 500 );
die;
exit();

Check warning on line 90 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L90

Added line #L90 was not covered by tests
}

ob_end_clean();
Expand Down Expand Up @@ -116,7 +116,7 @@ private static function resolve_range( $size ) {

if ( 2 !== count( $limits ) ) {
http_response_code( 416 );
die;
exit();

Check warning on line 119 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L119

Added line #L119 was not covered by tests
}

$raw_start = $limits[0];
Expand All @@ -134,7 +134,7 @@ private static function resolve_range( $size ) {

if ( $start > $end ) {
http_response_code( 416 );
die;
exit();

Check warning on line 137 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L137

Added line #L137 was not covered by tests
}

return array( $start, $end );
Expand All @@ -152,15 +152,15 @@ private static function resolve_range( $size ) {
private static function check_range_header( $header ) {
if ( ! str_starts_with( $header, 'bytes=' ) ) {
http_response_code( 416 );
die;
exit();

Check warning on line 155 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L155

Added line #L155 was not covered by tests
}

$header = substr( $header, 6 );

// Multipart range requests are not supported.
if ( str_contains( $header, ',' ) ) {
http_response_code( 416 );
die;
exit();

Check warning on line 163 in src/php/frontend/class-video-proxy.php

View check run for this annotation

Codecov / codecov/patch

src/php/frontend/class-video-proxy.php#L163

Added line #L163 was not covered by tests
}

return $header;
Expand Down

0 comments on commit fcc4104

Please sign in to comment.