Code Duplication    Length = 11-11 lines in 4 locations

src/Salesforce.php 4 locations

@@ 54-64 (lines=11) @@
51
        return '';
52
    }
53
54
    private function callCreateOnObject($method, $args)
55
    {
56
        $type = substr($method, 6);
57
        $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type;
58
59
        if (class_exists($class)) {
60
            return (new $class())->create($args[0]);
61
        }
62
63
        return (new BaseObject())->create($type, $args[0]);
64
    }
65
66
    private function callUpdateOnObject($method, $args)
67
    {
@@ 66-76 (lines=11) @@
63
        return (new BaseObject())->create($type, $args[0]);
64
    }
65
66
    private function callUpdateOnObject($method, $args)
67
    {
68
        $type = substr($method, 6);
69
        $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type;
70
71
        if (class_exists($class)) {
72
            return (new $class())->update($args[0]);
73
        }
74
75
        return (new BaseObject())->update($type, $args[0]);
76
    }
77
78
    private function callDeleteOnObject($method, $args)
79
    {
@@ 78-88 (lines=11) @@
75
        return (new BaseObject())->update($type, $args[0]);
76
    }
77
78
    private function callDeleteOnObject($method, $args)
79
    {
80
        $type = substr($method, 6);
81
        $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type;
82
83
        if (class_exists($class)) {
84
            return (new $class())->delete($args[0]);
85
        }
86
87
        return (new BaseObject())->delete($type, $args[0]);
88
    }
89
90
    private function callGetOnObject($method, $args)
91
    {
@@ 90-100 (lines=11) @@
87
        return (new BaseObject())->delete($type, $args[0]);
88
    }
89
90
    private function callGetOnObject($method, $args)
91
    {
92
        $type = substr($method, 3);
93
        $class = '\\Surge\\LaravelSalesforce\\Objects\\'.$type;
94
95
        if (class_exists($class)) {
96
            return (new $class())->record($args[0]);
97
        }
98
99
        return (new BaseObject())->record($type, $args[0]);
100
    }
101
102
    /**
103
     * Run report.