feat: torrentio api for movie results

This commit is contained in:
2025-04-21 16:11:57 -05:00
parent 77907601f8
commit fb4651c925
14 changed files with 210 additions and 13 deletions

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Torrentio\Client\Rule\DownloadOptionFilter;
use App\Torrentio\Result\ResultFactory;
class Resolution
{
public function __construct(
public string $expectedValue
) {}
public function __invoke(ResultFactory $result): bool
{
return $result->resolution === $this->expectedValue;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Torrentio\Client\Rule;
class RuleEngine
{
private array $rules = [];
public function addRule(callable $rule): void
{
$this->rules[] = $rule;
}
public function validateAny($fact): bool
{
foreach ($this->rules as $rule) {
if ($rule($fact)) {
return true;
}
}
return false;
}
public function validateAll($fact): bool
{
foreach ($this->rules as $rule) {
if (!$rule($fact)) {
return false;
}
}
return true;
}
}