diff --git a/classes/Video.php b/classes/Video.php index 0e179c9..0be27d9 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -5,6 +5,8 @@ namespace Alltube; +use Alltube\Exception\EmptyUrlException; +use Alltube\Exception\PasswordException; use Exception; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Response; @@ -65,6 +67,7 @@ class Video /** * URLs of the video files. + * * @var array */ private $urls; diff --git a/classes/EmptyUrlException.php b/classes/exceptions/EmptyUrlException.php similarity index 85% rename from classes/EmptyUrlException.php rename to classes/exceptions/EmptyUrlException.php index 663501c..232559a 100644 --- a/classes/EmptyUrlException.php +++ b/classes/exceptions/EmptyUrlException.php @@ -3,7 +3,7 @@ * EmptyUrlException class. */ -namespace Alltube; +namespace Alltube\Exception; use Exception; diff --git a/classes/PasswordException.php b/classes/exceptions/PasswordException.php similarity index 85% rename from classes/PasswordException.php rename to classes/exceptions/PasswordException.php index 598ca92..256d9c8 100644 --- a/classes/PasswordException.php +++ b/classes/exceptions/PasswordException.php @@ -3,7 +3,7 @@ * PasswordException class. */ -namespace Alltube; +namespace Alltube\Exception; use Exception; diff --git a/classes/ConvertedPlaylistArchiveStream.php b/classes/streams/ConvertedPlaylistArchiveStream.php similarity index 93% rename from classes/ConvertedPlaylistArchiveStream.php rename to classes/streams/ConvertedPlaylistArchiveStream.php index 2eb2241..b3b1839 100644 --- a/classes/ConvertedPlaylistArchiveStream.php +++ b/classes/streams/ConvertedPlaylistArchiveStream.php @@ -3,8 +3,9 @@ * ConvertedPlaylistArchiveStream class. */ -namespace Alltube; +namespace Alltube\Stream; +use Alltube\Video; use Slim\Http\Stream; /** diff --git a/classes/PlaylistArchiveStream.php b/classes/streams/PlaylistArchiveStream.php similarity index 99% rename from classes/PlaylistArchiveStream.php rename to classes/streams/PlaylistArchiveStream.php index 48d8b74..4dc5e8d 100644 --- a/classes/PlaylistArchiveStream.php +++ b/classes/streams/PlaylistArchiveStream.php @@ -3,8 +3,9 @@ * PlaylistArchiveStream class. */ -namespace Alltube; +namespace Alltube\Stream; +use Alltube\Video; use Barracuda\ArchiveStream\ZipArchive; use Psr\Http\Message\StreamInterface; diff --git a/classes/YoutubeChunkStream.php b/classes/streams/YoutubeChunkStream.php similarity index 98% rename from classes/YoutubeChunkStream.php rename to classes/streams/YoutubeChunkStream.php index 3e77674..90a73bc 100644 --- a/classes/YoutubeChunkStream.php +++ b/classes/streams/YoutubeChunkStream.php @@ -3,7 +3,7 @@ * YoutubeChunkStream class. */ -namespace Alltube; +namespace Alltube\Stream; use GuzzleHttp\Psr7\Response; use Psr\Http\Message\StreamInterface; @@ -17,6 +17,7 @@ class YoutubeChunkStream implements StreamInterface /** * HTTP response containing the video chunk. + * * @var Response */ private $response; @@ -173,7 +174,7 @@ class YoutubeChunkStream implements StreamInterface } /** - * Returns the remaining contents in a string + * Returns the remaining contents in a string. * * @return string */ diff --git a/classes/YoutubeStream.php b/classes/streams/YoutubeStream.php similarity index 92% rename from classes/YoutubeStream.php rename to classes/streams/YoutubeStream.php index d6c599b..cdcf9cb 100644 --- a/classes/YoutubeStream.php +++ b/classes/streams/YoutubeStream.php @@ -3,9 +3,11 @@ * YoutubeStream class. */ -namespace Alltube; +namespace Alltube\Stream; +use Alltube\Video; use GuzzleHttp\Psr7\AppendStream; +use Psr\Http\Message\StreamInterface; /** * Stream that downloads a video in chunks. diff --git a/composer.json b/composer.json index 760c014..89c4127 100644 --- a/composer.json +++ b/composer.json @@ -79,6 +79,8 @@ "autoload": { "psr-4": { "Alltube\\": "classes/", + "Alltube\\Stream\\": "classes/streams/", + "Alltube\\Exception\\": "classes/exceptions/", "Alltube\\Controller\\": "controllers/", "Alltube\\Test\\": "tests/" } diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index 08e5583..637e8a9 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -5,12 +5,12 @@ namespace Alltube\Controller; -use Alltube\ConvertedPlaylistArchiveStream; -use Alltube\EmptyUrlException; -use Alltube\PasswordException; -use Alltube\PlaylistArchiveStream; +use Alltube\Stream\ConvertedPlaylistArchiveStream; +use Alltube\Exception\EmptyUrlException; +use Alltube\Exception\PasswordException; +use Alltube\Stream\PlaylistArchiveStream; use Alltube\Video; -use Alltube\YoutubeStream; +use Alltube\Stream\YoutubeStream; use Exception; use Slim\Http\Request; use Slim\Http\Response; diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 51b0d8c..903ded9 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -8,7 +8,7 @@ namespace Alltube\Controller; use Alltube\Config; use Alltube\Locale; use Alltube\LocaleManager; -use Alltube\PasswordException; +use Alltube\Exception\PasswordException; use Alltube\Video; use Exception; use Psr\Container\ContainerInterface; diff --git a/tests/PlaylistArchiveStreamTest.php b/tests/PlaylistArchiveStreamTest.php index 63980f2..6d1eb6d 100644 --- a/tests/PlaylistArchiveStreamTest.php +++ b/tests/PlaylistArchiveStreamTest.php @@ -5,7 +5,7 @@ namespace Alltube\Test; -use Alltube\PlaylistArchiveStream; +use Alltube\Stream\PlaylistArchiveStream; use Alltube\Video; /**