Merge branch 'release/4.6.11'

This commit is contained in:
James Cole 2017-11-30 20:16:28 +01:00
commit f7eb78364d
770 changed files with 13812 additions and 13028 deletions

View File

@ -5,6 +5,7 @@ APP_KEY=${FF_APP_KEY}
APP_LOG=daily
APP_LOG_LEVEL=warning
APP_URL=http://localhost
TRUSTED_PROXIES=
DB_CONNECTION=mysql
DB_HOST=${FF_DB_HOST}
@ -55,3 +56,5 @@ PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=true
IS_SANDSTORM=false

View File

@ -56,3 +56,5 @@ PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=false
IS_SANDSTORM=false

55
.env.heroku Normal file
View File

@ -0,0 +1,55 @@
APP_ENV=heroku
APP_DEBUG=true
APP_NAME=FireflyIII
APP_KEY=7ahyYVPVsmxjdhsweWCauGeJfwc92NP2
APP_LOG=errorlog
APP_LOG_LEVEL=debug
APP_URL=http://localhost
TRUSTED_PROXIES=*
DB_CONNECTION=pgsql
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
SHOW_INCOMPLETE_TRANSLATIONS=false
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
EXCHANGE_RATE_SERVICE=fixerio
MAPBOX_API_KEY=
ANALYTICS_ID=
SITE_OWNER=heroku@example.com
USE_ENCRYPTION=true
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=false
IS_SANDSTORM=false

View File

@ -5,6 +5,7 @@ APP_KEY=SomeRandomStringOf32CharsExactly
APP_LOG=syslog
APP_LOG_LEVEL=info
APP_URL=http://localhost
TRUSTED_PROXIES=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
@ -54,3 +55,6 @@ PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=false
IS_SANDSTORM=true

View File

@ -5,10 +5,12 @@ APP_KEY=TestTestTestTestTestTestTestTest
APP_LOG=daily
APP_LOG_LEVEL=debug
APP_URL=http://localhost
TRUSTED_PROXIES=
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
#DB_DATABASE=firefly
DB_USERNAME=homestead
DB_PASSWORD=
@ -39,9 +41,10 @@ SHOW_INCOMPLETE_TRANSLATIONS=false
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
EXCHANGE_RATE_SERVICE=fixerio
GOOGLE_MAPS_API_KEY=
MAPBOX_API_KEY=
ANALYTICS_ID=
SITE_OWNER=mail@example.com
USE_ENCRYPTION=true
@ -53,3 +56,5 @@ PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=false
IS_SANDSTORM=false

View File

@ -7,3 +7,5 @@ I am running Firefly III version x.x.x
(please include if this problem also exists on the demo site)
#### Other important details (log files, system info):
Please visit the /debug page to get extra debug information.

View File

@ -1,3 +1,28 @@
# 4.6.11
- A debug page at `/debug` for easier debug.
- Strings translatable (see [issue 976](https://github.com/firefly-iii/firefly-iii/issues/976)), thanks to [Findus23](https://github.com/Findus23)
- Even more strings are translatable (and translated), thanks to [pkoziol](https://github.com/pkoziol) (see [issue 979](https://github.com/firefly-iii/firefly-iii/issues/979))
- Reconciliation of accounts ([issue 736](https://github.com/firefly-iii/firefly-iii/issues/736)), as requested by [kristophr](https://github.com/kristophr) and several others
- Extended currency list, as suggested by @emuhendis in [issue 994](https://github.com/firefly-iii/firefly-iii/issues/994)
- [Issue 996](https://github.com/firefly-iii/firefly-iii/issues/996) as suggested by [dp87](https://github.com/dp87)
- Disabled Heroku support until I get it working again.
- [Issue 980](https://github.com/firefly-iii/firefly-iii/issues/980), reported by [Tim-Frensch](https://github.com/Tim-Frensch)
- [Issue 987](https://github.com/firefly-iii/firefly-iii/issues/987), reported by [gavu](https://github.com/gavu)
- [Issue 988](https://github.com/firefly-iii/firefly-iii/issues/988), reported by [gavu](https://github.com/gavu)
- [Issue 992](https://github.com/firefly-iii/firefly-iii/issues/992), reported by [ncicovic](https://github.com/ncicovic)
- [Issue 993](https://github.com/firefly-iii/firefly-iii/issues/993), reported by [gavu](https://github.com/gavu)
- [Issue 997](https://github.com/firefly-iii/firefly-iii/issues/997), reported by [gavu](https://github.com/gavu)
- [Issue 1000](https://github.com/firefly-iii/firefly-iii/issues/1000), reported by [xpfgsyb](https://github.com/xpfgsyb)
- [Issue 1001](https://github.com/firefly-iii/firefly-iii/issues/1001), reported by [gavu](https://github.com/gavu)
- [Issue 1002](https://github.com/firefly-iii/firefly-iii/issues/1002), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1003](https://github.com/firefly-iii/firefly-iii/issues/1003), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1004](https://github.com/firefly-iii/firefly-iii/issues/1004), reported by [Aquariu](https://github.com/Aquariu)
- [Issue 1010](https://github.com/firefly-iii/firefly-iii/issues/1010)
- [Issue 1014](https://github.com/firefly-iii/firefly-iii/issues/1014), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1016](https://github.com/firefly-iii/firefly-iii/issues/1016)
- [Issue 1024](https://github.com/firefly-iii/firefly-iii/issues/1024), reported by [gavu](https://github.com/gavu)
- [Issue 1025](https://github.com/firefly-iii/firefly-iii/issues/1025), reported by [gavu](https://github.com/gavu)
# 4.6.10
- Greatly expanded Docker support thanks to [alazare619](https://github.com/alazare619)
- [Issue 967](https://github.com/firefly-iii/firefly-iii/issues/967), thanks to [Aquariu](https://github.com/Aquariu)

View File

@ -204,8 +204,39 @@ opt/app/.dockerignore
opt/app/.env
opt/app/.env.docker
opt/app/.env.example
opt/app/.env.heroku
opt/app/.env.sandstorm
opt/app/.gitattributes
opt/app/.sandstorm/.gitattributes
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/action_provision
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/action_set_name
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/creator_uid
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/id
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/index_uuid
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/private_key
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/synced_folders
opt/app/.sandstorm/.vagrant/machines/default/virtualbox/vagrant_cwd
opt/app/.sandstorm/Vagrantfile
opt/app/.sandstorm/app-graphics/firefly-iii-128.png
opt/app/.sandstorm/app-graphics/firefly-iii-150.png
opt/app/.sandstorm/app-graphics/firefly-iii-24.png
opt/app/.sandstorm/app-graphics/firefly-iii-48.png
opt/app/.sandstorm/build.sh
opt/app/.sandstorm/changelog.md
opt/app/.sandstorm/description.md
opt/app/.sandstorm/global-setup.sh
opt/app/.sandstorm/launcher.sh
opt/app/.sandstorm/pgp-keyring
opt/app/.sandstorm/pgp-signature
opt/app/.sandstorm/sandstorm-files.list
opt/app/.sandstorm/sandstorm-pkgdef.capnp
opt/app/.sandstorm/screenshots/screenshot-1.png
opt/app/.sandstorm/screenshots/screenshot-2.png
opt/app/.sandstorm/screenshots/screenshot-3.png
opt/app/.sandstorm/service-config/mime.types
opt/app/.sandstorm/service-config/nginx.conf
opt/app/.sandstorm/setup.sh
opt/app/.sandstorm/stack
opt/app/CHANGELOG.md
opt/app/CODE_OF_CONDUCT.md
opt/app/Dockerfile
@ -303,6 +334,7 @@ opt/app/app/Helpers/Report/PopupReport.php
opt/app/app/Helpers/Report/PopupReportInterface.php
opt/app/app/Helpers/Report/ReportHelper.php
opt/app/app/Helpers/Report/ReportHelperInterface.php
opt/app/app/Http/Controllers/Account/ReconcileController.php
opt/app/app/Http/Controllers/AccountController.php
opt/app/app/Http/Controllers/Admin/ConfigurationController.php
opt/app/app/Http/Controllers/Admin/HomeController.php
@ -397,6 +429,7 @@ opt/app/app/Http/Requests/MassEditJournalRequest.php
opt/app/app/Http/Requests/NewUserFormRequest.php
opt/app/app/Http/Requests/PiggyBankFormRequest.php
opt/app/app/Http/Requests/ProfileFormRequest.php
opt/app/app/Http/Requests/ReconciliationFormRequest.php
opt/app/app/Http/Requests/ReportFormRequest.php
opt/app/app/Http/Requests/Request.php
opt/app/app/Http/Requests/RuleFormRequest.php
@ -412,6 +445,8 @@ opt/app/app/Http/breadcrumbs.php
opt/app/app/Import/Configurator/ConfiguratorInterface.php
opt/app/app/Import/Configurator/CsvConfigurator.php
opt/app/app/Import/Converter/Amount.php
opt/app/app/Import/Converter/AmountCredit.php
opt/app/app/Import/Converter/AmountDebet.php
opt/app/app/Import/Converter/ConverterInterface.php
opt/app/app/Import/Converter/INGDebetCredit.php
opt/app/app/Import/Converter/RabobankDebetCredit.php
@ -468,7 +503,6 @@ opt/app/app/Models/Configuration.php
opt/app/app/Models/CurrencyExchangeRate.php
opt/app/app/Models/ExportJob.php
opt/app/app/Models/ImportJob.php
opt/app/app/Models/LimitRepetition.php
opt/app/app/Models/LinkType.php
opt/app/app/Models/Note.php
opt/app/app/Models/PiggyBank.php
@ -616,10 +650,15 @@ opt/app/app/Support/Preferences.php
opt/app/app/Support/Search/Modifier.php
opt/app/app/Support/Search/Search.php
opt/app/app/Support/Search/SearchInterface.php
opt/app/app/Support/SingleCacheProperties.php
opt/app/app/Support/Steam.php
opt/app/app/Support/Twig/AmountFormat.php
opt/app/app/Support/Twig/Extension/Transaction.php
opt/app/app/Support/Twig/Extension/TransactionJournal.php
opt/app/app/Support/Twig/General.php
opt/app/app/Support/Twig/Journal.php
opt/app/app/Support/Twig/Loader/TransactionJournalLoader.php
opt/app/app/Support/Twig/Loader/TransactionLoader.php
opt/app/app/Support/Twig/PiggyBank.php
opt/app/app/Support/Twig/Rule.php
opt/app/app/Support/Twig/Transaction.php
@ -688,7 +727,6 @@ opt/app/bootstrap/cache/packages.php
opt/app/bootstrap/cache/services.php
opt/app/composer.json
opt/app/composer.lock
opt/app/composer.phar
opt/app/config/app.php
opt/app/config/auth.php
opt/app/config/broadcasting.php
@ -705,6 +743,7 @@ opt/app/config/session.php
opt/app/config/twigbridge.php
opt/app/config/upgrade.php
opt/app/config/view.php
opt/app/crowdin.yml
opt/app/database/factories/ModelFactory.php
opt/app/database/migrations/2016_06_16_000000_create_support_tables.php
opt/app/database/migrations/2016_06_16_000001_create_users_table.php
@ -719,6 +758,7 @@ opt/app/database/migrations/2016_12_28_203205_changes_for_v431.php
opt/app/database/migrations/2017_04_13_163623_changes_for_v440.php
opt/app/database/migrations/2017_06_02_105232_changes_for_v450.php
opt/app/database/migrations/2017_08_20_062014_changes_for_v470.php
opt/app/database/migrations/2017_11_04_170844_changes_for_v470a.php
opt/app/database/seeds/AccountTypeSeeder.php
opt/app/database/seeds/DatabaseSeeder.php
opt/app/database/seeds/LinkTypeSeeder.php
@ -813,7 +853,9 @@ opt/app/public/images/page_green.png
opt/app/public/images/page_white_acrobat.png
opt/app/public/index.php
opt/app/public/js/ff/accounts/create.js
opt/app/public/js/ff/accounts/edit-reconciliation.js
opt/app/public/js/ff/accounts/edit.js
opt/app/public/js/ff/accounts/reconcile.js
opt/app/public/js/ff/accounts/show.js
opt/app/public/js/ff/bills/create.js
opt/app/public/js/ff/bills/edit.js
@ -1061,6 +1103,7 @@ opt/app/resources/lang/sl_SI/list.php
opt/app/resources/lang/sl_SI/pagination.php
opt/app/resources/lang/sl_SI/passwords.php
opt/app/resources/lang/sl_SI/validation.php
opt/app/resources/stubs/binary.bin
opt/app/resources/stubs/csv.csv
opt/app/resources/stubs/demo-configuration.json
opt/app/resources/stubs/demo-import.csv
@ -1069,6 +1112,11 @@ opt/app/resources/views/accounts/create.twig
opt/app/resources/views/accounts/delete.twig
opt/app/resources/views/accounts/edit.twig
opt/app/resources/views/accounts/index.twig
opt/app/resources/views/accounts/reconcile/edit.twig
opt/app/resources/views/accounts/reconcile/index.twig
opt/app/resources/views/accounts/reconcile/overview.twig
opt/app/resources/views/accounts/reconcile/show.twig
opt/app/resources/views/accounts/reconcile/transactions.twig
opt/app/resources/views/accounts/show.twig
opt/app/resources/views/admin/configuration/index.twig
opt/app/resources/views/admin/index.twig
@ -1202,6 +1250,7 @@ opt/app/resources/views/partials/flashes.twig
opt/app/resources/views/partials/menu-sidebar.twig
opt/app/resources/views/partials/page-header.twig
opt/app/resources/views/partials/password-modal.twig
opt/app/resources/views/partials/transaction-row.twig
opt/app/resources/views/piggy-banks/add-mobile.twig
opt/app/resources/views/piggy-banks/add.twig
opt/app/resources/views/piggy-banks/create.twig
@ -2352,6 +2401,7 @@ opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/Inte
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php
@ -3821,6 +3871,9 @@ opt/app/vendor/symfony/console/Command/Command.php
opt/app/vendor/symfony/console/Command/HelpCommand.php
opt/app/vendor/symfony/console/Command/ListCommand.php
opt/app/vendor/symfony/console/Command/LockableTrait.php
opt/app/vendor/symfony/console/CommandLoader/CommandLoaderInterface.php
opt/app/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php
opt/app/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php
opt/app/vendor/symfony/console/ConsoleEvents.php
opt/app/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php
opt/app/vendor/symfony/console/Descriptor/ApplicationDescription.php
@ -3898,6 +3951,8 @@ opt/app/vendor/symfony/console/Tests/Command/CommandTest.php
opt/app/vendor/symfony/console/Tests/Command/HelpCommandTest.php
opt/app/vendor/symfony/console/Tests/Command/ListCommandTest.php
opt/app/vendor/symfony/console/Tests/Command/LockableTraitTest.php
opt/app/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php
opt/app/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php
opt/app/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php
opt/app/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php
opt/app/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php
@ -3926,6 +3981,8 @@ opt/app/vendor/symfony/console/Tests/Fixtures/FooCommand.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooLock2Command.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooLockCommand.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooSameCaseLowercaseCommand.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooSameCaseUppercaseCommand.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php
opt/app/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php
opt/app/vendor/symfony/console/Tests/Fixtures/FoobarCommand.php
@ -4232,12 +4289,17 @@ opt/app/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
opt/app/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
opt/app/vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php
opt/app/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php
opt/app/vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php
opt/app/vendor/symfony/debug/Tests/Fixtures/DeprecatedInterface.php
opt/app/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php
opt/app/vendor/symfony/debug/Tests/Fixtures/FinalClass.php
opt/app/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php
opt/app/vendor/symfony/debug/Tests/Fixtures/InternalClass.php
opt/app/vendor/symfony/debug/Tests/Fixtures/InternalInterface.php
opt/app/vendor/symfony/debug/Tests/Fixtures/InternalTrait.php
opt/app/vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php
opt/app/vendor/symfony/debug/Tests/Fixtures/NonDeprecatedInterface.php
opt/app/vendor/symfony/debug/Tests/Fixtures/PEARClass.php
opt/app/vendor/symfony/debug/Tests/Fixtures/Throwing.php
@ -4390,7 +4452,9 @@ opt/app/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
opt/app/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
opt/app/vendor/symfony/http-foundation/Session/Session.php
opt/app/vendor/symfony/http-foundation/Session/SessionBagInterface.php
opt/app/vendor/symfony/http-foundation/Session/SessionBagProxy.php
opt/app/vendor/symfony/http-foundation/Session/SessionInterface.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
@ -4398,6 +4462,7 @@ opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSession
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
opt/app/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
opt/app/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
@ -4442,6 +4507,18 @@ opt/app/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttribu
opt/app/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@ -4449,6 +4526,7 @@ opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileS
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
opt/app/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@ -4724,6 +4802,18 @@ opt/app/vendor/symfony/polyfill-php56/Php56.php
opt/app/vendor/symfony/polyfill-php56/README.md
opt/app/vendor/symfony/polyfill-php56/bootstrap.php
opt/app/vendor/symfony/polyfill-php56/composer.json
opt/app/vendor/symfony/polyfill-php70/LICENSE
opt/app/vendor/symfony/polyfill-php70/Php70.php
opt/app/vendor/symfony/polyfill-php70/README.md
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/Error.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php
opt/app/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php
opt/app/vendor/symfony/polyfill-php70/bootstrap.php
opt/app/vendor/symfony/polyfill-php70/composer.json
opt/app/vendor/symfony/polyfill-util/Binary.php
opt/app/vendor/symfony/polyfill-util/BinaryNoFuncOverload.php
opt/app/vendor/symfony/polyfill-util/BinaryOnFuncOverload.php
@ -4771,6 +4861,7 @@ opt/app/vendor/symfony/routing/Exception/ExceptionInterface.php
opt/app/vendor/symfony/routing/Exception/InvalidParameterException.php
opt/app/vendor/symfony/routing/Exception/MethodNotAllowedException.php
opt/app/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php
opt/app/vendor/symfony/routing/Exception/NoConfigurationException.php
opt/app/vendor/symfony/routing/Exception/ResourceNotFoundException.php
opt/app/vendor/symfony/routing/Exception/RouteNotFoundException.php
opt/app/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php
@ -4784,6 +4875,12 @@ opt/app/vendor/symfony/routing/Loader/AnnotationClassLoader.php
opt/app/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php
opt/app/vendor/symfony/routing/Loader/AnnotationFileLoader.php
opt/app/vendor/symfony/routing/Loader/ClosureLoader.php
opt/app/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php
opt/app/vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php
opt/app/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php
opt/app/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php
opt/app/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php
opt/app/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php
opt/app/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php
opt/app/vendor/symfony/routing/Loader/DirectoryLoader.php
opt/app/vendor/symfony/routing/Loader/ObjectRouteLoader.php
@ -4830,10 +4927,21 @@ opt/app/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php
opt/app/vendor/symfony/routing/Tests/Fixtures/annotated.php
opt/app/vendor/symfony/routing/Tests/Fixtures/bad_format.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/bar.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/routing.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/controller/routing.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php
opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
opt/app/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
@ -4866,6 +4974,8 @@ opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/null_values.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/php_dsl.php
opt/app/vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php
opt/app/vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml
opt/app/vendor/symfony/routing/Tests/Fixtures/special_route_name.yml
opt/app/vendor/symfony/routing/Tests/Fixtures/validpattern.php
@ -4910,6 +5020,9 @@ opt/app/vendor/symfony/translation/Catalogue/TargetOperation.php
opt/app/vendor/symfony/translation/Command/XliffLintCommand.php
opt/app/vendor/symfony/translation/DataCollector/TranslationDataCollector.php
opt/app/vendor/symfony/translation/DataCollectorTranslator.php
opt/app/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php
opt/app/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php
opt/app/vendor/symfony/translation/DependencyInjection/TranslatorPass.php
opt/app/vendor/symfony/translation/Dumper/CsvFileDumper.php
opt/app/vendor/symfony/translation/Dumper/DumperInterface.php
opt/app/vendor/symfony/translation/Dumper/FileDumper.php
@ -4931,6 +5044,11 @@ opt/app/vendor/symfony/translation/Exception/RuntimeException.php
opt/app/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
opt/app/vendor/symfony/translation/Extractor/ChainExtractor.php
opt/app/vendor/symfony/translation/Extractor/ExtractorInterface.php
opt/app/vendor/symfony/translation/Extractor/PhpExtractor.php
opt/app/vendor/symfony/translation/Extractor/PhpStringTokenParser.php
opt/app/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php
opt/app/vendor/symfony/translation/Formatter/MessageFormatter.php
opt/app/vendor/symfony/translation/Formatter/MessageFormatterInterface.php
opt/app/vendor/symfony/translation/IdentityTranslator.php
opt/app/vendor/symfony/translation/Interval.php
opt/app/vendor/symfony/translation/LICENSE
@ -4958,12 +5076,17 @@ opt/app/vendor/symfony/translation/MessageSelector.php
opt/app/vendor/symfony/translation/MetadataAwareInterface.php
opt/app/vendor/symfony/translation/PluralizationRules.php
opt/app/vendor/symfony/translation/README.md
opt/app/vendor/symfony/translation/Reader/TranslationReader.php
opt/app/vendor/symfony/translation/Reader/TranslationReaderInterface.php
opt/app/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
opt/app/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php
opt/app/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php
opt/app/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php
opt/app/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php
opt/app/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php
opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php
opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
opt/app/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php
@ -4975,6 +5098,8 @@ opt/app/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php
opt/app/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php
opt/app/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php
opt/app/vendor/symfony/translation/Tests/IdentityTranslatorTest.php
opt/app/vendor/symfony/translation/Tests/IntervalTest.php
opt/app/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php
@ -5009,6 +5134,9 @@ opt/app/vendor/symfony/translation/Tests/fixtures/empty.yml
opt/app/vendor/symfony/translation/Tests/fixtures/encoding.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po
opt/app/vendor/symfony/translation/Tests/fixtures/escaped-id.po
opt/app/vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine
opt/app/vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine
opt/app/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php
opt/app/vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po
opt/app/vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/malformed.json
@ -5030,6 +5158,7 @@ opt/app/vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res
opt/app/vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources-clean.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf
opt/app/vendor/symfony/translation/Tests/fixtures/resources.csv
@ -5051,6 +5180,7 @@ opt/app/vendor/symfony/translation/TranslatorBagInterface.php
opt/app/vendor/symfony/translation/TranslatorInterface.php
opt/app/vendor/symfony/translation/Util/ArrayConverter.php
opt/app/vendor/symfony/translation/Writer/TranslationWriter.php
opt/app/vendor/symfony/translation/Writer/TranslationWriterInterface.php
opt/app/vendor/symfony/translation/composer.json
opt/app/vendor/symfony/translation/phpunit.xml.dist
opt/app/vendor/symfony/var-dumper/CHANGELOG.md
@ -5062,6 +5192,7 @@ opt/app/vendor/symfony/var-dumper/Caster/ConstStub.php
opt/app/vendor/symfony/var-dumper/Caster/CutArrayStub.php
opt/app/vendor/symfony/var-dumper/Caster/CutStub.php
opt/app/vendor/symfony/var-dumper/Caster/DOMCaster.php
opt/app/vendor/symfony/var-dumper/Caster/DateCaster.php
opt/app/vendor/symfony/var-dumper/Caster/DoctrineCaster.php
opt/app/vendor/symfony/var-dumper/Caster/EnumStub.php
opt/app/vendor/symfony/var-dumper/Caster/ExceptionCaster.php
@ -5096,6 +5227,7 @@ opt/app/vendor/symfony/var-dumper/README.md
opt/app/vendor/symfony/var-dumper/Resources/functions/dump.php
opt/app/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php
opt/app/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php
opt/app/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php
opt/app/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
opt/app/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
opt/app/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php

View File

@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = (
manifest = (
appTitle = (defaultText = "Firefly III"),
appVersion = 2,
appMarketingVersion = (defaultText = "4.6.10"),
appVersion = 4,
appMarketingVersion = (defaultText = "4.6.11"),
actions = [
# Define your "new document" handlers here.

View File

@ -2,6 +2,39 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [4.6.11] - 2017-11-30
### Added
- A debug page at `/debug` for easier debug.
- Strings translatable (see [issue 976](https://github.com/firefly-iii/firefly-iii/issues/976)), thanks to [Findus23](https://github.com/Findus23)
- Even more strings are translatable (and translated), thanks to [pkoziol](https://github.com/pkoziol) (see [issue 979](https://github.com/firefly-iii/firefly-iii/issues/979))
- Reconciliation of accounts ([issue 736](https://github.com/firefly-iii/firefly-iii/issues/736)), as requested by [kristophr](https://github.com/kristophr) and several others
### Changed
- Extended currency list, as suggested by @emuhendis in [issue 994](https://github.com/firefly-iii/firefly-iii/issues/994)
- [Issue 996](https://github.com/firefly-iii/firefly-iii/issues/996) as suggested by [dp87](https://github.com/dp87)
### Removed
- Disabled Heroku support until I get it working again.
### Fixed
- [Issue 980](https://github.com/firefly-iii/firefly-iii/issues/980), reported by [Tim-Frensch](https://github.com/Tim-Frensch)
- [Issue 987](https://github.com/firefly-iii/firefly-iii/issues/987), reported by [gavu](https://github.com/gavu)
- [Issue 988](https://github.com/firefly-iii/firefly-iii/issues/988), reported by [gavu](https://github.com/gavu)
- [Issue 992](https://github.com/firefly-iii/firefly-iii/issues/992), reported by [ncicovic](https://github.com/ncicovic)
- [Issue 993](https://github.com/firefly-iii/firefly-iii/issues/993), reported by [gavu](https://github.com/gavu)
- [Issue 997](https://github.com/firefly-iii/firefly-iii/issues/997), reported by [gavu](https://github.com/gavu)
- [Issue 1000](https://github.com/firefly-iii/firefly-iii/issues/1000), reported by [xpfgsyb](https://github.com/xpfgsyb)
- [Issue 1001](https://github.com/firefly-iii/firefly-iii/issues/1001), reported by [gavu](https://github.com/gavu)
- [Issue 1002](https://github.com/firefly-iii/firefly-iii/issues/1002), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1003](https://github.com/firefly-iii/firefly-iii/issues/1003), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1004](https://github.com/firefly-iii/firefly-iii/issues/1004), reported by [Aquariu](https://github.com/Aquariu)
- [Issue 1010](https://github.com/firefly-iii/firefly-iii/issues/1010)
- [Issue 1014](https://github.com/firefly-iii/firefly-iii/issues/1014), reported by [ursweiss](https://github.com/ursweiss)
- [Issue 1016](https://github.com/firefly-iii/firefly-iii/issues/1016)
- [Issue 1024](https://github.com/firefly-iii/firefly-iii/issues/1024), reported by [gavu](https://github.com/gavu)
- [Issue 1025](https://github.com/firefly-iii/firefly-iii/issues/1025), reported by [gavu](https://github.com/gavu)
## [4.6.10] - 2017-11-xx
### Added
- Greatly expanded Docker support thanks to [alazare619](https://github.com/alazare619)
@ -277,8 +310,8 @@ This will be the last release to support PHP 7.0.
- Can now make rules for attachments, see [issue 608](https://github.com/firefly-iii/firefly-iii/issues/608), as suggested by [dzaikos](https://github.com/dzaikos).
### Fixed
- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by forcaeluz
- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by welbert
- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by @forcaeluz
- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by @welbert
- And more various bug fixes.
## [4.3.8] - 2017-04-08

View File

@ -31,6 +31,8 @@ You can install Firefly III on any Linux or Windows machine. You'll need a web s
Register for a free Heroku account and instantly run Firefly III on your very own cloud instance.
_My Heroku configuration is currently broken, but I'm trying to fix it._
### Using Sandstorm.io
You can find Firefly III in [the Sandstorm.io marketplace](https://apps.sandstorm.io/app/uws252ya9mep4t77tevn85333xzsgrpgth8q4y1rhknn1hammw70). You can run it on your own installation or on Oasis.

View File

@ -2,6 +2,7 @@
"name": "Firefly III",
"description": "A free and open source personal finances manager",
"repository": "https://github.com/firefly-iii/firefly-iii",
"website": "https://firefly-iii.github.io/",
"logo": "https://raw.githubusercontent.com/firefly-iii/firefly-iii/master/public/mstile-150x150.png",
"keywords": [
"finance",
@ -36,14 +37,16 @@
"transfers",
"management"
],
"website": "https://firefly-iii.github.io/",
"addons": [
{
"plan": "heroku-postgresql"
"plan": "heroku-postgresql",
"options": {
"version": "9.5"
}
}
],
"scripts": {
"postdeploy": "export APP_KEY=$(php artisan --no-ansi key:generate --show)"
"postdeploy": "php artisan migrate:refresh --seed;php artisan firefly:instructions install"
},
"buildpacks": [
{

View File

@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use Carbon\Carbon;
@ -34,13 +32,10 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Console\Command;
use Storage;
/**
* Class CreateExport
* Class CreateExport.
*
* Generates export from the command line.
*
* @package FireflyIII\Console\Commands
*/
class CreateExport extends Command
{
@ -66,7 +61,6 @@ class CreateExport extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{
@ -74,7 +68,6 @@ class CreateExport extends Command
}
/**
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
@ -109,7 +102,7 @@ class CreateExport extends Command
// first date
$firstJournal = $journalRepository->first();
$first = new Carbon;
if (!is_null($firstJournal->id)) {
if (null !== $firstJournal->id) {
$first = $firstJournal->date;
}
@ -125,7 +118,6 @@ class CreateExport extends Command
'job' => $job,
];
/** @var ProcessorInterface $processor */
$processor = app(ProcessorInterface::class);
$processor->setSettings($settings);

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -35,9 +34,7 @@ use Monolog\Formatter\LineFormatter;
use Preferences;
/**
* Class CreateImport
*
* @package FireflyIII\Console\Commands
* Class CreateImport.
*/
class CreateImport extends Command
{
@ -65,7 +62,6 @@ class CreateImport extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{
@ -98,7 +94,7 @@ class CreateImport extends Command
}
$configurationData = json_decode(file_get_contents($configuration));
if (is_null($configurationData)) {
if (null === $configurationData) {
$this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
return;
@ -109,25 +105,21 @@ class CreateImport extends Command
$this->line(sprintf('Import into user: #%d (%s)', $user->id, $user->email));
$this->line(sprintf('Type of import: %s', $type));
/** @var ImportJobRepositoryInterface $jobRepository */
$jobRepository = app(ImportJobRepositoryInterface::class);
$jobRepository->setUser($user);
$job = $jobRepository->create($type);
$this->line(sprintf('Created job "%s"', $job->key));
Artisan::call('firefly:encrypt-file', ['file' => $file, 'key' => $job->key]);
$this->line('Stored import data...');
$job->configuration = $configurationData;
$job->status = 'configured';
$job->save();
$this->line('Stored configuration...');
if ($this->option('start') === true) {
if (true === $this->option('start')) {
$this->line('The import will start in a moment. This process is not visible...');
Log::debug('Go for import!');
@ -138,7 +130,6 @@ class CreateImport extends Command
$handler->setFormatter($formatter);
$monolog->pushHandler($handler);
// start the actual routine:
/** @var ImportRoutine $routine */
$routine = app(ImportRoutine::class);
@ -177,7 +168,7 @@ class CreateImport extends Command
$cwd = getcwd();
$validTypes = array_keys(config('firefly.import_formats'));
$type = strtolower($this->option('type'));
if (is_null($user->id)) {
if (null === $user->id) {
$this->error(sprintf('There is no user with ID %d.', $this->option('user')));
return false;

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -28,9 +27,7 @@ use Illuminate\Console\Command;
use Log;
/**
* Class DecryptAttachment
*
* @package FireflyIII\Console\Commands
* Class DecryptAttachment.
*/
class DecryptAttachment extends Command
{
@ -50,15 +47,12 @@ class DecryptAttachment extends Command
= 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.}
{directory:Where the file must be stored.}';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
@ -66,7 +60,6 @@ class DecryptAttachment extends Command
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*/
public function handle()
{
@ -76,7 +69,7 @@ class DecryptAttachment extends Command
$attachment = $repository->findWithoutUser($attachmentId);
$attachmentName = trim($this->argument('name'));
$storagePath = realpath(trim($this->argument('directory')));
if (is_null($attachment->id)) {
if (null === $attachment->id) {
$this->error(sprintf('No attachment with id #%d', $attachmentId));
Log::error(sprintf('DecryptAttachment: No attachment with id #%d', $attachmentId));
@ -108,7 +101,7 @@ class DecryptAttachment extends Command
$content = $repository->getContent($attachment);
$this->line(sprintf('Going to write content for attachment #%d into file "%s"', $attachment->id, $fullPath));
$result = file_put_contents($fullPath, $content);
if ($result === false) {
if (false === $result) {
$this->error('Could not write to file.');
return;

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -27,9 +26,7 @@ use Crypt;
use Illuminate\Console\Command;
/**
* Class EncryptFile
*
* @package FireflyIII\Console\Commands
* Class EncryptFile.
*/
class EncryptFile extends Command
{
@ -49,7 +46,6 @@ class EncryptFile extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -31,9 +30,7 @@ use Illuminate\Support\MessageBag;
use Log;
/**
* Class Import
*
* @package FireflyIII\Console\Commands
* Class Import.
*/
class Import extends Command
{
@ -53,7 +50,6 @@ class Import extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{
@ -68,7 +64,7 @@ class Import extends Command
Log::debug('Start start-import command');
$jobKey = $this->argument('key');
$job = ImportJob::where('key', $jobKey)->first();
if (is_null($job)) {
if (null === $job) {
$this->error(sprintf('No job found with key "%s"', $jobKey));
return;
@ -109,14 +105,14 @@ class Import extends Command
*/
private function isValid(ImportJob $job): bool
{
if (is_null($job)) {
if (null === $job) {
Log::error('This job does not seem to exist.');
$this->error('This job does not seem to exist.');
return false;
}
if ($job->status !== 'configured') {
if ('configured' !== $job->status) {
Log::error(sprintf('This job is not ready to be imported (status is %s).', $job->status));
$this->error('This job is not ready to be imported.');

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -31,9 +30,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Storage;
/**
* Class ScanAttachments
*
* @package FireflyIII\Console\Commands
* Class ScanAttachments.
*/
class ScanAttachments extends Command
{
@ -53,7 +50,6 @@ class ScanAttachments extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
@ -45,17 +43,15 @@ use Preferences;
use Schema;
/**
* Class UpgradeDatabase
* Class UpgradeDatabase.
*
* Upgrade user database.
*
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it just touches a lot of things.
* @package FireflyIII\Console\Commands
*/
class UpgradeDatabase extends Command
{
/**
* The console command description.
*
@ -85,6 +81,7 @@ class UpgradeDatabase extends Command
$this->setTransactionIdentifier();
$this->migrateRepetitions();
$this->updateAccountCurrencies();
$this->createNewTypes();
$this->line('Updating currency information..');
$this->updateTransferCurrencies();
$this->updateOtherCurrencies();
@ -93,8 +90,6 @@ class UpgradeDatabase extends Command
$this->info('Firefly III database is up to date.');
return;
}
/**
@ -108,7 +103,7 @@ class UpgradeDatabase extends Command
foreach ($set as $budgetLimit) {
/** @var LimitRepetition $repetition */
$repetition = $budgetLimit->limitrepetitions()->first();
if (!is_null($repetition)) {
if (null !== $repetition) {
$budgetLimit->end_date = $repetition->enddate;
$budgetLimit->save();
$this->line(sprintf('Updated budget limit #%d', $budgetLimit->id));
@ -173,7 +168,7 @@ class UpgradeDatabase extends Command
$obCurrency = intval($openingBalance->transaction_currency_id);
// both 0? set to default currency:
if ($accountCurrency === 0 && $obCurrency === 0) {
if (0 === $accountCurrency && 0 === $obCurrency) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $defaultCurrency->id]);
$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));
@ -181,7 +176,7 @@ class UpgradeDatabase extends Command
}
// account is set to 0, opening balance is not?
if ($accountCurrency === 0 && $obCurrency > 0) {
if (0 === $accountCurrency && $obCurrency > 0) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]);
$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));
@ -231,7 +226,7 @@ class UpgradeDatabase extends Command
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('account_types.type', [AccountType::DEFAULT, AccountType::ASSET])->first(['transactions.*']);
if (is_null($transaction)) {
if (null === $transaction) {
return;
}
/** @var Account $account */
@ -240,7 +235,7 @@ class UpgradeDatabase extends Command
$transactions = $journal->transactions()->get();
$transactions->each(
function (Transaction $transaction) use ($currency) {
if (is_null($transaction->transaction_currency_id)) {
if (null === $transaction->transaction_currency_id) {
$transaction->transaction_currency_id = $currency->id;
$transaction->save();
}
@ -295,6 +290,19 @@ class UpgradeDatabase extends Command
);
}
private function createNewTypes(): void
{
// create transaction type "Reconciliation".
$type = TransactionType::where('type', TransactionType::RECONCILIATION)->first();
if (is_null($type)) {
TransactionType::create(['type' => TransactionType::RECONCILIATION]);
}
$account = AccountType::where('type', AccountType::RECONCILIATION)->first();
if (is_null($account)) {
AccountType::create(['type' => AccountType::RECONCILIATION]);
}
}
/**
* Move all the journal_meta notes to their note object counter parts.
*/
@ -305,8 +313,8 @@ class UpgradeDatabase extends Command
foreach ($set as $meta) {
$journal = $meta->transactionJournal;
$note = $journal->notes()->first();
if (is_null($note)) {
$note = new Note;
if (null === $note) {
$note = new Note();
$note->noteable()->associate($journal);
}
@ -314,11 +322,9 @@ class UpgradeDatabase extends Command
$note->save();
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
$meta->delete();
}
}
/**
* This method makes sure that the transaction journal uses the currency given in the transaction.
*
@ -334,7 +340,10 @@ class UpgradeDatabase extends Command
if (!(intval($currency->id) === intval($journal->transaction_currency_id))) {
$this->line(
sprintf(
'Transfer #%d ("%s") has been updated to use %s instead of %s.', $journal->id, $journal->description, $currency->code,
'Transfer #%d ("%s") has been updated to use %s instead of %s.',
$journal->id,
$journal->description,
$currency->code,
$journal->transactionCurrency->code
)
);
@ -376,7 +385,7 @@ class UpgradeDatabase extends Command
return;
}
if (!is_null($opposing)) {
if (null !== $opposing) {
// give both a new identifier:
$transaction->identifier = $identifier;
$opposing->identifier = $identifier;
@ -385,7 +394,7 @@ class UpgradeDatabase extends Command
$processed[] = $transaction->id;
$processed[] = $opposing->id;
}
$identifier++;
++$identifier;
}
return;
@ -412,7 +421,7 @@ class UpgradeDatabase extends Command
$currency = $repository->find(intval($transaction->account->getMeta('currency_id')));
// has no currency ID? Must have, so fill in using account preference:
if (is_null($transaction->transaction_currency_id)) {
if (null === $transaction->transaction_currency_id) {
$transaction->transaction_currency_id = $currency->id;
Log::debug(sprintf('Transaction #%d has no currency setting, now set to %s', $transaction->id, $currency->code));
$transaction->save();
@ -420,11 +429,14 @@ class UpgradeDatabase extends Command
// does not match the source account (see above)? Can be fixed
// when mismatch in transaction and NO foreign amount is set:
if ($transaction->transaction_currency_id !== $currency->id && is_null($transaction->foreign_amount)) {
if ($transaction->transaction_currency_id !== $currency->id && null === $transaction->foreign_amount) {
Log::debug(
sprintf(
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.', $transaction->id,
$transaction->transaction_currency_id, $currency->id, $transaction->amount
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.',
$transaction->id,
$transaction->transaction_currency_id,
$currency->id,
$transaction->amount
)
);
$transaction->transaction_currency_id = $currency->id;
@ -438,7 +450,7 @@ class UpgradeDatabase extends Command
$opposing = $journal->transactions()->where('amount', '>', 0)->where('identifier', $transaction->identifier)->first();
$opposingCurrency = $repository->find(intval($opposing->account->getMeta('currency_id')));
if (is_null($opposingCurrency->id)) {
if (null === $opposingCurrency->id) {
Log::error(sprintf('Account #%d ("%s") must have currency preference but has none.', $opposing->account->id, $opposing->account->name));
return;
@ -468,24 +480,23 @@ class UpgradeDatabase extends Command
}
// if foreign amount of one is null and the other is not, use this to restore:
if (is_null($transaction->foreign_amount) && !is_null($opposing->foreign_amount)) {
if (null === $transaction->foreign_amount && null !== $opposing->foreign_amount) {
$transaction->foreign_amount = bcmul(strval($opposing->foreign_amount), '-1');
$transaction->save();
Log::debug(sprintf('Restored foreign amount of transaction (1) #%d to %s', $transaction->id, $transaction->foreign_amount));
}
// if foreign amount of one is null and the other is not, use this to restore (other way around)
if (is_null($opposing->foreign_amount) && !is_null($transaction->foreign_amount)) {
if (null === $opposing->foreign_amount && null !== $transaction->foreign_amount) {
$opposing->foreign_amount = bcmul(strval($transaction->foreign_amount), '-1');
$opposing->save();
Log::debug(sprintf('Restored foreign amount of transaction (2) #%d to %s', $opposing->id, $opposing->foreign_amount));
}
// when both are zero, try to grab it from journal:
if (is_null($opposing->foreign_amount) && is_null($transaction->foreign_amount)) {
if (null === $opposing->foreign_amount && null === $transaction->foreign_amount) {
$foreignAmount = $journal->getMeta('foreign_amount');
if (is_null($foreignAmount)) {
if (null === $foreignAmount) {
Log::debug(sprintf('Journal #%d has missing foreign currency data, forced to do 1:1 conversion :(.', $transaction->transaction_journal_id));
$transaction->foreign_amount = bcmul(strval($transaction->amount), '-1');
$opposing->foreign_amount = bcmul(strval($opposing->amount), '-1');
@ -497,7 +508,9 @@ class UpgradeDatabase extends Command
$foreignPositive = app('steam')->positive(strval($foreignAmount));
Log::debug(
sprintf(
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").', $transaction->transaction_journal_id, $foreignAmount
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").',
$transaction->transaction_journal_id,
$foreignAmount
)
);
$transaction->foreign_amount = bcmul($foreignPositive, '-1');
@ -506,7 +519,6 @@ class UpgradeDatabase extends Command
$opposing->save();
}
return;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -26,9 +25,7 @@ namespace FireflyIII\Console\Commands;
use Illuminate\Console\Command;
/**
* Class UpgradeFireflyInstructions
*
* @package FireflyIII\Console\Commands
* Class UpgradeFireflyInstructions.
*/
class UpgradeFireflyInstructions extends Command
{
@ -47,7 +44,6 @@ class UpgradeFireflyInstructions extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{
@ -59,17 +55,16 @@ class UpgradeFireflyInstructions extends Command
*/
public function handle()
{
if ($this->argument('task') === 'update') {
if ('update' === $this->argument('task')) {
$this->updateInstructions();
}
if ($this->argument('task') === 'install') {
if ('install' === $this->argument('task')) {
$this->installInstructions();
}
}
/**
* Show a nice box
* Show a nice box.
*
* @param string $text
*/
@ -82,7 +77,7 @@ class UpgradeFireflyInstructions extends Command
}
/**
* Show a nice info box
* Show a nice info box.
*
* @param string $text
*/
@ -109,12 +104,10 @@ class UpgradeFireflyInstructions extends Command
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
}
$this->showLine();
$this->boxed('');
if (is_null($text)) {
if (null === $text) {
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxedInfo('There are no extra installation instructions.');
$this->boxed('Firefly III should be ready for use.');
@ -131,17 +124,16 @@ class UpgradeFireflyInstructions extends Command
}
/**
* Show a line
* Show a line.
*/
private function showLine()
{
$line = '+';
for ($i = 0; $i < 78; $i++) {
for ($i = 0; $i < 78; ++$i) {
$line .= '-';
}
$line .= '+';
$this->line($line);
}
/**
@ -159,12 +151,10 @@ class UpgradeFireflyInstructions extends Command
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
}
$this->showLine();
$this->boxed('');
if (is_null($text)) {
if (null === $text) {
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
$this->boxedInfo('There are no extra upgrade instructions.');
$this->boxed('Firefly III should be ready for use.');

View File

@ -19,7 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
/**
@ -36,9 +35,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Str;
/**
* Class UseEncryption
*
* @package FireflyIII\Console\Commands
* Class UseEncryption.
*/
class UseEncryption extends Command
{
@ -57,7 +54,6 @@ class UseEncryption extends Command
/**
* Create a new command instance.
*
*/
public function __construct()
{

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -28,11 +27,9 @@ use Log;
use Preferences;
/**
* Trait VerifiesAccessToken
* Trait VerifiesAccessToken.
*
* Verifies user access token for sensitive commands.
*
* @package FireflyIII\Console\Commands
*/
trait VerifiesAccessToken
{
@ -58,13 +55,13 @@ trait VerifiesAccessToken
$repository = app(UserRepositoryInterface::class);
$user = $repository->find($userId);
if (is_null($user->id)) {
if (null === $user->id) {
Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
return false;
}
$accessToken = Preferences::getForUser($user, 'access_token', null);
if (is_null($accessToken)) {
if (null === $accessToken) {
Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
return false;
@ -77,5 +74,4 @@ trait VerifiesAccessToken
return true;
}
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
@ -42,11 +41,9 @@ use Schema;
use stdClass;
/**
* Class VerifyDatabase
* Class VerifyDatabase.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
* @package FireflyIII\Console\Commands
*/
class VerifyDatabase extends Command
{
@ -96,7 +93,6 @@ class VerifyDatabase extends Command
$this->repairPiggyBanks();
$this->createLinkTypes();
$this->createAccessTokens();
}
/**
@ -108,7 +104,7 @@ class VerifyDatabase extends Command
/** @var User $user */
foreach ($users as $user) {
$pref = Preferences::getForUser($user, 'access_token', null);
if (is_null($pref)) {
if (null === $pref) {
$token = $user->generateAccessToken();
Preferences::setForUser($user, 'access_token', $token);
$this->line(sprintf('Generated access token for user %s', $user->email));
@ -129,7 +125,7 @@ class VerifyDatabase extends Command
];
foreach ($set as $name => $values) {
$link = LinkType::where('name', $name)->where('outward', $values[0])->where('inward', $values[1])->first();
if (is_null($link)) {
if (null === $link) {
$link = new LinkType;
$link->name = $name;
$link->outward = $values[0];
@ -148,17 +144,17 @@ class VerifyDatabase extends Command
$set = PiggyBankEvent::with(['PiggyBank', 'TransactionJournal', 'TransactionJournal.TransactionType'])->get();
$set->each(
function (PiggyBankEvent $event) {
if (is_null($event->transaction_journal_id)) {
if (null === $event->transaction_journal_id) {
return true;
}
/** @var TransactionJournal $journal */
$journal = $event->transactionJournal()->first();
if (is_null($journal)) {
if (null === $journal) {
return true;
}
$type = $journal->transactionType->type;
if ($type !== TransactionType::TRANSFER) {
if (TransactionType::TRANSFER !== $type) {
$event->transaction_journal_id = null;
$event->save();
$this->line(sprintf('Piggy bank #%d was referenced by an invalid event. This has been fixed.', $event->piggy_bank_id));
@ -208,7 +204,10 @@ class VerifyDatabase extends Command
foreach ($set as $entry) {
$line = sprintf(
'User #%d (%s) has budget #%d ("%s") which has no budget limits.',
$entry->user_id, $entry->email, $entry->id, $entry->name
$entry->user_id,
$entry->email,
$entry->id,
$entry->name
);
$this->line($line);
}
@ -232,11 +231,11 @@ class VerifyDatabase extends Command
->get(
['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id',
'transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id',
'transaction_journals.deleted_at as journal_deleted_at']
'transaction_journals.deleted_at as journal_deleted_at',]
);
/** @var stdClass $entry */
foreach ($set as $entry) {
$date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at;
$date = null === $entry->transaction_deleted_at ? $entry->journal_deleted_at : $entry->transaction_deleted_at;
$this->error(
'Error: Account #' . $entry->account_id . ' should have been deleted, but has not.' .
' Find it in the table called "accounts" and change the "deleted_at" field to: "' . $date . '"'
@ -268,7 +267,7 @@ class VerifyDatabase extends Command
->whereNull('transaction_journals.deleted_at')
->get(
['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type',
'transaction_types.type']
'transaction_types.type',]
);
foreach ($set as $entry) {
$this->error(
@ -287,7 +286,7 @@ class VerifyDatabase extends Command
}
/**
* Any deleted transaction journals that have transactions that are NOT deleted:
* Any deleted transaction journals that have transactions that are NOT deleted:.
*/
private function reportJournals()
{
@ -301,7 +300,7 @@ class VerifyDatabase extends Command
'transaction_journals.description',
'transaction_journals.deleted_at as journal_deleted',
'transactions.id as transaction_id',
'transactions.deleted_at as transaction_deleted_at']
'transactions.deleted_at as transaction_deleted_at',]
);
/** @var stdClass $entry */
foreach ($set as $entry) {
@ -327,7 +326,6 @@ class VerifyDatabase extends Command
'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id
);
}
}
/**
@ -339,7 +337,7 @@ class VerifyDatabase extends Command
{
$plural = str_plural($name);
$class = sprintf('FireflyIII\Models\%s', ucfirst($name));
$field = $name === 'tag' ? 'tag' : 'name';
$field = 'tag' === $name ? 'tag' : 'name';
$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
->distinct()
@ -349,7 +347,6 @@ class VerifyDatabase extends Command
/** @var stdClass $entry */
foreach ($set as $entry) {
$objName = $entry->name;
try {
$objName = Crypt::decrypt($objName);
@ -359,7 +356,11 @@ class VerifyDatabase extends Command
$line = sprintf(
'User #%d (%s) has %s #%d ("%s") which has no transactions.',
$entry->user_id, $entry->email, $name, $entry->id, $objName
$entry->user_id,
$entry->email,
$name,
$entry->id,
$objName
);
$this->line($line);
}
@ -376,7 +377,7 @@ class VerifyDatabase extends Command
/** @var User $user */
foreach ($userRepository->all() as $user) {
$sum = strval($user->transactions()->sum('amount'));
if (bccomp($sum, '0') !== 0) {
if (0 !== bccomp($sum, '0')) {
$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');
}
}
@ -392,7 +393,7 @@ class VerifyDatabase extends Command
->whereNull('transaction_journals.deleted_at')
->get(
['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id',
'transaction_journals.deleted_at']
'transaction_journals.deleted_at',]
);
/** @var stdClass $entry */
foreach ($set as $entry) {
@ -419,11 +420,10 @@ class VerifyDatabase extends Command
$this->error(
sprintf(
'Error: Transaction journal #%d is a %s, but has a budget. Edit it without changing anything, so the budget will be removed.',
$entry->id, $entry->transactionType->type
$entry->id,
$entry->transactionType->type
)
);
}
}
}

View File

@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
/**
* Kernel.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
@ -48,13 +46,10 @@ class Kernel extends ConsoleKernel
*/
protected $commands
= [
//
];
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
@ -66,9 +61,8 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function schedule(Schedule $schedule)

View File

@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
use Log;
/**
* Class AdminRequestedTestMessage
*
* @package FireflyIII\Events
* Class AdminRequestedTestMessage.
*/
class AdminRequestedTestMessage extends Event
{
@ -43,7 +39,7 @@ class AdminRequestedTestMessage extends Event
/**
* Create a new event instance.
*
* @param User $user
* @param User $user
* @param string $ipAddress
*/
public function __construct(User $user, string $ipAddress)

View File

@ -18,17 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
/**
* Class Event
*
* @package FireflyIII\Events
* Class Event.
*/
abstract class Event
{
//
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
@ -27,9 +26,7 @@ use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class RegisteredUser
*
* @package FireflyIII\Events
* Class RegisteredUser.
*/
class RegisteredUser extends Event
{
@ -41,7 +38,7 @@ class RegisteredUser extends Event
/**
* Create a new event instance. This event is triggered when a new user registers.
*
* @param User $user
* @param User $user
* @param string $ipAddress
*/
public function __construct(User $user, string $ipAddress)

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
@ -27,9 +26,7 @@ use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class RequestedNewPassword
*
* @package FireflyIII\Events
* Class RequestedNewPassword.
*/
class RequestedNewPassword extends Event
{
@ -42,7 +39,7 @@ class RequestedNewPassword extends Event
/**
* Create a new event instance. This event is triggered when a users tries to reset his or her password.
*
* @param User $user
* @param User $user
* @param string $token
* @param string $ipAddress
*/
@ -52,5 +49,4 @@ class RequestedNewPassword extends Event
$this->token = $token;
$this->ipAddress = $ipAddress;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class StoredTransactionJournal
*
* @package FireflyIII\Events
* Class StoredTransactionJournal.
*/
class StoredTransactionJournal extends Event
{
use SerializesModels;
/** @var TransactionJournal */
@ -49,10 +45,7 @@ class StoredTransactionJournal extends Event
*/
public function __construct(TransactionJournal $journal, int $piggyBankId)
{
//
$this->journal = $journal;
$this->piggyBankId = $piggyBankId;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class UpdatedTransactionJournal
*
* @package FireflyIII\Events
* Class UpdatedTransactionJournal.
*/
class UpdatedTransactionJournal extends Event
{
use SerializesModels;
/** @var TransactionJournal */
@ -46,8 +42,6 @@ class UpdatedTransactionJournal extends Event
*/
public function __construct(TransactionJournal $journal)
{
//
$this->journal = $journal;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events;
@ -27,19 +26,17 @@ use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class UserChangedEmail
*
* @package FireflyIII\Events
* Class UserChangedEmail.
*/
class UserChangedEmail extends Event
{
use SerializesModels;
/** @var string */
/** @var string */
public $ipAddress;
/** @var string */
/** @var string */
public $newEmail;
/** @var string */
/** @var string */
public $oldEmail;
/** @var User */
public $user;
@ -59,4 +56,4 @@ class UserChangedEmail extends Event
$this->oldEmail = $oldEmail;
$this->newEmail = $newEmail;
}
}
}

View File

@ -18,18 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
* @package FireflyIII\Exceptions
* Class FireflyException.
*/
class FireflyException extends \Exception
{
}
}

View File

@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
/**
* Handler.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
@ -39,7 +37,6 @@ use FireflyIII\Jobs\MailError;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
class Handler extends ExceptionHandler
{
/**
@ -59,21 +56,19 @@ class Handler extends ExceptionHandler
*/
protected $dontReport
= [
//
];
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
$isDebug = env('APP_DEBUG', false);
return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500);
@ -88,9 +83,10 @@ class Handler extends ExceptionHandler
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.
* @param \Exception $exception
*
* @return void
* @param \Exception $exception
*
* @return mixed|void
*/
public function report(Exception $exception)
{
@ -121,7 +117,6 @@ class Handler extends ExceptionHandler
dispatch($job);
}
parent::report($exception);
}
}

View File

@ -18,18 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
* @package FireflyIII\Exceptions
* Class NotImplementedException.
*/
class NotImplementedException extends \Exception
{
}
}

View File

@ -18,17 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Exceptions;
/**
* Class ValidationExceptions
*
* @package FireflyIII\Exception
* Class ValidationExceptions.
*/
class ValidationException extends \Exception
{
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Collector;
@ -33,19 +32,17 @@ use Log;
use Storage;
/**
* Class AttachmentCollector
*
* @package FireflyIII\Export\Collector
* Class AttachmentCollector.
*/
class AttachmentCollector extends BasicCollector implements CollectorInterface
{
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var AttachmentRepositoryInterface */
/** @var AttachmentRepositoryInterface */
private $repository;
/** @var Carbon */
/** @var Carbon */
private $start;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $uploadDisk;
@ -55,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
public function __construct()
{
/** @var AttachmentRepositoryInterface repository */
// @var AttachmentRepositoryInterface repository
$this->repository = app(AttachmentRepositoryInterface::class);
// make storage:
$this->uploadDisk = Storage::disk('upload');
@ -104,11 +101,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
$exportFile = $this->exportFileName($attachment);
$this->exportDisk->put($exportFile, $decrypted);
$this->getEntries()->push($exportFile);
} catch (DecryptException $e) {
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
}
}
return true;
@ -123,7 +118,6 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
private function exportFileName($attachment): string
{
return sprintf('%s-Attachment nr. %s - %s', $this->job->key, strval($attachment->id), $attachment->filename);
}

View File

@ -18,26 +18,22 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Collector;
use FireflyIII\Models\ExportJob;
use FireflyIII\User;
use Illuminate\Support\Collection;
/**
* Class BasicCollector
*
* @package FireflyIII\Export\Collector
* Class BasicCollector.
*/
class BasicCollector
{
/** @var ExportJob */
protected $job;
/** @var User */
/** @var User */
protected $user;
/** @var Collection */
private $entries;
@ -82,6 +78,4 @@ class BasicCollector
{
$this->user = $user;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Collector;
@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
* Interface CollectorInterface
*
* @package FireflyIII\Export\Collector
* Interface CollectorInterface.
*/
interface CollectorInterface
{
@ -45,9 +42,6 @@ interface CollectorInterface
/**
* @param Collection $entries
*
* @return void
*
*/
public function setEntries(Collection $entries);
@ -57,5 +51,4 @@ interface CollectorInterface
* @return mixed
*/
public function setJob(ExportJob $job);
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Collector;
@ -30,9 +29,7 @@ use Log;
use Storage;
/**
* Class UploadCollector
*
* @package FireflyIII\Export\Collector
* Class UploadCollector.
*/
class UploadCollector extends BasicCollector implements CollectorInterface
{
@ -94,7 +91,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
{
// find job associated with import file:
$job = $this->job->user->importJobs()->where('key', $key)->first();
if (is_null($job)) {
if (null === $job) {
return false;
}
@ -116,5 +113,4 @@ class UploadCollector extends BasicCollector implements CollectorInterface
return true;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Entry;
@ -27,7 +26,7 @@ use FireflyIII\Models\Transaction;
/**
* To extend the exported object, in case of new features in Firefly III for example,
* do the following:
* do the following:.
*
* - Add the field(s) to this class. If you add more than one related field, add a new object.
* - Make sure the "fromJournal"-routine fills these fields.
@ -39,10 +38,9 @@ use FireflyIII\Models\Transaction;
*
*
* Class Entry
*
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.TooManyFields)
*
* @package FireflyIII\Export\Entry
*/
final class Entry
{
@ -84,7 +82,10 @@ final class Entry
public $bill_name;
public $notes;
public $tags;
// @formatter:on
/**
@ -106,7 +107,7 @@ final class Entry
*/
public static function fromTransaction(Transaction $transaction): Entry
{
$entry = new self;
$entry = new self();
$entry->journal_id = $transaction->journal_id;
$entry->transaction_id = $transaction->id;
$entry->date = $transaction->date->format('Ymd');
@ -117,12 +118,13 @@ final class Entry
$entry->currency_code = $transaction->transactionCurrency->code;
$entry->amount = round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places);
$entry->foreign_currency_code = is_null($transaction->foreign_currency_id) ? null : $transaction->foreignCurrency->code;
$entry->foreign_amount = is_null($transaction->foreign_currency_id)
$entry->foreign_currency_code = null === $transaction->foreign_currency_id ? null : $transaction->foreignCurrency->code;
$entry->foreign_amount = null === $transaction->foreign_currency_id
? null
: strval(
round(
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
$transaction->transaction_foreign_amount,
$transaction->foreignCurrency->decimal_places
)
);
@ -141,23 +143,23 @@ final class Entry
$entry->opposing_account_bic = $transaction->opposing_account_bic;
$entry->opposing_currency_code = $transaction->opposing_currency_code;
/** budget */
// budget
$entry->budget_id = $transaction->transaction_budget_id;
$entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_budget_name);
if (is_null($transaction->transaction_budget_id)) {
if (null === $transaction->transaction_budget_id) {
$entry->budget_id = $transaction->transaction_journal_budget_id;
$entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name);
}
/** category */
// category
$entry->category_id = $transaction->transaction_category_id;
$entry->category_name = app('steam')->tryDecrypt($transaction->transaction_category_name);
if (is_null($transaction->transaction_category_id)) {
if (null === $transaction->transaction_category_id) {
$entry->category_id = $transaction->transaction_journal_category_id;
$entry->category_name = app('steam')->tryDecrypt($transaction->transaction_journal_category_name);
}
/** budget */
// budget
$entry->bill_id = $transaction->bill_id;
$entry->bill_name = app('steam')->tryDecrypt($transaction->bill_name);
@ -166,6 +168,4 @@ final class Entry
return $entry;
}
}

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export;
use Crypt;
use DB;
use FireflyIII\Exceptions\FireflyException;
@ -43,32 +41,29 @@ use Storage;
use ZipArchive;
/**
* Class ExpandedProcessor
* Class ExpandedProcessor.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) // its doing a lot.
*
* @package FireflyIII\Export
*/
class ExpandedProcessor implements ProcessorInterface
{
/** @var Collection */
public $accounts;
/** @var string */
/** @var string */
public $exportFormat;
/** @var bool */
/** @var bool */
public $includeAttachments;
/** @var bool */
/** @var bool */
public $includeOldUploads;
/** @var ExportJob */
/** @var ExportJob */
public $job;
/** @var array */
public $settings;
/** @var Collection */
/** @var Collection */
private $exportEntries;
/** @var Collection */
/** @var Collection */
private $files;
/** @var Collection */
/** @var Collection */
private $journals;
/**
@ -136,7 +131,6 @@ class ExpandedProcessor implements ProcessorInterface
$transaction->opposing_account_number = $ibans[$opposingId]['accountNumber'] ?? '';
$transaction->opposing_account_bic = $ibans[$opposingId]['BIC'] ?? '';
$transaction->opposing_currency_code = $currencies[$opposingCurrencyId] ?? '';
}
);
@ -177,6 +171,7 @@ class ExpandedProcessor implements ProcessorInterface
/**
* @return bool
*
* @throws FireflyException
*/
public function createZipFile(): bool
@ -185,7 +180,7 @@ class ExpandedProcessor implements ProcessorInterface
$file = $this->job->key . '.zip';
$fullPath = storage_path('export') . '/' . $file;
if ($zip->open($fullPath, ZipArchive::CREATE) !== true) {
if (true !== $zip->open($fullPath, ZipArchive::CREATE)) {
throw new FireflyException('Cannot store zip file.');
}
// for each file in the collection, add it to the zip file.
@ -280,7 +275,7 @@ class ExpandedProcessor implements ProcessorInterface
}
/**
* Get all IBAN / SWIFT / account numbers
* Get all IBAN / SWIFT / account numbers.
*
* @param array $array
*

View File

@ -18,23 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Exporter;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
* Class BasicExporter
*
* @package FireflyIII\Export\Exporter
* Class BasicExporter.
*/
class BasicExporter
{
/** @var ExportJob */
/** @var ExportJob */
protected $job;
/** @var Collection */
private $entries;
@ -70,6 +66,4 @@ class BasicExporter
{
$this->job = $job;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Exporter;
@ -28,13 +27,11 @@ use League\Csv\Writer;
use SplFileObject;
/**
* Class CsvExporter
*
* @package FireflyIII\Export\Exporter
* Class CsvExporter.
*/
class CsvExporter extends BasicExporter implements ExporterInterface
{
/** @var string */
/** @var string */
private $fileName;
/**
@ -69,7 +66,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface
// get field names for header row:
$first = $this->getEntries()->first();
$headers = [];
if (!is_null($first)) {
if (null !== $first) {
$headers = array_keys(get_object_vars($first));
}
@ -88,7 +85,6 @@ class CsvExporter extends BasicExporter implements ExporterInterface
return true;
}
private function tempFile()
{
$this->fileName = $this->job->key . '-records.csv';

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export\Exporter;
@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
* Interface ExporterInterface
*
* @package FireflyIII\Export\Exporter
* Interface ExporterInterface.
*/
interface ExporterInterface
{
@ -50,9 +47,6 @@ interface ExporterInterface
/**
* @param Collection $entries
*
* @return void
*
*/
public function setEntries(Collection $entries);
@ -60,5 +54,4 @@ interface ExporterInterface
* @param ExportJob $job
*/
public function setJob(ExportJob $job);
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Export;
@ -26,13 +25,10 @@ namespace FireflyIII\Export;
use Illuminate\Support\Collection;
/**
* Interface ProcessorInterface
*
* @package FireflyIII\Export
* Interface ProcessorInterface.
*/
interface ProcessorInterface
{
/**
* Processor constructor.
*/

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Chart\Basic;
@ -27,15 +26,12 @@ use FireflyIII\Support\ChartColour;
use Steam;
/**
* Class ChartJsGenerator
*
* @package FireflyIII\Generator\Chart\Basic
* Class ChartJsGenerator.
*/
class ChartJsGenerator implements GeneratorInterface
{
/**
* Will generate a Chart JS compatible array from the given input. Expects this format
* Will generate a Chart JS compatible array from the given input. Expects this format.
*
* Will take labels for all from first set.
*
@ -102,7 +98,7 @@ class ChartJsGenerator implements GeneratorInterface
}
/**
* Expects data as:
* Expects data as:.
*
* key => value
*
@ -123,7 +119,7 @@ class ChartJsGenerator implements GeneratorInterface
// different sort when values are positive and when they're negative.
asort($data);
$next = next($data);
if (!is_bool($next) && bccomp($next, '0') === 1) {
if (!is_bool($next) && 1 === bccomp($next, '0')) {
// next is positive, sort other way around.
arsort($data);
}
@ -131,19 +127,18 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0;
foreach ($data as $key => $value) {
// make larger than 0
$chartData['datasets'][0]['data'][] = floatval(Steam::positive($value));
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['labels'][] = $key;
$index++;
++$index;
}
return $chartData;
}
/**
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
*
* 'label-of-entry' => value
* 'label-of-entry' => value

View File

@ -18,21 +18,17 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Chart\Basic;
/**
* Interface GeneratorInterface
*
* @package FireflyIII\Generator\Chart\Basic
* Interface GeneratorInterface.
*/
interface GeneratorInterface
{
/**
* Will generate a Chart JS compatible array from the given input. Expects this format
* Will generate a Chart JS compatible array from the given input. Expects this format.
*
* Will take labels for all from first set.
*
@ -66,7 +62,7 @@ interface GeneratorInterface
public function multiSet(array $data): array;
/**
* Expects data as:
* Expects data as:.
*
* key => value
*
@ -77,7 +73,7 @@ interface GeneratorInterface
public function pieChart(array $data): array;
/**
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
*
* 'label-of-entry' => value
* 'label-of-entry' => value
@ -88,5 +84,4 @@ interface GeneratorInterface
* @return array
*/
public function singleSet(string $setLabel, array $data): array;
}

View File

@ -18,33 +18,28 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
use Steam;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Audit
* Class MonthReportGenerator.
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Carbon */
/** @var Carbon */
private $start;
/**
@ -52,8 +47,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function generate(): string
{
$auditData = [];
$dayBefore = clone $this->start;
$dayBefore->subDay();
@ -77,11 +70,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
'create_date', 'update_date',
];
return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
->render();
}
/**
@ -157,7 +148,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
* @return array
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // not that long
*
*/
private function getAuditReport(Account $account, Carbon $date): array
{
@ -173,7 +163,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$startBalance = $dayBeforeBalance;
$currency = $currencyRepos->find(intval($account->getMeta('currency_id')));
/** @var Transaction $journal */
// @var Transaction $journal
foreach ($journals as $transaction) {
$transaction->before = $startBalance;
$transactionAmount = $transaction->transaction_amount;

View File

@ -18,20 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
/**
* Class MultiYearReportGenerator
*
* @package FireflyIII\Generator\Report\Audit
* Class MultiYearReportGenerator.
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,21 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
/**
* Class YearReportGenerator
*
* @package FireflyIII\Generator\Report\Audit
* Class YearReportGenerator.
*/
class YearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
@ -37,23 +35,21 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Budget
* Class MonthReportGenerator.
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Collection */
/** @var Collection */
private $budgets;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Collection */
private $expenses;
/** @var Collection */
private $income;
/** @var Carbon */
/** @var Carbon */
private $start;
/**

View File

@ -18,20 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
/**
* Class MultiYearReportGenerator
*
* @package FireflyIII\Generator\Report\Budget
* Class MultiYearReportGenerator.
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,21 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
/**
* Class YearReportGenerator
*
* @package FireflyIII\Generator\Report\Budget
* Class YearReportGenerator.
*/
class YearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
@ -38,23 +36,21 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Category
* Class MonthReportGenerator.
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Collection */
/** @var Collection */
private $categories;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Collection */
private $expenses;
/** @var Collection */
private $income;
/** @var Carbon */
/** @var Carbon */
private $start;
/**
@ -83,12 +79,19 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
$topExpenses = $this->getTopExpenses();
$topIncome = $this->getTopIncome();
// render!
return view(
'reports.category.month',
compact(
'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses', 'averageIncome', 'topExpenses'
'accountIds',
'categoryIds',
'topIncome',
'reportType',
'accountSummary',
'categorySummary',
'averageExpenses',
'averageIncome',
'topExpenses'
)
)
->with('start', $this->start)->with('end', $this->end)

View File

@ -18,20 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
/**
* Class MultiYearReportGenerator
*
* @package FireflyIII\Generator\Report\Category
* Class MultiYearReportGenerator.
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,21 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
/**
* Class YearReportGenerator
*
* @package FireflyIII\Generator\Report\Category
* Class YearReportGenerator.
*/
class YearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report;
@ -27,19 +26,17 @@ use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
/**
* Class ReportGeneratorFactory
*
* @package FireflyIII\Generator\Report
* Class ReportGeneratorFactory.
*/
class ReportGeneratorFactory
{
/**
* @param string $type
* @param Carbon $start
* @param Carbon $end
*
* @return ReportGeneratorInterface
*
* @throws FireflyException
*/
public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface
@ -55,7 +52,6 @@ class ReportGeneratorFactory
$period = 'MultiYear';
}
$class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);
if (class_exists($class)) {
/** @var ReportGeneratorInterface $obj */

View File

@ -18,19 +18,15 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report;
use Carbon\Carbon;
use Illuminate\Support\Collection;
/**
* Interface ReportGeneratorInterface
*
* @package FireflyIII\Generator\Report
* Interface ReportGeneratorInterface.
*/
interface ReportGeneratorInterface
{
@ -80,5 +76,4 @@ interface ReportGeneratorInterface
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface;
}

View File

@ -18,29 +18,25 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Report\ReportHelperInterface;
use Illuminate\Support\Collection;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Standard
* Class MonthReportGenerator.
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Carbon */
/** @var Carbon */
private $start;
/**

View File

@ -18,28 +18,24 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Standard
* Class MonthReportGenerator.
*/
class MultiYearReportGenerator implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Carbon */
/** @var Carbon */
private $start;
/**

View File

@ -18,28 +18,24 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Standard
* Class MonthReportGenerator.
*/
class YearReportGenerator implements ReportGeneratorInterface
{
/** @var Collection */
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Carbon */
/** @var Carbon */
private $start;
/**

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report;
@ -26,11 +25,8 @@ namespace FireflyIII\Generator\Report;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
/**
* Class Support
*
* @package FireflyIII\Generator\Report\Category
* Class Support.
*/
class Support
{
@ -80,7 +76,7 @@ class Support
];
continue;
}
$result[$opposingId]['count']++;
++$result[$opposingId]['count'];
$result[$opposingId]['sum'] = bcadd($result[$opposingId]['sum'], $transaction->transaction_amount);
$result[$opposingId]['average'] = bcdiv($result[$opposingId]['sum'], strval($result[$opposingId]['count']));
}
@ -98,6 +94,7 @@ class Support
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.
*
* @param array $spent
* @param array $earned
*
@ -108,7 +105,7 @@ class Support
$return = [];
/**
* @var int $accountId
* @var int
* @var string $entry
*/
foreach ($spent as $objectId => $entry) {
@ -121,7 +118,7 @@ class Support
unset($entry);
/**
* @var int $accountId
* @var int
* @var string $entry
*/
foreach ($earned as $objectId => $entry) {
@ -132,7 +129,6 @@ class Support
$return[$objectId]['earned'] = $entry;
}
return $return;
}
@ -153,5 +149,4 @@ class Support
return $result;
}
}

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
@ -39,22 +37,19 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class MonthReportGenerator
*
* @package FireflyIII\Generator\Report\Tag
* Class MonthReportGenerator.
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $end;
/** @var Collection */
private $expenses;
/** @var Collection */
private $income;
/** @var Carbon */
/** @var Carbon */
private $start;
/** @var Collection */
private $tags;
@ -85,13 +80,20 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
$topExpenses = $this->getTopExpenses();
$topIncome = $this->getTopIncome();
// render!
return view(
'reports.tag.month', compact(
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome',
'topExpenses'
)
'reports.tag.month',
compact(
'accountIds',
'tagTags',
'reportType',
'accountSummary',
'tagSummary',
'averageExpenses',
'averageIncome',
'topIncome',
'topExpenses'
)
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
}

View File

@ -18,20 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
/**
* Class MultiYearReportGenerator
*
* @package FireflyIII\Generator\Report\Tag
* Class MultiYearReportGenerator.
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,21 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
/**
* Class YearReportGenerator
*
* @package FireflyIII\Generator\Report\Tag
* Class YearReportGenerator.
*/
class YearReportGenerator extends MonthReportGenerator
{
/**
* Doesn't do anything different.
*/
// Doesn't do anything different.
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
@ -31,20 +30,19 @@ use Session;
use Swift_TransportException;
/**
* Class AdminEventHandler
*
* @package FireflyIII\Handlers\Events
* Class AdminEventHandler.
*/
class AdminEventHandler
{
/**
* Sends a test message to an administrator.
*
* @param AdminRequestedTestMessage $event
*
* @return bool
*/
public function sendTestMessage(AdminRequestedTestMessage $event): bool
{
$email = $event->user->email;
$ipAddress = $event->ipAddress;
@ -64,4 +62,4 @@ class AdminEventHandler
// @codeCoverageIgnoreEnd
return true;
}
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
@ -37,17 +36,15 @@ use Log;
* @codeCoverageIgnore
*
* Class StoredJournalEventHandler
*
* @package FireflyIII\Handlers\Events
*/
class StoredJournalEventHandler
{
/** @var JRI */
/** @var JRI */
public $journalRepository;
/** @var PRI */
/** @var PRI */
public $repository;
/** @var RGRI */
/** @var RGRI */
public $ruleGroupRepository;
/**
@ -88,7 +85,7 @@ class StoredJournalEventHandler
}
// piggy exists?
if (is_null($piggyBank->id)) {
if (null === $piggyBank->id) {
Log::error(sprintf('There is no piggy bank with ID #%d', $piggyBankId));
return true;
@ -96,7 +93,7 @@ class StoredJournalEventHandler
// repetition exists?
$repetition = $this->repository->getRepetition($piggyBank, $journal->date);
if (is_null($repetition->id)) {
if (null === $repetition->id) {
Log::error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d')));
return true;
@ -104,7 +101,7 @@ class StoredJournalEventHandler
// get the amount
$amount = $this->repository->getExactAmount($piggyBank, $repetition, $journal);
if (bccomp($amount, '0') === 0) {
if (0 === bccomp($amount, '0')) {
Log::debug('Amount is zero, will not create event.');
return true;
@ -137,7 +134,6 @@ class StoredJournalEventHandler
$rules = $this->ruleGroupRepository->getActiveStoreRules($group);
/** @var Rule $rule */
foreach ($rules as $rule) {
$processor = Processor::make($rule);
$processor->handleTransactionJournal($journal);

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\UpdatedTransactionJournal;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleGroup;
@ -35,12 +33,10 @@ use FireflyIII\TransactionRules\Processor;
* @codeCoverageIgnore
*
* Class UpdatedJournalEventHandler
*
* @package FireflyIII\Handlers\Events
*/
class UpdatedJournalEventHandler
{
/** @var RuleGroupRepositoryInterface */
/** @var RuleGroupRepositoryInterface */
public $repository;
/**
@ -77,7 +73,6 @@ class UpdatedJournalEventHandler
if ($rule->stop_processing) {
break;
}
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
@ -37,17 +36,14 @@ use Preferences;
use Swift_TransportException;
/**
* Class UserEventHandler
* Class UserEventHandler.
*
* This class responds to any events that have anything to do with the User object.
*
* The method name reflects what is being done. This is in the present tense.
*
* @package FireflyIII\Handlers\Events
*/
class UserEventHandler
{
/**
* This method will bestow upon a user the "owner" role if he is the first user in the system.
*
@ -61,7 +57,7 @@ class UserEventHandler
$repository = app(UserRepositoryInterface::class);
// first user ever?
if ($repository->count() === 1) {
if (1 === $repository->count()) {
$repository->attachRole($event->user, 'owner');
}
@ -152,7 +148,6 @@ class UserEventHandler
*/
public function sendRegistrationMail(RegisteredUser $event)
{
$sendMail = env('SEND_REGISTRATION_MAIL', true);
if (!$sendMail) {
return true; // @codeCoverageIgnore

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Attachments;
@ -33,14 +32,11 @@ use Storage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Class AttachmentHelper
*
* @package FireflyIII\Helpers\Attachments
* Class AttachmentHelper.
*/
class AttachmentHelper implements AttachmentHelperInterface
{
/** @var Collection */
/** @var Collection */
public $attachments;
/** @var MessageBag */
public $errors;
@ -111,10 +107,12 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
public function saveAttachmentsForModel(Model $model, ?array $files): bool
{
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
if (is_array($files)) {
Log::debug('$files is an array.');
/** @var UploadedFile $entry */
foreach ($files as $entry) {
if (!is_null($entry)) {
if (null !== $entry) {
$this->processFile($entry, $model);
}
}
@ -152,7 +150,6 @@ class AttachmentHelper implements AttachmentHelperInterface
}
/**
*
* @param UploadedFile $file
* @param Model $model
*
@ -160,8 +157,9 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function processFile(UploadedFile $file, Model $model): Attachment
{
Log::debug('Now in processFile()');
$validation = $this->validateUpload($file, $model);
if ($validation === false) {
if (false === $validation) {
return new Attachment;
}
@ -204,8 +202,11 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function validMime(UploadedFile $file): bool
{
Log::debug('Now in validMime()');
$mime = e($file->getMimeType());
$name = e($file->getClientOriginalName());
Log::debug(sprintf('Name is %, and mime is %s', $name, $mime));
Log::debug('Valid mimes are', $this->allowedMimes);
if (!in_array($mime, $this->allowedMimes)) {
$msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
@ -248,6 +249,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function validateUpload(UploadedFile $file, Model $model): bool
{
Log::debug('Now in validateUpload()');
if (!$this->validMime($file)) {
return false;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Attachments;
@ -29,13 +28,10 @@ use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
/**
* Interface AttachmentHelperInterface
*
* @package FireflyIII\Helpers\Attachments
* Interface AttachmentHelperInterface.
*/
interface AttachmentHelperInterface
{
/**
* @param Attachment $attachment
*
@ -60,11 +56,9 @@ interface AttachmentHelperInterface
/**
* @param Model $model
*
* @param null|array $files
*
* @return bool
*/
public function saveAttachmentsForModel(Model $model, ?array $files): bool;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Chart;
@ -41,23 +40,19 @@ use Illuminate\Support\Collection;
use Steam;
/**
* Class MetaPieChart
*
* @package FireflyIII\Helpers\Chart
*
*
* Class MetaPieChart.
*/
class MetaPieChart implements MetaPieChartInterface
{
/** @var Collection */
/** @var Collection */
protected $accounts;
/** @var Collection */
/** @var Collection */
protected $budgets;
/** @var Collection */
/** @var Collection */
protected $categories;
/** @var bool */
protected $collectOtherObjects = false;
/** @var Carbon */
/** @var Carbon */
protected $end;
/** @var array */
protected $grouping
@ -75,13 +70,13 @@ class MetaPieChart implements MetaPieChartInterface
'category' => CategoryRepositoryInterface::class,
'tag' => TagRepositoryInterface::class,
];
/** @var Carbon */
/** @var Carbon */
protected $start;
/** @var Collection */
/** @var Collection */
protected $tags;
/** @var string */
/** @var string */
protected $total = '0';
/** @var User */
/** @var User */
protected $user;
public function __construct()
@ -108,7 +103,7 @@ class MetaPieChart implements MetaPieChartInterface
$key = strval(trans('firefly.everything_else'));
// also collect all other transactions
if ($this->collectOtherObjects && $direction === 'expense') {
if ($this->collectOtherObjects && 'expense' === $direction) {
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setUser($this->user);
@ -121,7 +116,7 @@ class MetaPieChart implements MetaPieChartInterface
$chartData[$key] = $sum;
}
if ($this->collectOtherObjects && $direction === 'income') {
if ($this->collectOtherObjects && 'income' === $direction) {
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setUser($this->user);
@ -133,7 +128,6 @@ class MetaPieChart implements MetaPieChartInterface
}
return $chartData;
}
/**
@ -259,7 +253,7 @@ class MetaPieChart implements MetaPieChartInterface
$collector = app(JournalCollectorInterface::class);
$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];
$collector->addFilter(NegativeAmountFilter::class);
if ($direction === 'expense') {
if ('expense' === $direction) {
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
$collector->addFilter(PositiveAmountFilter::class);
$collector->removeFilter(NegativeAmountFilter::class);
@ -272,7 +266,7 @@ class MetaPieChart implements MetaPieChartInterface
$collector->withOpposingAccount();
$collector->addFilter(OpposingAccountFilter::class);
if ($direction === 'income') {
if ('income' === $direction) {
$collector->removeFilter(TransferFilter::class);
}
@ -295,11 +289,10 @@ class MetaPieChart implements MetaPieChartInterface
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function groupByFields(Collection $set, array $fields): array
{
if (count($fields) === 0 && $this->tags->count() > 0) {
if (0 === count($fields) && $this->tags->count() > 0) {
// do a special group on tags:
return $this->groupByTag($set);
}
@ -342,7 +335,6 @@ class MetaPieChart implements MetaPieChartInterface
}
return $chartData;
}
/**

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Chart;
@ -28,9 +27,7 @@ use FireflyIII\User;
use Illuminate\Support\Collection;
/**
* Interface MetaPieChartInterface
*
* @package FireflyIII\Helpers\Chart
* Interface MetaPieChartInterface.
*/
interface MetaPieChartInterface
{
@ -97,5 +94,4 @@ interface MetaPieChartInterface
* @return MetaPieChartInterface
*/
public function setUser(User $user): MetaPieChartInterface;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -26,18 +25,14 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
*
* Class Balance
*
* @package FireflyIII\Helpers\Collection
* Class Balance.
*/
class Balance
{
/** @var BalanceHeader */
/** @var BalanceHeader */
protected $balanceHeader;
/** @var Collection */
/** @var Collection */
protected $balanceLines;
/**
@ -87,6 +82,4 @@ class Balance
{
$this->balanceLines = $balanceLines;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -26,16 +25,11 @@ namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
/**
*
* Class BalanceEntry
*
* @package FireflyIII\Helpers\Collection
* Class BalanceEntry.
*/
class BalanceEntry
{
/** @var AccountModel */
/** @var AccountModel */
protected $account;
/** @var string */
protected $left = '0';
@ -89,6 +83,4 @@ class BalanceEntry
{
$this->spent = $spent;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -27,15 +26,11 @@ use FireflyIII\Models\Account as AccountModel;
use Illuminate\Support\Collection;
/**
*
* Class BalanceHeader
*
* @package FireflyIII\Helpers\Collection
* Class BalanceHeader.
*/
class BalanceHeader
{
/** @var Collection */
/** @var Collection */
protected $accounts;
/**
@ -61,6 +56,4 @@ class BalanceHeader
{
return $this->accounts;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -29,24 +28,20 @@ use FireflyIII\Models\BudgetLimit;
use Illuminate\Support\Collection;
/**
*
* Class BalanceLine
*
* @package FireflyIII\Helpers\Collection
* Class BalanceLine.
*/
class BalanceLine
{
const ROLE_DEFAULTROLE = 1;
const ROLE_TAGROLE = 2;
const ROLE_DIFFROLE = 3;
/** @var Collection */
/** @var Collection */
protected $balanceEntries;
/** @var BudgetModel */
protected $budget;
/** @var BudgetLimit */
/** @var BudgetLimit */
protected $budgetLimit;
/** @var int */
protected $role = self::ROLE_DEFAULTROLE;
@ -57,7 +52,6 @@ class BalanceLine
public function __construct()
{
$this->balanceEntries = new Collection;
}
/**
@ -150,20 +144,21 @@ class BalanceLine
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @return string
*/
public function getTitle(): string
{
if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
if ($this->getBudget() instanceof BudgetModel && null !== $this->getBudget()->id) {
return $this->getBudget()->name;
}
if ($this->getRole() === self::ROLE_DEFAULTROLE) {
if (self::ROLE_DEFAULTROLE === $this->getRole()) {
return strval(trans('firefly.no_budget'));
}
if ($this->getRole() === self::ROLE_TAGROLE) {
if (self::ROLE_TAGROLE === $this->getRole()) {
return strval(trans('firefly.coveredWithTags'));
}
if ($this->getRole() === self::ROLE_DIFFROLE) {
if (self::ROLE_DIFFROLE === $this->getRole()) {
return strval(trans('firefly.leftUnbalanced'));
}
@ -174,7 +169,7 @@ class BalanceLine
* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine
* should have a "spent" value, which is the amount of money that has been spent
* on the given budget/repetition. If you subtract all those amounts from the budget/repetition's
* total amount, this is returned:
* total amount, this is returned:.
*
* @return string
*/

View File

@ -18,32 +18,27 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
use Carbon\Carbon;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Illuminate\Support\Collection;
use Log;
/**
* Class Bill
*
* @package FireflyIII\Helpers\Collection
* Class Bill.
*/
class Bill
{
/**
* @var Collection
*/
private $bills;
/** @var Carbon */
/** @var Carbon */
private $endDate;
/** @var Carbon */
/** @var Carbon */
private $startDate;
/**
@ -106,14 +101,13 @@ class Bill
{
$set = $this->bills->sortBy(
function (BillLine $bill) {
$active = intval($bill->getBill()->active) === 0 ? 1 : 0;
$active = 0 === intval($bill->getBill()->active) ? 1 : 0;
$name = $bill->getBill()->name;
return $active . $name;
}
);
return $set;
}
@ -132,5 +126,4 @@ class Bill
{
$this->startDate = $startDate;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -27,27 +26,23 @@ use Carbon\Carbon;
use FireflyIII\Models\Bill as BillModel;
/**
*
* Class BillLine
*
* @package FireflyIII\Helpers\Collection
* Class BillLine.
*/
class BillLine
{
/** @var string */
/** @var string */
protected $amount;
/** @var BillModel */
/** @var BillModel */
protected $bill;
/** @var bool */
/** @var bool */
protected $hit;
/** @var string */
/** @var string */
protected $max;
/** @var string */
/** @var string */
protected $min;
/** @var Carbon */
/** @var Carbon */
private $lastHitDate;
/** @var int */
/** @var int */
private $transactionJournalId;
/**
@ -159,7 +154,7 @@ class BillLine
*/
public function isActive(): bool
{
return intval($this->bill->active) === 1;
return 1 === intval($this->bill->active);
}
/**
@ -177,6 +172,4 @@ class BillLine
{
$this->hit = $hit;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collection;
@ -26,17 +25,12 @@ namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Category as CategoryModel;
use Illuminate\Support\Collection;
/**
*
* Class Category
*
* @package FireflyIII\Helpers\Collection
* Class Category.
*/
class Category
{
/** @var Collection */
/** @var Collection */
protected $categories;
/** @var string */
protected $total = '0';
@ -80,7 +74,6 @@ class Category
}
);
return $set;
}
@ -91,6 +84,4 @@ class Category
{
return $this->total;
}
}

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collector;
use Carbon\Carbon;
use DB;
use FireflyIII\Exceptions\FireflyException;
@ -52,17 +50,16 @@ use Steam;
*
* Class JournalCollector
*
* @package FireflyIII\Helpers\Collector
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class JournalCollector implements JournalCollectorInterface
{
/** @var array */
private $accountIds = [];
/** @var int */
/** @var int */
private $count = 0;
/** @var array */
private $fields
@ -73,12 +70,14 @@ class JournalCollector implements JournalCollectorInterface
'transaction_journals.encrypted',
'transaction_types.type as transaction_type_type',
'transaction_journals.bill_id',
'transaction_journals.updated_at',
'bills.name as bill_name',
'bills.name_encrypted as bill_name_encrypted',
'transactions.id as id',
'transactions.description as transaction_description',
'transactions.account_id',
'transactions.reconciled',
'transactions.identifier',
'transactions.transaction_journal_id',
'transactions.amount as transaction_amount',
@ -99,22 +98,21 @@ class JournalCollector implements JournalCollectorInterface
'accounts.encrypted as account_encrypted',
'accounts.iban as account_iban',
'account_types.type as account_type',
];
/** @var array */
private $filters = [InternalTransferFilter::class];
/** @var bool */
/** @var bool */
private $joinedBudget = false;
/** @var bool */
/** @var bool */
private $joinedCategory = false;
/** @var bool */
private $joinedOpposing = false;
/** @var bool */
private $joinedTag = false;
/** @var int */
/** @var int */
private $limit;
/** @var int */
/** @var int */
private $offset;
/** @var int */
private $page = 1;
@ -170,8 +168,8 @@ class JournalCollector implements JournalCollectorInterface
$q1->where(
function (EloquentBuilder $q2) use ($amount) {
// amount < 0 and .amount > -$amount
$amount = bcmul($amount,'-1');
$q2->where('transactions.amount', '<', 0)->where('transactions.amount', '>', $amount);
$invertedAmount = bcmul($amount, '-1');
$q2->where('transactions.amount', '<', 0)->where('transactions.amount', '>', $invertedAmount);
}
)
->orWhere(
@ -198,8 +196,8 @@ class JournalCollector implements JournalCollectorInterface
$q1->where(
function (EloquentBuilder $q2) use ($amount) {
// amount < 0 and .amount < -$amount
$amount = bcmul($amount,'-1');
$q2->where('transactions.amount', '<', 0)->where('transactions.amount', '<', $amount);
$invertedAmount = bcmul($amount, '-1');
$q2->where('transactions.amount', '<', 0)->where('transactions.amount', '<', $invertedAmount);
}
)
->orWhere(
@ -210,16 +208,18 @@ class JournalCollector implements JournalCollectorInterface
);
}
);
return $this;
}
/**
* @return int
*
* @throws FireflyException
*/
public function count(): int
{
if ($this->run === true) {
if (true === $this->run) {
throw new FireflyException('Cannot count after run in JournalCollector.');
}
@ -255,14 +255,12 @@ class JournalCollector implements JournalCollectorInterface
$transaction->date = new Carbon($transaction->date);
$transaction->description = Steam::decrypt(intval($transaction->encrypted), $transaction->description);
if (!is_null($transaction->bill_name)) {
if (null !== $transaction->bill_name) {
$transaction->bill_name = Steam::decrypt(intval($transaction->bill_name_encrypted), $transaction->bill_name);
}
$transaction->opposing_account_name = app('steam')->tryDecrypt($transaction->opposing_account_name);
$transaction->account_iban = app('steam')->tryDecrypt($transaction->account_iban);
$transaction->opposing_account_iban = app('steam')->tryDecrypt($transaction->opposing_account_iban);
}
);
@ -271,11 +269,12 @@ class JournalCollector implements JournalCollectorInterface
/**
* @return LengthAwarePaginator
*
* @throws FireflyException
*/
public function getPaginatedJournals(): LengthAwarePaginator
{
if ($this->run === true) {
if (true === $this->run) {
throw new FireflyException('Cannot getPaginatedJournals after run in JournalCollector.');
}
$this->count();
@ -293,7 +292,7 @@ class JournalCollector implements JournalCollectorInterface
public function removeFilter(string $filter): JournalCollectorInterface
{
$key = array_search($filter, $this->filters, true);
if (!($key === false)) {
if (!(false === $key)) {
Log::debug(sprintf('Removed filter %s', $filter));
unset($this->filters[$key]);
}
@ -319,7 +318,6 @@ class JournalCollector implements JournalCollectorInterface
$this->addFilter(TransferFilter::class);
}
return $this;
}
@ -386,7 +384,6 @@ class JournalCollector implements JournalCollectorInterface
}
return $this;
}
/**
@ -416,7 +413,7 @@ class JournalCollector implements JournalCollectorInterface
public function setBudgets(Collection $budgets): JournalCollectorInterface
{
$budgetIds = $budgets->pluck('id')->toArray();
if (count($budgetIds) === 0) {
if (0 === count($budgetIds)) {
return $this;
}
$this->joinBudgetTables();
@ -440,7 +437,7 @@ class JournalCollector implements JournalCollectorInterface
public function setCategories(Collection $categories): JournalCollectorInterface
{
$categoryIds = $categories->pluck('id')->toArray();
if (count($categoryIds) === 0) {
if (0 === count($categoryIds)) {
return $this;
}
$this->joinCategoryTables();
@ -514,11 +511,11 @@ class JournalCollector implements JournalCollectorInterface
$this->page = $page;
if ($page > 0) {
$page--;
--$page;
}
Log::debug(sprintf('Page is %d', $page));
if (!is_null($this->limit)) {
if (null !== $this->limit) {
$offset = ($this->limit * $page);
$this->offset = $offset;
$this->query->skip($offset);
@ -626,7 +623,6 @@ class JournalCollector implements JournalCollectorInterface
->orderBy('transactions.amount', 'DESC');
$this->query = $query;
}
/**
@ -644,7 +640,6 @@ class JournalCollector implements JournalCollectorInterface
*/
public function withCategoryInformation(): JournalCollectorInterface
{
$this->joinCategoryTables();
return $this;
@ -756,7 +751,10 @@ class JournalCollector implements JournalCollectorInterface
$this->joinedCategory = true;
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
$this->query->leftJoin(
'categories as transaction_journal_categories', 'transaction_journal_categories.id', '=', 'category_transaction_journal.category_id'
'categories as transaction_journal_categories',
'transaction_journal_categories.id',
'=',
'category_transaction_journal.category_id'
);
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
@ -781,11 +779,12 @@ class JournalCollector implements JournalCollectorInterface
Log::debug('joinedOpposing is false');
// join opposing transaction (hard):
$this->query->leftJoin(
'transactions as opposing', function (JoinClause $join) {
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
->where('opposing.identifier', '=', DB::raw('transactions.identifier'))
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'));
}
'transactions as opposing',
function (JoinClause $join) {
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
->where('opposing.identifier', '=', DB::raw('transactions.identifier'))
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'));
}
);
$this->query->leftJoin('accounts as opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id');
$this->query->leftJoin('account_types as opposing_account_types', 'opposing_accounts.account_type_id', '=', 'opposing_account_types.id');

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Collector;
@ -32,9 +31,7 @@ use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
* Interface JournalCollectorInterface
*
* @package FireflyIII\Helpers\Collector
* Interface JournalCollectorInterface.
*/
interface JournalCollectorInterface
{
@ -50,7 +47,7 @@ interface JournalCollectorInterface
*
* @return JournalCollectorInterface
*/
public function amountMore(string $amount): JournalCollectorInterface;
public function amountIs(string $amount): JournalCollectorInterface;
/**
* @param string $amount
@ -64,7 +61,7 @@ interface JournalCollectorInterface
*
* @return JournalCollectorInterface
*/
public function amountIs(string $amount): JournalCollectorInterface;
public function amountMore(string $amount): JournalCollectorInterface;
/**
* @return int

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -28,12 +27,10 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class AmountFilter
* Class AmountFilter.
*
* This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount
* ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal.
*
* @package FireflyIII\Helpers\Filter
*/
class AmountFilter implements FilterInterface
{

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -26,14 +25,10 @@ namespace FireflyIII\Helpers\Filter;
use Illuminate\Support\Collection;
/**
* Class EmptyFilter
*
* @package FireflyIII\Helpers\Filter
* Class EmptyFilter.
*/
class EmptyFilter implements FilterInterface
{
/**
* @param Collection $set
*

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
use Illuminate\Support\Collection;
interface FilterInterface
@ -34,5 +32,4 @@ interface FilterInterface
* @return Collection
*/
public function filter(Collection $set): Collection;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -28,13 +27,11 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class InternalTransferFilter
* Class InternalTransferFilter.
*
* This filter removes any filters that are from A to B or from B to A given a set of
* account id's (in $parameters) where A and B are mentioned. So transfers between the mentioned
* accounts will be removed.
*
* @package FireflyIII\Helpers\Filter
*/
class InternalTransferFilter implements FilterInterface
{
@ -60,7 +57,7 @@ class InternalTransferFilter implements FilterInterface
{
return $set->filter(
function (Transaction $transaction) {
if (is_null($transaction->opposing_account_id)) {
if (null === $transaction->opposing_account_id) {
return $transaction;
}
// both id's in $parameters?
@ -68,18 +65,18 @@ class InternalTransferFilter implements FilterInterface
Log::debug(
sprintf(
'Transaction #%d has #%d and #%d in set, so removed',
$transaction->id, $transaction->account_id, $transaction->opposing_account_id
), $this->accounts
$transaction->id,
$transaction->account_id,
$transaction->opposing_account_id
),
$this->accounts
);
return false;
}
return $transaction;
}
);
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -28,11 +27,9 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class NegativeAmountFilter
* Class NegativeAmountFilter.
*
* This filter removes entries with a negative amount (the original modifier is -1).
*
* @package FireflyIII\Helpers\Filter
*/
class NegativeAmountFilter implements FilterInterface
{

View File

@ -18,23 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
use Log;
/**
* Class OpposingAccountFilter
* Class OpposingAccountFilter.
*
* This filter is similar to the internal transfer filter but only removes transactions when the opposing account is
* amongst $parameters (list of account ID's).
*
* @package FireflyIII\Helpers\Filter
*/
class OpposingAccountFilter implements FilterInterface
{

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -28,14 +27,12 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class PositiveAmountFilter
* Class PositiveAmountFilter.
*
* This filter removes entries with a negative amount (the original modifier is -1).
*
* This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount
* ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal.
*
* @package FireflyIII\Helpers\Filter
*/
class PositiveAmountFilter implements FilterInterface
{
@ -49,7 +46,7 @@ class PositiveAmountFilter implements FilterInterface
return $set->filter(
function (Transaction $transaction) {
// remove by amount
if (bccomp($transaction->transaction_amount, '0') === 1) {
if (1 === bccomp($transaction->transaction_amount, '0')) {
Log::debug(sprintf('Filtered #%d because amount is %f.', $transaction->id, $transaction->transaction_amount));
return null;

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Filter;
@ -29,11 +28,9 @@ use Illuminate\Support\Collection;
use Steam;
/**
* Class TransferFilter
* Class TransferFilter.
*
* This filter removes any transfers that are in the collection twice (from A to B and from B to A).
*
* @package FireflyIII\Helpers\Filter
*/
class TransferFilter implements FilterInterface
{
@ -48,7 +45,7 @@ class TransferFilter implements FilterInterface
$new = new Collection;
/** @var Transaction $transaction */
foreach ($set as $transaction) {
if ($transaction->transaction_type_type !== TransactionType::TRANSFER) {
if (TransactionType::TRANSFER !== $transaction->transaction_type_type) {
$new->push($transaction);
continue;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers;
@ -27,20 +26,15 @@ use Carbon\Carbon;
use Preferences;
/**
* Class FiscalHelper
*
* @package FireflyIII\Helpers
* Class FiscalHelper.
*/
class FiscalHelper implements FiscalHelperInterface
{
/** @var bool */
protected $useCustomFiscalYear;
/**
* FiscalHelper constructor.
*
*
*/
public function __construct()
{
@ -56,7 +50,7 @@ class FiscalHelper implements FiscalHelperInterface
{
// get start of fiscal year for passed date
$endDate = $this->startOfFiscalYear($date);
if ($this->useCustomFiscalYear === true) {
if (true === $this->useCustomFiscalYear) {
// add 1 year and sub 1 day
$endDate->addYear();
$endDate->subDay();
@ -65,7 +59,6 @@ class FiscalHelper implements FiscalHelperInterface
}
$endDate->endOfYear();
return $endDate;
}
@ -78,7 +71,7 @@ class FiscalHelper implements FiscalHelperInterface
{
// get start mm-dd. Then create a start date in the year passed.
$startDate = clone $date;
if ($this->useCustomFiscalYear === true) {
if (true === $this->useCustomFiscalYear) {
$prefStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
list($mth, $day) = explode('-', $prefStartStr);
$startDate->month(intval($mth))->day(intval($day));

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers;
@ -26,13 +25,10 @@ namespace FireflyIII\Helpers;
use Carbon\Carbon;
/**
* Interface FiscalHelperInterface
*
* @package FireflyIII\Helpers
* Interface FiscalHelperInterface.
*/
interface FiscalHelperInterface
{
/**
* This method produces a clone of the Carbon date object passed, checks preferences
* and calculates the last day of the fiscal year.
@ -52,5 +48,4 @@ interface FiscalHelperInterface
* @return Carbon date object
*/
public function startOfFiscalYear(Carbon $date): Carbon;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Help;
@ -31,9 +30,7 @@ use Requests_Exception;
use Route;
/**
* Class Help
*
* @package FireflyIII\Helpers\Help
* Class Help.
*/
class Help implements HelpInterface
{
@ -62,7 +59,6 @@ class Help implements HelpInterface
*/
public function getFromGithub(string $route, string $language): string
{
$uri = sprintf('https://raw.githubusercontent.com/firefly-iii/help/master/%s/%s.md', $language, $route);
Log::debug(sprintf('Trying to get %s...', $uri));
$opt = ['useragent' => $this->userAgent];
@ -77,7 +73,7 @@ class Help implements HelpInterface
Log::debug(sprintf('Status code is %d', $result->status_code));
if ($result->status_code === 200) {
if (200 === $result->status_code) {
$content = trim($result->body);
}
@ -91,7 +87,6 @@ class Help implements HelpInterface
}
/**
*
* @param string $route
*
* @return bool
@ -119,15 +114,12 @@ class Help implements HelpInterface
}
return $result;
}
/**
*
* @param string $route
* @param string $language
* @param string $content
*
*/
public function putInCache(string $route, string $language, string $content)
{

View File

@ -18,19 +18,15 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Help;
/**
* Interface HelpInterface
*
* @package FireflyIII\Helpers\Help
* Interface HelpInterface.
*/
interface HelpInterface
{
/**
* @param string $route
* @param string $language

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
@ -34,15 +33,13 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class BalanceReportHelper
* Class BalanceReportHelper.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) // I can't really help it.
* @package FireflyIII\Helpers\Report
*/
class BalanceReportHelper implements BalanceReportHelperInterface
{
/** @var BudgetRepositoryInterface */
/** @var BudgetRepositoryInterface */
protected $budgetRepository;
/**
@ -56,7 +53,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
$this->budgetRepository = $budgetRepository;
}
/**
* @param Collection $accounts
* @param Carbon $start
@ -77,7 +73,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
/** @var BudgetLimit $budgetLimit */
foreach ($budgetLimits as $budgetLimit) {
if (!is_null($budgetLimit->budget)) {
if (null !== $budgetLimit->budget) {
$line = $this->createBalanceLine($budgetLimit, $accounts);
$balance->addBalanceLine($line);
}
@ -96,7 +92,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
return $balance;
}
/**
* @param BudgetLimit $budgetLimit
* @param Collection $accounts
@ -114,7 +109,10 @@ class BalanceReportHelper implements BalanceReportHelperInterface
$balanceEntry = new BalanceEntry;
$balanceEntry->setAccount($account);
$spent = $this->budgetRepository->spentInPeriod(
new Collection([$budgetLimit->budget]), new Collection([$account]), $budgetLimit->start_date, $budgetLimit->end_date
new Collection([$budgetLimit->budget]),
new Collection([$account]),
$budgetLimit->start_date,
$budgetLimit->end_date
);
$balanceEntry->setSpent($spent);
$line->addBalanceEntry($balanceEntry);
@ -123,7 +121,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
return $line;
}
/**
* @param Collection $accounts
* @param Carbon $start
@ -142,13 +139,11 @@ class BalanceReportHelper implements BalanceReportHelperInterface
$budgetEntry->setAccount($account);
$budgetEntry->setSpent($spent);
$empty->addBalanceEntry($budgetEntry);
}
return $empty;
}
/**
* @param Balance $balance
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
@ -160,7 +155,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
$set = $balance->getBalanceLines();
$newSet = new Collection;
foreach ($set as $entry) {
if (!is_null($entry->getBudget()->id)) {
if (null !== $entry->getBudget()->id) {
$sum = '0';
foreach ($entry->getBalanceEntries() as $balanceEntry) {
$sum = bcadd($sum, $balanceEntry->getSpent());
@ -176,7 +171,5 @@ class BalanceReportHelper implements BalanceReportHelperInterface
$balance->setBalanceLines($newSet);
return $balance;
}
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
@ -27,11 +26,8 @@ use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Balance;
use Illuminate\Support\Collection;
/**
* Interface BalanceReportHelperInterface
*
* @package FireflyIII\Helpers\Report
* Interface BalanceReportHelperInterface.
*/
interface BalanceReportHelperInterface
{

View File

@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
@ -31,9 +29,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection;
/**
* Class BudgetReportHelper
*
* @package FireflyIII\Helpers\Report
* Class BudgetReportHelper.
*/
class BudgetReportHelper implements BudgetReportHelperInterface
{
@ -53,6 +49,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // all the arrays make it long.
*
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
@ -67,9 +64,8 @@ class BudgetReportHelper implements BudgetReportHelperInterface
/** @var Budget $budget */
foreach ($set as $budget) {
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range
if (0 === $budgetLimits->count()) { // no budget limit(s) for this budget
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end); // spent for budget in time range
if (bccomp($spent, '0') === -1) {
$line = [
'type' => 'budget',
@ -157,12 +153,11 @@ class BudgetReportHelper implements BudgetReportHelperInterface
{
$array = [];
$expenses = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $budgetLimit->start_date, $budgetLimit->end_date);
$array['left'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? bcadd($budgetLimit->amount, $expenses) : '0';
$array['spent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? $expenses : '0';
$array['overspent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? '0' : bcadd($expenses, $budgetLimit->amount);
$array['left'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? bcadd($budgetLimit->amount, $expenses) : '0';
$array['spent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? $expenses : '0';
$array['overspent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? '0' : bcadd($expenses, $budgetLimit->amount);
$array['expenses'] = $expenses;
return $array;
}
}

View File

@ -18,23 +18,18 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use Illuminate\Support\Collection;
/**
* Interface BudgetReportHelperInterface
*
* @package FireflyIII\Helpers\Report
* Interface BudgetReportHelperInterface.
*/
interface BudgetReportHelperInterface
{
/**
* @param Carbon $start
* @param Carbon $end
@ -52,5 +47,4 @@ interface BudgetReportHelperInterface
* @return Collection
*/
public function getBudgetsWithExpenses(Carbon $start, Carbon $end, Collection $accounts): Collection;
}

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
@ -32,14 +31,10 @@ use FireflyIII\Models\TransactionType;
use Illuminate\Support\Collection;
/**
* Class PopupReport
*
* @package FireflyIII\Helpers\Report
* Class PopupReport.
*/
class PopupReport implements PopupReportInterface
{
/**
* @param $account
* @param $attributes
@ -58,11 +53,10 @@ class PopupReport implements PopupReportInterface
->withoutBudget();
$journals = $collector->getJournals();
return $journals->filter(
function (Transaction $transaction) {
$tags = $transaction->transactionJournal->tags()->where('tagMode', 'balancingAct')->count();
if ($tags === 0) {
if (0 === $tags) {
return true;
}
@ -120,10 +114,10 @@ class PopupReport implements PopupReportInterface
$collector->setAccounts($attributes['accounts'])->setRange($attributes['startDate'], $attributes['endDate']);
if (is_null($budget->id)) {
if (null === $budget->id) {
$collector->setTypes([TransactionType::WITHDRAWAL])->withoutBudget();
}
if (!is_null($budget->id)) {
if (null !== $budget->id) {
$collector->setBudget($budget);
}
$journals = $collector->getJournals();

View File

@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Helpers\Report;
@ -29,13 +28,10 @@ use FireflyIII\Models\Category;
use Illuminate\Support\Collection;
/**
* Interface PopupReportInterface
*
* @package FireflyIII\Helpers\Report
* Interface PopupReportInterface.
*/
interface PopupReportInterface
{
/**
* @param $account
* @param $attributes

Some files were not shown because too many files have changed in this diff Show More