Code Duplication    Length = 24-24 lines in 2 locations

src/Rules/DependOn.php 1 location

@@ 65-88 (lines=24) @@
62
            });
63
    }
64
65
    protected function register_func_call_listener(ListenerRegistry $registry) {
66
        $registry->on_enter_misc
67
            ( [N\Expr\FuncCall::class]
68
            , function(Insert $insert, Location $location, N\Expr\FuncCall $node) {
69
                // Omit calls to closures, we would not be able to
70
                // analyze them anyway atm.
71
                // Omit functions in arrays, we would not be able to
72
                // analyze them anyway atm.
73
                if (!($node->name instanceof N\Expr\Variable ||
74
                      $node->name instanceof N\Expr\ArrayDimFetch)) {
75
                    $function_reference = $insert->_function_reference
76
                        ( $node->name->parts[0]
77
                        , $location->in_entities()[0][1]
78
                        , $location->line()
79
                        , $location->column()
80
                        );
81
                    $this->insert_relation_into
82
                        ( $insert
83
                        , $location
84
                        , $function_reference
85
                        );
86
                }
87
            });
88
    }
89
90
    protected function register_global_listener(ListenerRegistry $registry) {
91
        $registry->on_enter_misc

src/Rules/Invoke.php 1 location

@@ 62-85 (lines=24) @@
59
            });
60
    }
61
62
    protected function register_method_call_listener(ListenerRegistry $registry) {
63
        $registry->on_enter_misc
64
            ( [N\Expr\FuncCall::class]
65
            , function(Insert $insert, Location $location, N\Expr\FuncCall $node) {
66
                // Omit calls to closures, we would not be able to
67
                // analyze them anyway atm.
68
                // Omit functions in arrays, we would not be able to
69
                // analyze them anyway atm.
70
                if (!($node->name instanceof N\Expr\Variable ||
71
                      $node->name instanceof N\Expr\ArrayDimFetch)) {
72
                    $function_reference = $insert->_function_reference
73
                        ( $node->name->parts[0]
74
                        , $location->in_entities()[0][1]
75
                        , $location->line()
76
                        , $location->column()
77
                        );
78
                    $this->insert_relation_into
79
                        ( $insert
80
                        , $location
81
                        , $function_reference
82
                        );
83
                }
84
            });
85
    }
86
87
    protected function register_exit_or_die_listener(ListenerRegistry $registry) {
88
        $registry->on_enter_misc