Code clean up.

This commit is contained in:
James Cole
2017-11-15 12:25:49 +01:00
parent 57dcdfa0c4
commit ffca858b8d
476 changed files with 2055 additions and 4181 deletions

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\Jobs;
@@ -34,9 +33,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
/**
* Class ExecuteRuleGroupOnExistingTransactions
*
* @package FireflyIII\Jobs
* Class ExecuteRuleGroupOnExistingTransactions.
*/
class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
{
@@ -44,13 +41,13 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $endDate;
/** @var RuleGroup */
private $ruleGroup;
/** @var Carbon */
/** @var Carbon */
private $startDate;
/** @var User */
/** @var User */
private $user;
/**
@@ -72,7 +69,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Collection $accounts
*/
public function setAccounts(Collection $accounts)
@@ -89,7 +85,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Carbon $date
*/
public function setEndDate(Carbon $date)
@@ -106,7 +101,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Carbon $date
*/
public function setStartDate(Carbon $date)
@@ -123,7 +117,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param User $user
*/
public function setUser(User $user)
@@ -133,8 +126,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
@@ -159,7 +150,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
* Collect all journals that should be processed
* Collect all journals that should be processed.
*
* @return Collection
*/
@@ -174,7 +165,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
}
/**
* Collects a list of rule processors, one for each rule within the rule group
* Collects a list of rule processors, one for each rule within the rule group.
*
* @return array
*/

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\Jobs;
@@ -35,9 +34,7 @@ use Illuminate\Support\Collection;
use Log;
/**
* Class ExecuteRuleOnExistingTransactions
*
* @package FireflyIII\Jobs
* Class ExecuteRuleOnExistingTransactions.
*/
class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
{
@@ -45,13 +42,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
/** @var Collection */
private $accounts;
/** @var Carbon */
/** @var Carbon */
private $endDate;
/** @var Rule */
private $rule;
/** @var Carbon */
/** @var Carbon */
private $startDate;
/** @var User */
/** @var User */
private $user;
/**
@@ -73,7 +70,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Collection $accounts
*/
public function setAccounts(Collection $accounts)
@@ -90,7 +86,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Carbon $date
*/
public function setEndDate(Carbon $date)
@@ -107,7 +102,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param Carbon $date
*/
public function setStartDate(Carbon $date)
@@ -124,7 +118,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
}
/**
*
* @param User $user
*/
public function setUser(User $user)
@@ -134,8 +127,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
@@ -147,13 +138,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
$total = 0;
// Execute the rules for each transaction
foreach ($transactions as $transaction) {
$total++;
++$total;
$result = $processor->handleTransaction($transaction);
if ($result) {
$hits++;
++$hits;
}
if (!$result) {
$misses++;
++$misses;
}
Log::info(sprintf('Current progress: %d Transactions. Hits: %d, misses: %d', $total, $hits, $misses));
// Stop processing this group if the rule specifies 'stop_processing'
@@ -165,7 +156,7 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
}
/**
* Collect all journals that should be processed
* Collect all journals that should be processed.
*
* @return 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\Jobs;
@@ -26,9 +25,7 @@ namespace FireflyIII\Jobs;
use Illuminate\Bus\Queueable;
/**
* Class Job
*
* @package FireflyIII\Jobs
* Class Job.
*/
abstract class 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\Jobs;
@@ -33,21 +32,19 @@ use Mail;
use Swift_TransportException;
/**
* Class MailError
*
* @package FireflyIII\Jobs
* Class MailError.
*/
class MailError extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
/** @var string */
/** @var string */
protected $destination;
/** @var array */
/** @var array */
protected $exception;
/** @var string */
/** @var string */
protected $ipAddress;
/** @var array */
/** @var array */
protected $userData;
/**
@@ -57,7 +54,6 @@ class MailError extends Job implements ShouldQueue
* @param string $destination
* @param string $ipAddress
* @param array $exceptionData
*
*/
public function __construct(array $userData, string $destination, string $ipAddress, array $exceptionData)
{
@@ -72,8 +68,6 @@ class MailError extends Job implements ShouldQueue
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
@@ -90,7 +84,7 @@ class MailError extends Job implements ShouldQueue
['emails.error-html', 'emails.error-text'],
$args,
function (Message $message) use ($email) {
if ($email !== 'mail@example.com') {
if ('mail@example.com' !== $email) {
$message->to($email, $email)->subject('Caught an error in Firely III');
}
}