refactor: Move exceptions and streams to seperate namespaces

This commit is contained in:
Pierre Rudloff 2019-04-22 21:06:05 +02:00
parent 1a6ff90eac
commit e13404903b
11 changed files with 24 additions and 14 deletions

View File

@ -5,6 +5,8 @@
namespace Alltube; namespace Alltube;
use Alltube\Exception\EmptyUrlException;
use Alltube\Exception\PasswordException;
use Exception; use Exception;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
@ -65,6 +67,7 @@ class Video
/** /**
* URLs of the video files. * URLs of the video files.
*
* @var array * @var array
*/ */
private $urls; private $urls;

View File

@ -3,7 +3,7 @@
* EmptyUrlException class. * EmptyUrlException class.
*/ */
namespace Alltube; namespace Alltube\Exception;
use Exception; use Exception;

View File

@ -3,7 +3,7 @@
* PasswordException class. * PasswordException class.
*/ */
namespace Alltube; namespace Alltube\Exception;
use Exception; use Exception;

View File

@ -3,8 +3,9 @@
* ConvertedPlaylistArchiveStream class. * ConvertedPlaylistArchiveStream class.
*/ */
namespace Alltube; namespace Alltube\Stream;
use Alltube\Video;
use Slim\Http\Stream; use Slim\Http\Stream;
/** /**

View File

@ -3,8 +3,9 @@
* PlaylistArchiveStream class. * PlaylistArchiveStream class.
*/ */
namespace Alltube; namespace Alltube\Stream;
use Alltube\Video;
use Barracuda\ArchiveStream\ZipArchive; use Barracuda\ArchiveStream\ZipArchive;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;

View File

@ -3,7 +3,7 @@
* YoutubeChunkStream class. * YoutubeChunkStream class.
*/ */
namespace Alltube; namespace Alltube\Stream;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
@ -17,6 +17,7 @@ class YoutubeChunkStream implements StreamInterface
/** /**
* HTTP response containing the video chunk. * HTTP response containing the video chunk.
*
* @var Response * @var Response
*/ */
private $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 * @return string
*/ */

View File

@ -3,9 +3,11 @@
* YoutubeStream class. * YoutubeStream class.
*/ */
namespace Alltube; namespace Alltube\Stream;
use Alltube\Video;
use GuzzleHttp\Psr7\AppendStream; use GuzzleHttp\Psr7\AppendStream;
use Psr\Http\Message\StreamInterface;
/** /**
* Stream that downloads a video in chunks. * Stream that downloads a video in chunks.

View File

@ -79,6 +79,8 @@
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Alltube\\": "classes/", "Alltube\\": "classes/",
"Alltube\\Stream\\": "classes/streams/",
"Alltube\\Exception\\": "classes/exceptions/",
"Alltube\\Controller\\": "controllers/", "Alltube\\Controller\\": "controllers/",
"Alltube\\Test\\": "tests/" "Alltube\\Test\\": "tests/"
} }

View File

@ -5,12 +5,12 @@
namespace Alltube\Controller; namespace Alltube\Controller;
use Alltube\ConvertedPlaylistArchiveStream; use Alltube\Stream\ConvertedPlaylistArchiveStream;
use Alltube\EmptyUrlException; use Alltube\Exception\EmptyUrlException;
use Alltube\PasswordException; use Alltube\Exception\PasswordException;
use Alltube\PlaylistArchiveStream; use Alltube\Stream\PlaylistArchiveStream;
use Alltube\Video; use Alltube\Video;
use Alltube\YoutubeStream; use Alltube\Stream\YoutubeStream;
use Exception; use Exception;
use Slim\Http\Request; use Slim\Http\Request;
use Slim\Http\Response; use Slim\Http\Response;

View File

@ -8,7 +8,7 @@ namespace Alltube\Controller;
use Alltube\Config; use Alltube\Config;
use Alltube\Locale; use Alltube\Locale;
use Alltube\LocaleManager; use Alltube\LocaleManager;
use Alltube\PasswordException; use Alltube\Exception\PasswordException;
use Alltube\Video; use Alltube\Video;
use Exception; use Exception;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;

View File

@ -5,7 +5,7 @@
namespace Alltube\Test; namespace Alltube\Test;
use Alltube\PlaylistArchiveStream; use Alltube\Stream\PlaylistArchiveStream;
use Alltube\Video; use Alltube\Video;
/** /**