CopyHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 7
c 2
b 0
f 1
dl 0
loc 21
ccs 0
cts 12
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parsePath() 0 3 1
A renderPath() 0 8 2
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\handlers;
12
13
use Yii;
14
15
/**
16
 * Handler for copying.
17
 */
18
class CopyHandler extends BaseHandler
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function renderPath($path, $data)
24
    {
25
        try {
26
            copy($data->getCopy(), $path);
27
        } catch (\Exception $e) {
28
            throw new \RuntimeException("Failed to copy file \"{$data->getCopy()}\" to \"$path\": {$e->getMessage()}");
29
        }
30
        Yii::warning('Copied file: ' . $path);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function parsePath($path, $minimal = null)
37
    {
38
        return;
39
    }
40
}
41