Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -327,7 +327,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && $notes === $value;
}
@@ -351,7 +351,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && $notes !== $value;
}
@@ -375,7 +375,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && str_contains(strtolower($notes), strtolower($value));
}
@@ -399,7 +399,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && !str_contains(strtolower($notes), strtolower($value));
}
@@ -423,7 +423,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && !str_ends_with(strtolower($notes), strtolower($value));
}
@@ -447,7 +447,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && !str_starts_with(strtolower($notes), strtolower($value));
}
@@ -471,7 +471,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && str_ends_with(strtolower($notes), strtolower($value));
}
@@ -495,7 +495,7 @@ trait AttachmentCollection
foreach ($transaction['attachments'] as $attachment) {
/** @var null|Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object?->notes()->first()?->text;
$notes = (string) $object?->notes()->first()?->text;
return '' !== $notes && str_starts_with(strtolower($notes), strtolower($value));
}

View File

@@ -195,7 +195,7 @@ trait MetaCollection
public function excludeInternalReference(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -216,7 +216,7 @@ trait MetaCollection
public function externalIdContains(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -228,7 +228,7 @@ trait MetaCollection
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -240,7 +240,7 @@ trait MetaCollection
public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -252,7 +252,7 @@ trait MetaCollection
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -264,7 +264,7 @@ trait MetaCollection
public function externalIdEnds(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -276,7 +276,7 @@ trait MetaCollection
public function externalIdStarts(string $externalId): GroupCollectorInterface
{
$externalId = (string)json_encode($externalId);
$externalId = (string) json_encode($externalId);
$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));
$this->joinMetaDataTables();
@@ -289,7 +289,7 @@ trait MetaCollection
public function externalUrlContains(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', trim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $url));
@@ -300,7 +300,7 @@ trait MetaCollection
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', trim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s%%', $url));
@@ -311,7 +311,7 @@ trait MetaCollection
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s', $url));
@@ -322,7 +322,7 @@ trait MetaCollection
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
// var_dump($url);
@@ -335,7 +335,7 @@ trait MetaCollection
public function externalUrlEnds(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereLike('journal_meta.data', sprintf('%%%s', $url));
@@ -346,7 +346,7 @@ trait MetaCollection
public function externalUrlStarts(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = (string)json_encode($url);
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
// var_dump($url);
@@ -397,7 +397,7 @@ trait MetaCollection
public function internalReferenceContains(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
// var_dump($internalReference);
// exit;
@@ -411,7 +411,7 @@ trait MetaCollection
public function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -423,7 +423,7 @@ trait MetaCollection
public function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -435,7 +435,7 @@ trait MetaCollection
public function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -447,7 +447,7 @@ trait MetaCollection
public function internalReferenceEnds(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -459,7 +459,7 @@ trait MetaCollection
public function internalReferenceStarts(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();
@@ -712,7 +712,7 @@ trait MetaCollection
public function setInternalReference(string $internalReference): GroupCollectorInterface
{
$internalReference = (string)json_encode($internalReference);
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
$this->joinMetaDataTables();

View File

@@ -125,7 +125,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->day >= (int)$day;
return $transaction[$field]->day >= (int) $day;
}
}
@@ -143,7 +143,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->day <= (int)$day;
return $transaction[$field]->day <= (int) $day;
}
}
@@ -161,7 +161,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int)$day === $transaction[$field]->day;
return (int) $day === $transaction[$field]->day;
}
}
@@ -179,7 +179,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int)$day !== $transaction[$field]->day;
return (int) $day !== $transaction[$field]->day;
}
}
@@ -197,7 +197,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->month >= (int)$month;
return $transaction[$field]->month >= (int) $month;
}
}
@@ -215,7 +215,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->month <= (int)$month;
return $transaction[$field]->month <= (int) $month;
}
}
@@ -233,7 +233,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int)$month === $transaction[$field]->month;
return (int) $month === $transaction[$field]->month;
}
}
@@ -251,7 +251,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return (int)$month !== $transaction[$field]->month;
return (int) $month !== $transaction[$field]->month;
}
}
@@ -269,7 +269,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->year >= (int)$year;
return $transaction[$field]->year >= (int) $year;
}
}
@@ -287,7 +287,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $transaction[$field]->year <= (int)$year;
return $transaction[$field]->year <= (int) $year;
}
}
@@ -305,7 +305,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $year === (string)$transaction[$field]->year;
return $year === (string) $transaction[$field]->year;
}
}
@@ -323,7 +323,7 @@ trait TimeCollection
foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) {
return $year !== (string)$transaction[$field]->year;
return $year !== (string) $transaction[$field]->year;
}
}