Code Duplication    Length = 23-23 lines in 2 locations

src/M3u8/AnnotationReadable/AbstractAnnotationReadable.php 1 location

@@ 26-48 (lines=23) @@
23
                continue;
24
            }
25
26
            foreach ($this->getRefProperties() as $refProp) {
27
                $m3u8 = $this->reader->getPropertyAnnotation($refProp, M3u8Interface::class);
28
                if (null === $m3u8) {
29
                    continue;
30
                }
31
32
                $value = null === $this->getResult() ? null : $refProp->getValue($this->getResult());
33
                if (null !== $value && !is_array($value)) {
34
                    continue;
35
                }
36
37
                if ($m3u8 instanceof ReaderAwareInterface) {
38
                    $m3u8->setReader($this->reader);
39
                }
40
41
                $parsed = $m3u8->setStream($this->getStream())->parse()->getResult();
42
                if (null !== $parsed) {
43
                    is_array($value) ? $value[] = $parsed : $value = $parsed;
44
                    $refProp->setValue($this->ensureResult(), $value);
45
46
                    break;
47
                }
48
            }
49
        } while ($this->couldTryNextLine() && $this->moveToNextLine());
50
51
        return $this;

src/Transformer/AnnotationReadable/AttributeObject.php 1 location

@@ 9-31 (lines=23) @@
6
{
7
    public function transform($attribute)
8
    {
9
        foreach ($this->getRefProperties() as $refProp) {
10
            $transformer = $this->reader->getPropertyAnnotation($refProp, Transformer::class);
11
            if (null === $transform) {
12
                continue;
13
            }
14
15
            $value = null === $this->getResult() ? null : $refProp->getValue($this->getResult());
16
            if (null !== $value) {
17
                continue;
18
            }
19
20
            if ($m3u8 instanceof ReaderAwareInterface) {
21
                $m3u8->setReader($this->reader);
22
            }
23
24
            $parsed = $m3u8->setStream($this->getStream())->parse()->getResult();
25
            if (null !== $parsed) {
26
                is_array($value) ? $value[] = $parsed : $value = $parsed;
27
                $refProp->setValue($this->ensureResult(), $value);
28
29
                break;
30
            }
31
        }
32
    }
33
34
    public function reverse($object)