Skip to content

Commit

Permalink
Правки по стилю кода
Browse files Browse the repository at this point in the history
  • Loading branch information
fdfkc committed Sep 3, 2023
1 parent 4797251 commit 7c304b0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class TableRowNotFoundException extends \Exception
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use VKorabelnikov\Hw16\MusicStreaming\Application\Storage\DataMapper\GenreMapperInterface;
use VKorabelnikov\Hw16\MusicStreaming\Application\Storage\DataMapper\UserMapperInterface;
use VKorabelnikov\Hw16\MusicStreaming\Application\Storage\DataMapper\TrackMapperInterface;

use function \VKorabelnikov\Hw16\MusicStreaming\Domain\Model\Functions\convertFromIntToString;
use function VKorabelnikov\Hw16\MusicStreaming\Domain\Model\Functions\convertFromIntToString;

class UploadTrackUseCase
{
Expand All @@ -28,8 +27,7 @@ public function __construct(
GenreMapperInterface $genreMapper,
UserMapperInterface $userMapper,
TrackMapperInterface $trackMapper
)
{
) {
$this->genreMapper = $genreMapper;
$this->userMapper = $userMapper;
$this->trackMapper = $trackMapper;
Expand All @@ -42,8 +40,6 @@ public function upload(array $requestParams): void
$requestParams["file_name"]
);



$this->saveToDatabase(
[
"name" => $requestParams["name"],
Expand Down Expand Up @@ -108,8 +104,6 @@ protected function getAudioProcessor(string $fileName): AudioFileProcessor
return $obAudioFileProcessor;
}



protected function decodeFileFromBase64(string $base64FileContents, string $fileName): string
{
$data = base64_decode($base64FileContents);
Expand Down
3 changes: 1 addition & 2 deletions code/src/MusicStreaming/Infrastructure/Init/HttpApiInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public function run()
$e->getMessage()
)
);
}
catch (\Throwable $e) {
} catch (\Throwable $e) {
$this->output(
new ErrorResponse(
"Internal error occured."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ public function findByUser(User $user): array
$this->selectByUserStatement->execute(["user_id" => $user->getId()]);

$result = [];
while ($row = $this->selectByUserStatement->fetch())
{
while ($row = $this->selectByUserStatement->fetch()) {
$userMapper = new UserMapper($this->pdo);
$result[] = new Playlist(
$row['id'],
Expand Down Expand Up @@ -191,7 +190,7 @@ public function update(Playlist $playlist): bool
$tracksToInsert[] = $inputTrack;
}
}

foreach ($playlist->getTracksList() as $inputTrack) {
$trackAttachedToPlaylist = false;
foreach ($dbTracksList as $dbTrack) {
Expand All @@ -200,7 +199,7 @@ public function update(Playlist $playlist): bool
break;
}
}
if(!$trackAttachedToPlaylist) {
if (!$trackAttachedToPlaylist) {
$tracksToInsert[] = $inputTrack;
}
}
Expand All @@ -214,7 +213,7 @@ public function update(Playlist $playlist): bool
break;
}
}
if(!$deletedFromPlaylist) {
if (!$deletedFromPlaylist) {
$tracksToDelete[] = $inputTrack;
}
}
Expand Down

0 comments on commit 7c304b0

Please sign in to comment.