Code Duplication    Length = 7-9 lines in 3 locations

src/Mouf/Database/TDBM/AbstractTDBMObject.php 3 locations

@@ 223-231 (lines=9) @@
220
221
    protected function set($var, $value, $tableName = null)
222
    {
223
        if ($tableName === null) {
224
            if (count($this->dbRows) > 1) {
225
                throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.');
226
            } elseif (count($this->dbRows) === 1) {
227
                $tableName = array_keys($this->dbRows)[0];
228
            } else {
229
                throw new TDBMException('Please specify a table for this object.');
230
            }
231
        }
232
233
        if (!isset($this->dbRows[$tableName])) {
234
            $this->registerTable($tableName);
@@ 249-257 (lines=9) @@
246
     */
247
    protected function setRef($foreignKeyName, AbstractTDBMObject $bean = null, $tableName = null)
248
    {
249
        if ($tableName === null) {
250
            if (count($this->dbRows) > 1) {
251
                throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.');
252
            } elseif (count($this->dbRows) === 1) {
253
                $tableName = array_keys($this->dbRows)[0];
254
            } else {
255
                throw new TDBMException('Please specify a table for this object.');
256
            }
257
        }
258
259
        if (!isset($this->dbRows[$tableName])) {
260
            $this->registerTable($tableName);
@@ 199-205 (lines=7) @@
196
     */
197
    private function checkTableName($tableName = null)
198
    {
199
        if ($tableName === null) {
200
            if (count($this->dbRows) > 1) {
201
                throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.');
202
            } elseif (count($this->dbRows) === 1) {
203
                $tableName = array_keys($this->dbRows)[0];
204
            }
205
        }
206
207
        return $tableName;
208
    }