Code Duplication    Length = 14-14 lines in 2 locations

lib/midcom/db/attachment.php 2 locations

@@ 431-444 (lines=14) @@
428
     * @param mixed $source File contents.
429
     * @return boolean Indicating success.
430
     */
431
    public function copy_from_memory($source)
432
    {
433
        $dest = $this->open();
434
        if (! $dest)
435
        {
436
            debug_add('Could not open attachment for writing, last Midgard error was: ' . midcom_connection::get_error_string(), MIDCOM_LOG_WARN);
437
            return false;
438
        }
439
440
        fwrite($dest, $source);
441
442
        $this->close();
443
        return true;
444
    }
445
446
    /**
447
     * Updates the contents of the attachments with the contents of the resource identified
@@ 453-466 (lines=14) @@
450
     * @param resource $source The handle to read from.
451
     * @return boolean Indicating success.
452
     */
453
    public function copy_from_handle($source)
454
    {
455
        $dest = $this->open();
456
        if (! $dest)
457
        {
458
            debug_add('Could not open attachment for writing, last Midgard error was: ' . midcom_connection::get_error_string(), MIDCOM_LOG_WARN);
459
            return false;
460
        }
461
462
        stream_copy_to_stream($source, $dest);
463
464
        $this->close();
465
        return true;
466
    }
467
468
    /**
469
     * Updates the contents of the attachments with the contents of the file specified.