Code Duplication    Length = 8-8 lines in 3 locations

src/RulerZ.php 3 locations

@@ 136-143 (lines=8) @@
133
     *
134
     * @throws TargetUnsupportedException
135
     */
136
    public function satisfies($target, string $rule, array $parameters = [], array $executionContext = []): bool
137
    {
138
        $targetCompiler = $this->findTargetCompiler($target, CompilationTarget::MODE_SATISFIES);
139
        $compilationContext = $targetCompiler->createCompilationContext($target);
140
        $executor = $this->compiler->compile($rule, $targetCompiler, $compilationContext);
141
142
        return $executor->satisfies($target, $parameters, $targetCompiler->getOperators()->getOperators(), new ExecutionContext($executionContext));
143
    }
144
145
    /**
146
     * Tells if a target satisfies the given specification.
@@ 60-67 (lines=8) @@
57
     *
58
     * @throws TargetUnsupportedException
59
     */
60
    public function applyFilter($target, string $rule, array $parameters = [], array $executionContext = [])
61
    {
62
        $targetCompiler = $this->findTargetCompiler($target, CompilationTarget::MODE_APPLY_FILTER);
63
        $compilationContext = $targetCompiler->createCompilationContext($target);
64
        $executor = $this->compiler->compile($rule, $targetCompiler, $compilationContext);
65
66
        return $executor->applyFilter($target, $parameters, $targetCompiler->getOperators()->getOperators(), new ExecutionContext($executionContext));
67
    }
68
69
    /**
70
     * Filters a target using the given rule and parameters.
@@ 82-89 (lines=8) @@
79
     *
80
     * @throws TargetUnsupportedException
81
     */
82
    public function filter($target, string $rule, array $parameters = [], array $executionContext = [])
83
    {
84
        $targetCompiler = $this->findTargetCompiler($target, CompilationTarget::MODE_FILTER);
85
        $compilationContext = $targetCompiler->createCompilationContext($target);
86
        $executor = $this->compiler->compile($rule, $targetCompiler, $compilationContext);
87
88
        return $executor->filter($target, $parameters, $targetCompiler->getOperators()->getOperators(), new ExecutionContext($executionContext));
89
    }
90
91
    /**
92
     * Filters a target using the given specification.