Passed
Push — feature/52 ( 2416fc )
by Max
03:02
created

Let::value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Fakes;
4
5
use Closure;
6
7
/**
8
 * Allows to use context instead of creating a new variable.
9
 * 
10
 * @todo #44:25min Classes Let and The contain some repeated cdde which could
11
 *  be extracted into a separate class.
12
 */
13
class Let extends SurveyEnvelope
14
{
15
16
    /**
17
     * Ctor.
18
     *
19
     * @param mixed   $subject element to be put into context
20
     * @param Closure $context context for element
21
     */
22
    public function __construct(mixed $subject, Closure $context)
23
    {
24
        parent::__construct(
25
            $subject,
26
            $context,
27
            fn(mixed $subject, Closure $context): mixed => $context($subject)
28
        );
29
    }
30
}
31