Completed
Pull Request — master (#2)
by Tim
02:51
created

AbstractRoboFile   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sync() 0 19 3
1
<?php
2
3
/**
4
 * AppserverIo\RoboTasks\AbstractRoboFile
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/robo-tasks
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\RoboTasks;
22
23
use Robo\Robo;
24
use Robo\Tasks;
25
26
/**
27
 * Abstract implementation of a Robo configuration class.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2015 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/appserver-io/robo-tasks
33
 * @link      http://www.appserver.io
34
 */
35
abstract class AbstractRoboFile extends Tasks
36
{
37
38
    /**
39
     * Load the appserver.io base tasks.
40
     *
41
     * @var \AppserverIo\RoboTasks\Base\loadTasks
42
     */
43
    use Base\loadTasks;
44
45
    /**
46
     * The sync command implementation.
47
     *
48
     * @param array $opts The command OptionsHookDispatcher
49
     *
50
     * @return void
51
     */
52
    public function sync(array $opts = [InputOptionKeys::SRC => null, InputOptionKeys::DEST => null])
53
    {
54
55
        // load the task
56
        $task = $this->taskSync();
57
58
        // set source directory
59
        if (isset($opts[InputOptionKeys::SRC])) {
60
            $task->src($opts[InputOptionKeys::SRC]);
61
        }
62
63
        // set target directory
64
        if (isset($opts[InputOptionKeys::DEST])) {
65
            $task->dest($opts[InputOptionKeys::DEST]);
66
        }
67
68
        // run the task
69
        $task->run();
70
    }
71
}
72