Various code cleanup

This commit is contained in:
James Cole
2017-08-12 07:47:42 +02:00
parent 81fb3df45e
commit 743547096e
39 changed files with 4885 additions and 3714 deletions

View File

@@ -34,7 +34,8 @@ class DecryptAttachment extends Command
*
* @var string
*/
protected $signature = 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.}
protected $signature
= 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.}
{directory:Where the file must be stored.}';

View File

@@ -18,6 +18,11 @@ use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface;
class BankController extends Controller
{
public function postPrerequisites()
{
}
/**
* @param string $bank
*/
@@ -31,6 +36,7 @@ class BankController extends Controller
if ($object->hasPrerequisites()) {
$view = $object->getView();
$parameters = $object->getViewParameters();
return view($view, $parameters);
}
@@ -40,8 +46,4 @@ class BankController extends Controller
}
public function postPrerequisites() {
}
}

View File

@@ -56,26 +56,6 @@ class FileController extends Controller
);
}
/**
* This is step 1. Upload a file.
*
* @return View
*/
public function index()
{
$subTitle = trans('firefly.import_index_sub_title');
$subTitleIcon = 'fa-home';
$importFileTypes = [];
$defaultImportType = config('firefly.default_import_format');
foreach (array_keys(config('firefly.import_formats')) as $type) {
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
}
return view('import.file.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
}
/**
* This is step 3. This repeats until the job is configured.
*
@@ -140,6 +120,24 @@ class FileController extends Controller
}
/**
* This is step 1. Upload a file.
*
* @return View
*/
public function index()
{
$subTitle = trans('firefly.import_index_sub_title');
$subTitleIcon = 'fa-home';
$importFileTypes = [];
$defaultImportType = config('firefly.default_import_format');
foreach (array_keys(config('firefly.import_formats')) as $type) {
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
}
return view('import.file.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
}
/**
* This is step 2. It creates an Import Job. Stores the import.

View File

@@ -78,11 +78,11 @@ class TagController extends Controller
}
/**
* @param Request $request
* Create a new tag.
*
* @return View
*/
public function create(Request $request)
public function create()
{
$subTitle = trans('firefly.new_tag');
$subTitleIcon = 'fa-tag';
@@ -100,6 +100,8 @@ class TagController extends Controller
}
/**
* Delete a tag
*
* @param Tag $tag
*
* @return View
@@ -134,13 +136,13 @@ class TagController extends Controller
}
/**
* @param Tag $tag
* Edit a tag
*
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return View
*/
public function edit(Tag $tag, TagRepositoryInterface $repository)
public function edit(Tag $tag)
{
$subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]);
$subTitleIcon = 'fa-tag';
@@ -158,6 +160,8 @@ class TagController extends Controller
}
/**
* View all tags
*
* @param TagRepositoryInterface $repository
*
* @return View

View File

@@ -278,6 +278,7 @@ class ImportStorage
}
Log::debug('getForeignCurrencyId: journal has no foreign currency.');
// return null in other cases.
return null;
}

View File

@@ -52,7 +52,7 @@ interface AttachmentRepositoryInterface
*
* @return Attachment
*/
public function findWithoutUser(int $id):Attachment;
public function findWithoutUser(int $id): Attachment;
/**
* @return Collection

View File

@@ -20,6 +20,7 @@ interface Verifier
{
/**
* Verify the given password against (some) service.
*
* @param string $password
*
* @return bool

View File

@@ -27,6 +27,13 @@ interface ConfigurationInterface
*/
public function getData(): array;
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string;
/**
* @param ImportJob $job
*
@@ -43,11 +50,4 @@ interface ConfigurationInterface
*/
public function storeConfiguration(array $data): bool;
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string;
}

View File

@@ -61,6 +61,16 @@ class Initial implements ConfigurationInterface
return $data;
}
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string
{
return '';
}
/**
* @param ImportJob $job
*
@@ -135,14 +145,4 @@ class Initial implements ConfigurationInterface
return $config;
}
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string
{
return '';
}
}

View File

@@ -106,6 +106,16 @@ class Map implements ConfigurationInterface
}
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string
{
return '';
}
/**
* @param ImportJob $job
*
@@ -268,14 +278,4 @@ class Map implements ConfigurationInterface
return $column;
}
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string
{
return '';
}
}

View File

@@ -262,7 +262,7 @@ class Roles implements ConfigurationInterface
$this->warning = '';
}
if ($assigned === 0 || !$hasAmount) {
$this->warning = trans('csv.roles_warning');
$this->warning = strval(trans('csv.roles_warning'));
}
return true;

View File

@@ -16,13 +16,6 @@ use FireflyIII\User;
interface PrerequisitesInterface
{
/**
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
*
* @param User $user
*/
public function setUser(User $user): void;
/**
* Returns view name that allows user to fill in prerequisites.
*
@@ -44,4 +37,11 @@ interface PrerequisitesInterface
* @return bool
*/
public function hasPrerequisites(): bool;
/**
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
*
* @param User $user
*/
public function setUser(User $user): void;
}