Code Duplication    Length = 3-4 lines in 3 locations

src/relationships/HasManyRelationship.php 1 location

@@ 55-57 (lines=3) @@
52
    }
53
54
    public function runSetup() {
55
        if ($this->options['foreign_key'] == null) {
56
            $this->options['foreign_key'] = Text::singularize($this->setupTable) . '_id';
57
        }
58
        if ($this->options['local_key'] == null) {
59
            $this->options['local_key'] = $this->setupPrimaryKey[0];
60
        }

src/relationships/ManyHaveManyRelationship.php 2 locations

@@ 85-88 (lines=4) @@
82
            $this->options['local_key'] = $this->setupPrimaryKey[0];
83
        }
84
85
        if (!isset($this->options['junction_local_key'])) {
86
            $this->options['junction_local_key'] = Text::singularize($this->setupTable) . '_id';
87
        }
88
89
        if (!isset($this->options['junction_foreign_key'])) {
90
            $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']) . '_id';
91
        }
@@ 89-91 (lines=3) @@
86
            $this->options['junction_local_key'] = Text::singularize($this->setupTable) . '_id';
87
        }
88
89
        if (!isset($this->options['junction_foreign_key'])) {
90
            $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']) . '_id';
91
        }
92
    }
93
94
    public function preSave(&$wrapper, $value)