Simplify PSR-4 autoload
This commit is contained in:
parent
8eb280bab0
commit
dfdf6fef76
12 changed files with 1 additions and 2 deletions
13
classes/Exception/AlltubeLibraryException.php
Normal file
13
classes/Exception/AlltubeLibraryException.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Base class for Alltube exceptions.
|
||||
*/
|
||||
abstract class AlltubeLibraryException extends Exception
|
||||
{
|
||||
|
||||
}
|
18
classes/Exception/AvconvException.php
Normal file
18
classes/Exception/AvconvException.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Can't find avconv or ffmpeg.
|
||||
*/
|
||||
class AvconvException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* AvconvException constructor.
|
||||
* @param string $path Path to avconv or ffmpeg.
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
parent::__construct("Can't find avconv or ffmpeg at " . $path . '.');
|
||||
}
|
||||
}
|
19
classes/Exception/EmptyUrlException.php
Normal file
19
classes/Exception/EmptyUrlException.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* EmptyUrlException class.
|
||||
*/
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when youtube-dl returns an empty URL.
|
||||
*/
|
||||
class EmptyUrlException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* Error message.
|
||||
* @var string
|
||||
*/
|
||||
protected $message = 'youtube-dl returned an empty URL.';
|
||||
}
|
18
classes/Exception/InvalidProtocolConversionException.php
Normal file
18
classes/Exception/InvalidProtocolConversionException.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Invalid conversion.
|
||||
*/
|
||||
class InvalidProtocolConversionException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* InvalidProtocolConversionException constructor.
|
||||
* @param string $protocol Protocol
|
||||
*/
|
||||
public function __construct($protocol)
|
||||
{
|
||||
parent::__construct($protocol . ' protocol is not supported in conversions.');
|
||||
}
|
||||
}
|
19
classes/Exception/InvalidTimeException.php
Normal file
19
classes/Exception/InvalidTimeException.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Invalid time.
|
||||
*/
|
||||
class InvalidTimeException extends AlltubeLibraryException
|
||||
{
|
||||
|
||||
/**
|
||||
* InvalidTimeException constructor.
|
||||
* @param string $time Invalid time
|
||||
*/
|
||||
public function __construct($time)
|
||||
{
|
||||
parent::__construct('Invalid time: ' . $time);
|
||||
}
|
||||
}
|
14
classes/Exception/PasswordException.php
Normal file
14
classes/Exception/PasswordException.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PasswordException class.
|
||||
*/
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when a video requires a password.
|
||||
*/
|
||||
class PasswordException extends AlltubeLibraryException
|
||||
{
|
||||
}
|
15
classes/Exception/PlaylistConversionException.php
Normal file
15
classes/Exception/PlaylistConversionException.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Conversion of playlists is not supported.
|
||||
*/
|
||||
class PlaylistConversionException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* Error message.
|
||||
* @var string
|
||||
*/
|
||||
protected $message = 'Conversion of playlists is not supported.';
|
||||
}
|
15
classes/Exception/PopenStreamException.php
Normal file
15
classes/Exception/PopenStreamException.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Could not open popen stream.
|
||||
*/
|
||||
class PopenStreamException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* Error message.
|
||||
* @var string
|
||||
*/
|
||||
protected $message = 'Could not open popen stream.';
|
||||
}
|
10
classes/Exception/RemuxException.php
Normal file
10
classes/Exception/RemuxException.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Generic remux exception.
|
||||
*/
|
||||
class RemuxException extends AlltubeLibraryException
|
||||
{
|
||||
}
|
15
classes/Exception/WrongPasswordException.php
Normal file
15
classes/Exception/WrongPasswordException.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Wrong password.
|
||||
*/
|
||||
class WrongPasswordException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* Error message.
|
||||
* @var string
|
||||
*/
|
||||
protected $message = 'Wrong password.';
|
||||
}
|
24
classes/Exception/YoutubedlException.php
Normal file
24
classes/Exception/YoutubedlException.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
* Generic youtube-dl error.
|
||||
*/
|
||||
class YoutubedlException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* YoutubedlException constructor.
|
||||
*
|
||||
* @param Process<string> $process Process that caused the exception
|
||||
*/
|
||||
public function __construct(Process $process)
|
||||
{
|
||||
parent::__construct(
|
||||
$process->getCommandLine() . ' failed with this error:' . PHP_EOL . trim($process->getErrorOutput()),
|
||||
intval($process->getExitCode())
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue