Remove unnecessary backslash

This commit is contained in:
James Cole
2019-06-07 17:58:11 +02:00
parent e4a9abc315
commit fba3cb6d90
20 changed files with 32 additions and 32 deletions

View File

@@ -172,7 +172,7 @@ class AttachmentHelper implements AttachmentHelperInterface
// update attachment. // update attachment.
$attachment->md5 = md5_file($path); $attachment->md5 = md5_file($path);
$attachment->mime = $mime; $attachment->mime = $mime;
$attachment->size = \strlen($content); $attachment->size = strlen($content);
$attachment->uploaded = true; $attachment->uploaded = true;
$attachment->save(); $attachment->save();
@@ -274,8 +274,8 @@ class AttachmentHelper implements AttachmentHelperInterface
$content = $fileObject->fread($file->getSize()); $content = $fileObject->fread($file->getSize());
$encrypted = Crypt::encrypt($content); $encrypted = Crypt::encrypt($content);
Log::debug(sprintf('Full file length is %d and upload size is %d.', \strlen($content), $file->getSize())); Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
Log::debug(sprintf('Encrypted content is %d', \strlen($encrypted))); Log::debug(sprintf('Encrypted content is %d', strlen($encrypted)));
// store it: // store it:
$this->uploadDisk->put($attachment->fileName(), $encrypted); $this->uploadDisk->put($attachment->fileName(), $encrypted);

View File

@@ -121,7 +121,7 @@ class AttachmentController extends Controller
->header('Expires', '0') ->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public') ->header('Pragma', 'public')
->header('Content-Length', \strlen($content)); ->header('Content-Length', strlen($content));
return $response; return $response;
} }

View File

@@ -90,7 +90,7 @@ class ExportController extends Controller
->header('Expires', '0') ->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public') ->header('Pragma', 'public')
->header('Content-Length', \strlen($content)); ->header('Content-Length', strlen($content));
return $response; return $response;
} }

View File

@@ -173,7 +173,7 @@ class IndexController extends Controller
->header('Expires', '0') ->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public') ->header('Pragma', 'public')
->header('Content-Length', \strlen($result)); ->header('Content-Length', strlen($result));
return $response; return $response;
} }

View File

@@ -241,7 +241,7 @@ class Request extends FormRequest
return null; return null;
} }
$value = (string)$this->get($field); $value = (string)$this->get($field);
if (10 === \strlen($value)) { if (10 === strlen($value)) {
// probably a date format. // probably a date format.
try { try {
$result = Carbon::createFromFormat('Y-m-d', $value); $result = Carbon::createFromFormat('Y-m-d', $value);

View File

@@ -110,7 +110,7 @@ class Amount implements ConverterInterface
*/ */
private function alternativeDecimalSign(string $value): bool private function alternativeDecimalSign(string $value): bool
{ {
$length = \strlen($value); $length = strlen($value);
$altPosition = $length - 2; $altPosition = $length - 2;
return $length > 1 && ('.' === $value[$altPosition] || ',' === $value[$altPosition]); return $length > 1 && ('.' === $value[$altPosition] || ',' === $value[$altPosition]);
@@ -125,7 +125,7 @@ class Amount implements ConverterInterface
*/ */
private function decimalIsComma(string $value): bool private function decimalIsComma(string $value): bool
{ {
$length = \strlen($value); $length = strlen($value);
$decimalPosition = $length - 3; $decimalPosition = $length - 3;
return $length > 2 && ',' === $value[$decimalPosition]; return $length > 2 && ',' === $value[$decimalPosition];
@@ -140,7 +140,7 @@ class Amount implements ConverterInterface
*/ */
private function decimalIsDot(string $value): bool private function decimalIsDot(string $value): bool
{ {
$length = \strlen($value); $length = strlen($value);
$decimalPosition = $length - 3; $decimalPosition = $length - 3;
return ($length > 2 && '.' === $value[$decimalPosition]) || ($length > 2 && strpos($value, '.') > $decimalPosition); return ($length > 2 && '.' === $value[$decimalPosition]) || ($length > 2 && strpos($value, '.') > $decimalPosition);
@@ -177,7 +177,7 @@ class Amount implements ConverterInterface
*/ */
private function getAlternativeDecimalSign(string $value): string private function getAlternativeDecimalSign(string $value): string
{ {
$length = \strlen($value); $length = strlen($value);
$altPosition = $length - 2; $altPosition = $length - 2;
return $value[$altPosition]; return $value[$altPosition];
@@ -222,7 +222,7 @@ class Amount implements ConverterInterface
// have to strip the € because apparantly the Postbank (DE) thinks "1.000,00 €" is a normal way to format a number. // have to strip the € because apparantly the Postbank (DE) thinks "1.000,00 €" is a normal way to format a number.
$value = trim((string)str_replace(['€'], '', $value)); $value = trim((string)str_replace(['€'], '', $value));
$str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value); $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value);
$len = \strlen($str); $len = strlen($str);
if ('(' === $str[0] && ')' === $str[$len - 1]) { if ('(' === $str[0] && ')' === $str[$len - 1]) {
$str = '-' . substr($str, 1, $len - 2); $str = '-' . substr($str, 1, $len - 2);
} }

View File

@@ -97,7 +97,7 @@ class FakePrerequisites implements PrerequisitesInterface
{ {
$apiKey = $data['api_key'] ?? ''; $apiKey = $data['api_key'] ?? '';
$messageBag = new MessageBag(); $messageBag = new MessageBag();
if (32 !== \strlen($apiKey)) { if (32 !== strlen($apiKey)) {
$messageBag->add('api_key', 'API key must be 32 chars.'); $messageBag->add('api_key', 'API key must be 32 chars.');
return $messageBag; return $messageBag;
@@ -122,7 +122,7 @@ class FakePrerequisites implements PrerequisitesInterface
if (null === $apiKey->data) { if (null === $apiKey->data) {
return false; return false;
} }
if (32 === \strlen((string)$apiKey->data)) { if (32 === strlen((string)$apiKey->data)) {
return true; return true;
} }

View File

@@ -386,7 +386,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
$attachment->md5 = md5($content); $attachment->md5 = md5($content);
$attachment->filename = $name; $attachment->filename = $name;
$attachment->mime = 'plain/txt'; $attachment->mime = 'plain/txt';
$attachment->size = \strlen($content); $attachment->size = strlen($content);
$attachment->uploaded = false; $attachment->uploaded = false;
$attachment->save(); $attachment->save();
$encrypted = Crypt::encrypt($content); $encrypted = Crypt::encrypt($content);

View File

@@ -325,7 +325,7 @@ class RuleRepository implements RuleRepositoryInterface
$rule->strict = $data['strict']; $rule->strict = $data['strict'];
$rule->stop_processing = $data['stop_processing']; $rule->stop_processing = $data['stop_processing'];
$rule->title = $data['title']; $rule->title = $data['title'];
$rule->description = \strlen($data['description']) > 0 ? $data['description'] : null; $rule->description = strlen($data['description']) > 0 ? $data['description'] : null;
$rule->save(); $rule->save();

View File

@@ -56,7 +56,7 @@ class IsDateOrTime implements Rule
public function passes($attribute, $value): bool public function passes($attribute, $value): bool
{ {
$value = (string)$value; $value = (string)$value;
if (10 === \strlen($value)) { if (10 === strlen($value)) {
// probably a date format. // probably a date format.
try { try {
Carbon::createFromFormat('Y-m-d', $value); Carbon::createFromFormat('Y-m-d', $value);

View File

@@ -289,7 +289,7 @@ class Amount
$currencyCode = $this->tryDecrypt((string)$currencyPreference->data); $currencyCode = $this->tryDecrypt((string)$currencyPreference->data);
// could still be json encoded: // could still be json encoded:
if (\strlen($currencyCode) > 3) { if (strlen($currencyCode) > 3) {
$currencyCode = json_decode($currencyCode) ?? 'EUR'; $currencyCode = json_decode($currencyCode) ?? 'EUR';
} }

View File

@@ -72,9 +72,9 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface
public function triggered(TransactionJournal $journal): bool public function triggered(TransactionJournal $journal): bool
{ {
$description = strtolower($journal->description ?? ''); $description = strtolower($journal->description ?? '');
$descriptionLength = \strlen($description); $descriptionLength = strlen($description);
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$searchLength = \strlen($search); $searchLength = strlen($search);
// if the string to search for is longer than the description, // if the string to search for is longer than the description,
// return false. // return false.

View File

@@ -74,7 +74,7 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac
$description = strtolower($journal->description ?? ''); $description = strtolower($journal->description ?? '');
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$part = substr($description, 0, \strlen($search)); $part = substr($description, 0, strlen($search));
if ($part === $search) { if ($part === $search) {
Log::debug(sprintf('RuleTrigger DescriptionStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $description, $search)); Log::debug(sprintf('RuleTrigger DescriptionStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $description, $search));

View File

@@ -82,9 +82,9 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface
$name .= strtolower($account->name); $name .= strtolower($account->name);
} }
$nameLength = \strlen($name); $nameLength = strlen($name);
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$searchLength = \strlen($search); $searchLength = strlen($search);
// if the string to search for is longer than the account name, // if the string to search for is longer than the account name,
// it will never be in the account name. // it will never be in the account name.

View File

@@ -83,7 +83,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
} }
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$part = substr($name, 0, \strlen($search)); $part = substr($name, 0, strlen($search));
if ($part === $search) { if ($part === $search) {
Log::debug(sprintf('RuleTrigger FromAccountStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $name, $search)); Log::debug(sprintf('RuleTrigger FromAccountStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $name, $search));

View File

@@ -78,9 +78,9 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface
if (null !== $note) { if (null !== $note) {
$text = strtolower($note->text); $text = strtolower($note->text);
} }
$notesLength = \strlen($text); $notesLength = strlen($text);
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$searchLength = \strlen($search); $searchLength = strlen($search);
// if the string to search for is longer than the description, // if the string to search for is longer than the description,
// return false // return false

View File

@@ -80,7 +80,7 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface
} }
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$part = substr($text, 0, \strlen($search)); $part = substr($text, 0, strlen($search));
if ($part === $search) { if ($part === $search) {
Log::debug(sprintf('RuleTrigger NotesStart for journal #%d: "%s" starts with "%s", return true.', $journal->id, $text, $search)); Log::debug(sprintf('RuleTrigger NotesStart for journal #%d: "%s" starts with "%s", return true.', $journal->id, $text, $search));

View File

@@ -82,9 +82,9 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface
$toAccountName .= strtolower($account->name); $toAccountName .= strtolower($account->name);
} }
$toAccountNameLength = \strlen($toAccountName); $toAccountNameLength = strlen($toAccountName);
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$searchLength = \strlen($search); $searchLength = strlen($search);
// if the string to search for is longer than the account name, // if the string to search for is longer than the account name,
// return false // return false

View File

@@ -83,7 +83,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface
} }
$search = strtolower($this->triggerValue); $search = strtolower($this->triggerValue);
$part = substr($toAccountName, 0, \strlen($search)); $part = substr($toAccountName, 0, strlen($search));
if ($part === $search) { if ($part === $search) {
Log::debug(sprintf('RuleTrigger ToAccountStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $toAccountName, $search)); Log::debug(sprintf('RuleTrigger ToAccountStarts for journal #%d: "%s" starts with "%s", return true.', $journal->id, $toAccountName, $search));

View File

@@ -55,7 +55,7 @@ class FireflyValidator extends Validator
*/ */
public function validate2faCode($attribute, $value): bool public function validate2faCode($attribute, $value): bool
{ {
if (!\is_string($value) || null === $value || 6 !== \strlen($value)) { if (!\is_string($value) || null === $value || 6 !== strlen($value)) {
return false; return false;
} }
@@ -117,7 +117,7 @@ class FireflyValidator extends Validator
*/ */
public function validateIban($attribute, $value): bool public function validateIban($attribute, $value): bool
{ {
if (!\is_string($value) || null === $value || \strlen($value) < 6) { if (!\is_string($value) || null === $value || strlen($value) < 6) {
return false; return false;
} }
// strip spaces // strip spaces