Passed
Push — main ( 95b369...5c384e )
by Michiel
17:35 queued 12s
created

SvnPropgetTask::main()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
namespace Phing\Tasks\Ext;
22
23
use Phing\Exception\BuildException;
24
25
/**
26
 * List all properties on files, dirs, or revisions from the working copy
27
 */
28
class SvnPropgetTask extends SvnBaseTask
29
{
30
    private $fromDir;
31
    private $svnPropertyName;
32
    private $propertyName = "svn.propget";
33
34
    /**
35
     * Sets the name of the property to use
36
     *
37
     * @param $propertyName
38
     */
39
    public function setPropertyName($propertyName)
40
    {
41
        $this->propertyName = $propertyName;
42
    }
43
44
    /**
45
     * Returns the name of the property to use
46
     */
47
    public function getPropertyName()
48
    {
49
        return $this->propertyName;
50
    }
51
52
    /**
53
     * Sets the name of the property to use
54
     *
55
     * @param $fromDir
56
     */
57
    public function setFromDir($fromDir)
58
    {
59
        $this->fromDir = $fromDir;
60
    }
61
62
    /**
63
     * Returns the name of the property to use
64
     */
65
    public function getFromDir()
66
    {
67
        return $this->fromDir;
68
    }
69
70
    /**
71
     * Sets the name of the property to use
72
     *
73
     * @param $svnPropertyName
74
     */
75
    public function setSvnPropertyName($svnPropertyName)
76
    {
77
        $this->svnPropertyName = $svnPropertyName;
78
    }
79
80
    /**
81
     * Returns the name of the property to use
82
     */
83
    public function getSvnPropertyName()
84
    {
85
        return $this->svnPropertyName;
86
    }
87
88
    /**
89
     * The main entry point
90
     *
91
     * @throws BuildException
92
     */
93
    public function main()
94
    {
95
        $this->setup('propget');
96
97
        $this->log("Get value from file '" . $this->getWorkingCopy() . "'");
98
99
        $output = $this->run([$this->getSvnPropertyName(), $this->getFromDir()]);
100
101
        $this->project->setProperty($this->getPropertyName(), $output);
0 ignored issues
show
Bug introduced by
$output of type array is incompatible with the type string expected by parameter $value of Phing\Project::setProperty(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

101
        $this->project->setProperty($this->getPropertyName(), /** @scrutinizer ignore-type */ $output);
Loading history...
102
    }
103
}
104