Minor changes

This commit is contained in:
Netkas 2023-01-29 00:31:10 -05:00
parent f24d8611bf
commit f6bc814187

View file

@ -7,7 +7,7 @@
use Exception; use Exception;
use ncc\Abstracts\Scopes; use ncc\Abstracts\Scopes;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\IOException; use ncc\Exceptions\SymlinkException;
use ncc\Objects\SymlinkDictionary\SymlinkEntry; use ncc\Objects\SymlinkDictionary\SymlinkEntry;
use ncc\ThirdParty\Symfony\Filesystem\Filesystem; use ncc\ThirdParty\Symfony\Filesystem\Filesystem;
use ncc\Utilities\Console; use ncc\Utilities\Console;
@ -65,7 +65,7 @@
* *
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
public function load(): void public function load(): void
{ {
@ -110,7 +110,7 @@
* @param bool $throw_exception * @param bool $throw_exception
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
private function save(bool $throw_exception=true): void private function save(bool $throw_exception=true): void
{ {
@ -132,7 +132,7 @@
catch(Exception $e) catch(Exception $e)
{ {
if($throw_exception) if($throw_exception)
throw new IOException(sprintf('failed to save symlink dictionary to %s', $this->SymlinkDictionaryPath), $e); throw new SymlinkException(sprintf('failed to save symlink dictionary to %s', $this->SymlinkDictionaryPath), $e);
Console::outWarning(sprintf('failed to save symlink dictionary to %s', $this->SymlinkDictionaryPath)); Console::outWarning(sprintf('failed to save symlink dictionary to %s', $this->SymlinkDictionaryPath));
} }
@ -182,7 +182,7 @@
* @param string $unit * @param string $unit
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
public function add(string $package, string $unit='main'): void public function add(string $package, string $unit='main'): void
{ {
@ -206,7 +206,7 @@
* @param string $package * @param string $package
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
public function remove(string $package): void public function remove(string $package): void
{ {
@ -229,7 +229,6 @@
if($filesystem->exists($symlink)) if($filesystem->exists($symlink))
$filesystem->remove($symlink); $filesystem->remove($symlink);
} }
unset($this->SymlinkDictionary[$key]); unset($this->SymlinkDictionary[$key]);
@ -238,7 +237,7 @@
} }
} }
throw new IOException(sprintf('failed to remove package %s from the symlink dictionary', $package)); throw new SymlinkException(sprintf('failed to remove package %s from the symlink dictionary', $package));
} }
/** /**
@ -247,7 +246,7 @@
* @param string $package * @param string $package
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
private function setAsRegistered(string $package): void private function setAsRegistered(string $package): void
{ {
@ -269,7 +268,7 @@
* @param string $package * @param string $package
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
private function setAsUnregistered(string $package): void private function setAsUnregistered(string $package): void
{ {
@ -290,7 +289,7 @@
* *
* @return void * @return void
* @throws AccessDeniedException * @throws AccessDeniedException
* @throws IOException * @throws SymlinkException
*/ */
public function sync(): void public function sync(): void
{ {