VersionTask::main()   C
last analyzed

Complexity

Conditions 8
Paths 6

Size

Total Lines 34
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 23
nc 6
nop 0
dl 0
loc 34
rs 5.3846
c 0
b 0
f 0
1
<?php
2
3
// +---------------------------------------------------------------------------+
4
// | This file is part of the Agavi package.                                   |
5
// | Copyright (c) 2005-2011 the Agavi Project.                                |
6
// |                                                                           |
7
// | For the full copyright and license information, please view the LICENSE   |
8
// | file that was distributed with this source code. You can also view the    |
9
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
10
// |   vi: set noexpandtab:                                                    |
11
// |   Local Variables:                                                        |
12
// |   indent-tabs-mode: t                                                     |
13
// |   End:                                                                    |
14
// +---------------------------------------------------------------------------+
15
16
class VersionTask extends Task
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
{
18
    public function main()
19
    {
20
        $agaviPath = realpath(getcwd() . '/src/agavi.php');
21
        
22
        if (!$agaviPath && !file_exists($agaviPath)) {
23
            throw new BuildException('Agavi not found.');
24
        }
25
26
        require_once($agaviPath);
27
        
28
        $this->project->setUserProperty('agavi.version', Config::get('agavi.version'));
29
        $this->project->setUserProperty('agavi.pear.version', sprintf("%d.%d.%d%s",
30
            Config::get('agavi.major_version'),
31
            Config::get('agavi.minor_version'),
32
            Config::get('agavi.micro_version'),
33
            Config::has('agavi.status') ? Config::get('agavi.status') : ''
34
        ));
35
        
36
        $status = Config::get('agavi.status');
37
        
38
        if ($status == 'dev') {
39
            $status = 'devel';
40
        } elseif (strpos($status, 'alpha') !== false) {
41
            $status = 'alpha';
42
        } elseif (strpos($status, 'beta') !== false) {
43
            $status = 'beta';
44
        } elseif (strpos($status, 'RC') !== false) {
45
            $status = 'beta';
46
        } else {
47
            $status = 'stable';
48
        }
49
        
50
        $this->project->setUserProperty('agavi.status', $status);
51
    }
52
}
53