Code Duplication    Length = 22-22 lines in 2 locations

src/class/SqlActions.php 2 locations

@@ 420-441 (lines=22) @@
417
     * 
418
     * @return \BfwSql\SqlActions
419
     */
420
    public function addQuotedColumns(...$columns)
421
    {
422
        if ($this instanceof SqlSelect || $this instanceof SqlDelete) {
423
            throw new Exception(
424
                'Sorry, automatic quoted value is not supported into '
425
                .get_called_class().' class'
426
            );
427
        }
428
        
429
        foreach ($columns as $columnName) {
430
            if (isset($this->notQuotedColumns[$columnName])) {
431
                throw new Exception(
432
                    'The column '.$columnName.' is already declared to be a'
433
                    .' not quoted value.'
434
                );
435
            }
436
            
437
            $this->quotedColumns[$columnName] = true;
438
        }
439
        
440
        return $this;
441
    }
442
    
443
    /**
444
     * Declare columns should not be automatic quoted if value is string.
@@ 452-473 (lines=22) @@
449
     * 
450
     * @return \BfwSql\SqlActions
451
     */
452
    public function addNotQuotedColumns(...$columns)
453
    {
454
        if ($this instanceof SqlSelect || $this instanceof SqlDelete) {
455
            throw new Exception(
456
                'Sorry, automatic quoted value is not supported into '
457
                .get_called_class().' class'
458
            );
459
        }
460
        
461
        foreach ($columns as $columnName) {
462
            if (isset($this->quotedColumns[$columnName])) {
463
                throw new Exception(
464
                    'The column '.$columnName.' is already declared to be a'
465
                    .' quoted value.'
466
                );
467
            }
468
            
469
            $this->notQuotedColumns[$columnName] = true;
470
        }
471
        
472
        return $this;
473
    }
474
    
475
    /**
476
     * Quote a value if need, else return the value passed in parameter