Skip to content

Commit

Permalink
Resolve #35 Sonarqube sorunlarının giderilmesi
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahsin Gökalp Şaan committed Apr 27, 2022
1 parent 144027a commit 42c65e6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 41 deletions.
10 changes: 10 additions & 0 deletions app/Exceptions/CopyFilesException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Exceptions;

use Exception;

class CopyFilesException extends Exception
{
//
}
7 changes: 4 additions & 3 deletions app/Services/Parent/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Services\Parent;

use App\Exceptions\CopyFilesException;
use App\Models\Book;
use Exception;
use Illuminate\Database\Eloquent\Collection;
Expand Down Expand Up @@ -116,14 +117,14 @@ private function copyFiles($book, $directory): bool
{
try {
if (File::exists(storage_path('books/'.$book->cover)) && ! File::copy(storage_path('books/'.$book->cover), $directory.'/images/'.$book->cover)) {
return false;
throw new CopyFilesException();
}
foreach ($book->pages as $page) {
if (File::exists(storage_path('books/'.$page->image)) && ! File::copy(storage_path('books/'.$page->image), $directory.'/images/'.$page->image)) {
return false;
throw new CopyFilesException();
}
if ($page->sound !== null && File::exists(storage_path('sound/'.$page->sound)) && ! File::copy(storage_path('sound/'.$page->sound), $directory.'/sound/'.$page->sound)) {
return false;
throw new CopyFilesException();
}
}
} catch (Exception) {
Expand Down
2 changes: 0 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
Expand Down
17 changes: 0 additions & 17 deletions resources/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,3 @@ window._ = require('lodash');
window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/

// import Echo from 'laravel-echo';

// window.Pusher = require('pusher-js');

// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: process.env.MIX_PUSHER_APP_KEY,
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
// forceTLS: true
// });
26 changes: 7 additions & 19 deletions resources/plugins/sweetalert2/make.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
function makeDeleteBtn(body = {}, container = null, selector = null, title = null, text = null, deleteText = null, cancel = null, redirect = null, refresh = false){
if(container == null){
container = '#setting-default';
}
if(selector == null){
selector = '.delete-btn';
}
if(title == null){
title = localization.sweetalert2.title;
}
if(text == null){
text = localization.sweetalert2.text
}
if(deleteText == null){
deleteText = localization.sweetalert2.delete;
}
if(cancel == null){
cancel = localization.sweetalert2.cancel;
}
function makeDeleteBtn(){
let container = '#setting-default';
let selector = '.delete-btn';
let title = localization.sweetalert2.title;
let text = localization.sweetalert2.text;
let deleteText = localization.sweetalert2.delete;
let cancel = localization.sweetalert2.cancel;
return $(container).on('click', selector, function (event){
let url = $(this).attr('href');
event.preventDefault();
Expand Down

0 comments on commit 42c65e6

Please sign in to comment.