Code Duplication    Length = 9-9 lines in 2 locations

src/SourceCallbackAdapter.php 1 location

@@ 34-42 (lines=9) @@
31
     *
32
     * @return SourceResultInterface
33
     */
34
    public function execute($page, $pageSize)
35
    {
36
        $result = call_user_func($this->callback, $page, $pageSize);
37
        if (!is_object($result) || !$result instanceof SourceResultInterface) {
38
            throw new \UnexpectedValueException('Callback should return SourceResultInterface object');
39
        }
40
41
        return $result;
42
    }
43
}
44

src/SourceResultCallbackAdapter.php 1 location

@@ 37-45 (lines=9) @@
34
     *
35
     * @return \Generator
36
     */
37
    public function generator()
38
    {
39
        $result = call_user_func($this->callback);
40
        if (!is_object($result) || !$result instanceof \Generator) {
41
            throw new \UnexpectedValueException('Callback result should return Generator');
42
        }
43
44
        return $result;
45
    }
46
47
    /**
48
     * @return int