Avoid magic numbers
This commit is contained in:
parent
32f0a5012c
commit
b02e255cb4
3 changed files with 8 additions and 5 deletions
|
@ -21,6 +21,7 @@ use Alltube\Stream\PlaylistArchiveStream;
|
|||
use Alltube\Stream\YoutubeStream;
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
use Slim\Http\StatusCode;
|
||||
use Slim\Http\Stream;
|
||||
|
||||
/**
|
||||
|
@ -203,8 +204,8 @@ class DownloadController extends BaseController
|
|||
$response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length'));
|
||||
$response = $response->withHeader('Accept-Ranges', $stream->getHeader('Accept-Ranges'));
|
||||
$response = $response->withHeader('Content-Range', $stream->getHeader('Content-Range'));
|
||||
if ($stream->getStatusCode() == 206) {
|
||||
$response = $response->withStatus(206);
|
||||
if ($stream->getStatusCode() == StatusCode::HTTP_PARTIAL_CONTENT) {
|
||||
$response = $response->withStatus(StatusCode::HTTP_PARTIAL_CONTENT);
|
||||
}
|
||||
|
||||
if (isset($this->video->downloader_options->http_chunk_size)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Library\Exception\AlltubeLibraryException;
|
|||
use Alltube\Library\Exception\WrongPasswordException;
|
||||
use Alltube\Locale;
|
||||
use Exception;
|
||||
use Slim\Http\StatusCode;
|
||||
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
|
||||
use Throwable;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@ -142,7 +143,7 @@ class FrontController extends BaseController
|
|||
]
|
||||
);
|
||||
|
||||
return $response->withStatus(403);
|
||||
return $response->withStatus(StatusCode::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +257,7 @@ class FrontController extends BaseController
|
|||
]
|
||||
);
|
||||
|
||||
return $response->withStatus(500);
|
||||
return $response->withStatus(StatusCode::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Alltube\Controller;
|
|||
use Alltube\Library\Exception\AlltubeLibraryException;
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
use Slim\Http\StatusCode;
|
||||
|
||||
/**
|
||||
* Controller that returns JSON.
|
||||
|
@ -38,7 +39,7 @@ class JsonController extends BaseController
|
|||
return $response->withJson($this->video->getJson());
|
||||
} else {
|
||||
return $response->withJson(['error' => 'You need to provide the url parameter'])
|
||||
->withStatus(400);
|
||||
->withStatus(StatusCode::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue