Code Duplication    Length = 20-21 lines in 2 locations

src/Rules/DependOn.php 1 location

@@ 43-63 (lines=21) @@
40
        $this->register_error_suppressor_listener($registry);
41
    }
42
43
    protected function register_method_call_listener(ListenerRegistry $registry) {
44
        $registry->on_enter_misc
45
            ( [N\Expr\MethodCall::class]
46
            , function(Insert $insert, Location $location, N\Expr\MethodCall $node) {
47
                // The 'name' could also be a variable like in $this->$method();
48
                if (is_string($node->name)) {
49
                    $method_reference = $insert->_method_reference
50
                        ( $node->name
51
                        , $location->in_entities()[0][1]
52
                        , $location->line()
53
                        , $location->column()
54
                        );
55
                    $this->insert_relation_into
56
                        ( $insert
57
                        , $location
58
                        , $method_reference
59
                        , $location->line()
60
                        );
61
                }
62
            });
63
    }
64
65
    protected function register_func_call_listener(ListenerRegistry $registry) {
66
        $registry->on_enter_misc

src/Rules/Invoke.php 1 location

@@ 41-60 (lines=20) @@
38
        $this->register_eval_listener($registry);
39
    }
40
41
    protected function register_func_call_listener(ListenerRegistry $registry) {
42
        $registry->on_enter_misc
43
            ( [N\Expr\MethodCall::class]
44
            , function(Insert $insert, Location $location, N\Expr\MethodCall $node) {
45
                // The 'name' could also be a variable like in $this->$method();
46
                if (is_string($node->name)) {
47
                    $method_reference = $insert->_method_reference
48
                        ( $node->name
49
                        , $location->in_entities()[0][1]
50
                        , $location->line()
51
                        , $location->column()
52
                        );
53
                    $this->insert_relation_into
54
                        ( $insert
55
                        , $location
56
                        , $method_reference
57
                        );
58
                }
59
            });
60
    }
61
62
    protected function register_method_call_listener(ListenerRegistry $registry) {
63
        $registry->on_enter_misc