Raise PHPStan level tp 4
This commit is contained in:
parent
26187e2dd9
commit
c851c2292c
7 changed files with 13 additions and 14 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
use App\Services\Publishing\ArticlePublishingService;
|
use App\Services\Publishing\ArticlePublishingService;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Queue\Queueable;
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
use RuntimeException;
|
|
||||||
|
|
||||||
class PublishToLemmyJob implements ShouldQueue
|
class PublishToLemmyJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +28,7 @@ public function handle(): void
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$publishingService->publishToRoutedChannels($this->article, $extractedData);
|
$publishingService->publishToRoutedChannels($this->article, $extractedData);
|
||||||
} catch (PublishException|RuntimeException $e) {
|
} catch (PublishException $e) {
|
||||||
$this->fail($e);
|
$this->fail($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ public function handle(): void
|
||||||
{
|
{
|
||||||
LogSaver::info('Starting channel posts sync job', $this->channel);
|
LogSaver::info('Starting channel posts sync job', $this->channel);
|
||||||
|
|
||||||
if ($this->channel->platformInstance->platform === PlatformEnum::LEMMY) {
|
match ($this->channel->platformInstance->platform) {
|
||||||
$this->syncLemmyChannelPosts();
|
PlatformEnum::LEMMY => $this->syncLemmyChannelPosts(),
|
||||||
}
|
};
|
||||||
|
|
||||||
LogSaver::info('Channel posts sync job completed', $this->channel);
|
LogSaver::info('Channel posts sync job completed', $this->channel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
* @property string $url
|
* @property string $url
|
||||||
* @property string $type
|
* @property string $type
|
||||||
* @property int $language_id
|
* @property int $language_id
|
||||||
* @property Language $language
|
* @property Language|null $language
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property array $settings
|
* @property array $settings
|
||||||
* @property bool $is_active
|
* @property bool $is_active
|
||||||
* @property Carbon $last_fetched_at
|
* @property Carbon|null $last_fetched_at
|
||||||
* @property Carbon $created_at
|
* @property Carbon $created_at
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
* @method static create(array $validated)
|
* @method static create(array $validated)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\PlatformEnum;
|
||||||
use Database\Factories\PlatformChannelFactory;
|
use Database\Factories\PlatformChannelFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
@ -17,7 +18,7 @@
|
||||||
* @property integer $channel_id
|
* @property integer $channel_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property int $language_id
|
* @property int $language_id
|
||||||
* @property Language $language
|
* @property Language|null $language
|
||||||
* @property boolean $is_active
|
* @property boolean $is_active
|
||||||
*/
|
*/
|
||||||
class PlatformChannel extends Model
|
class PlatformChannel extends Model
|
||||||
|
|
@ -60,9 +61,8 @@ public function activePlatformAccounts(): BelongsToMany
|
||||||
|
|
||||||
public function getFullNameAttribute(): string
|
public function getFullNameAttribute(): string
|
||||||
{
|
{
|
||||||
// For Lemmy, use /c/ prefix. Other platforms may use different formats
|
// For Lemmy, use /c/ prefix
|
||||||
$prefix = $this->platformInstance->platform === 'lemmy' ? '/c/' : '/';
|
return $this->platformInstance->url . '/c/' . $this->name;
|
||||||
return $this->platformInstance->url . $prefix . $this->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function feeds(): BelongsToMany
|
public function feeds(): BelongsToMany
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ public static function extractArticleUrls(string $html): array
|
||||||
{
|
{
|
||||||
preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches);
|
preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches);
|
||||||
|
|
||||||
$urls = collect($matches[1] ?? [])
|
$urls = collect($matches[1])
|
||||||
->unique()
|
->unique()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public static function extractArticleUrls(string $html): array
|
||||||
// Extract article links using regex
|
// Extract article links using regex
|
||||||
preg_match_all('/href="(\/vrtnws\/en\/\d{4}\/\d{2}\/\d{2}\/[^"]+)"/', $html, $matches);
|
preg_match_all('/href="(\/vrtnws\/en\/\d{4}\/\d{2}\/\d{2}\/[^"]+)"/', $html, $matches);
|
||||||
|
|
||||||
$urls = collect($matches[1] ?? [])
|
$urls = collect($matches[1])
|
||||||
->unique()
|
->unique()
|
||||||
->map(fn ($path) => 'https://www.vrt.be' . $path)
|
->map(fn ($path) => 'https://www.vrt.be' . $path)
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ includes:
|
||||||
- vendor/larastan/larastan/extension.neon
|
- vendor/larastan/larastan/extension.neon
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
level: 2
|
level: 4
|
||||||
paths:
|
paths:
|
||||||
- app/
|
- app/
|
||||||
- tests/
|
- tests/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue