Completed
Push — 2.0 ( 0d93f2...14c778 )
by Marco
16:42
created

Version::getFullDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php namespace Comodojo\Extender\Components;
2
3
use \Comodojo\Dispatcher\Components\Configuration;
4
5
/**
6
 * Version information class
7
 *
8
 * @package     Comodojo extender
9
 * @author      Marco Giovinazzi <[email protected]>
10
 * @license     GPL-3.0+
11
 *
12
 * LICENSE:
13
 *
14
 * This program is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Affero General Public License as
16
 * published by the Free Software Foundation, either version 3 of the
17
 * License, or (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License
25
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
 */
27
28
class Version {
29
30
    /**
31
     * Extender brief description
32
     *
33
     * @var     string
34
     */
35
    private static $description = "Daemonizable, database driven, multiprocess, (pseudo) cron task scheduler";
36
37
    /**
38
     * Extender current version
39
     *
40
     * @var     string
41
     */
42
    private static $version = "2.0-dev";
43
44
    /**
45
     * Get extender framework description
46
     *
47
     * @return  string
48
     */
49
    static public function getFullDescription(Configuration $configuration) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
50
51
        return "\n".self::getAscii($configuration)."\n"
52
            .self::getDescription($configuration)."\n"
53
            ."Version: ".self::getVersion($configuration);
54
55
    }
56
57
    static public function getDescription(Configuration $configuration) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
58
59
        $description = $configuration->get('extender-custom-description');
60
        return !is_null($description) && is_string($description) ? $description : self::$description;
61
62
    }
63
64
    static public function getAscii(Configuration $configuration) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
65
66
        $ascii = $configuration->get('extender-custom-ascii');
67
        return !is_null($ascii) && is_readable($ascii) ? file_get_contents($ascii) : self::ascii();
68
69
    }
70
71
    /**
72
     * Get extender framework version
73
     *
74
     * @return  string
75
     */
76
    static public function getVersion(Configuration $configuration) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
77
78
        $version = $configuration->get('extender-custom-version');
79
        return !is_null($version) && is_string($version) ? $version : self::$version;
80
81
    }
82
83
    /**
84
     * Get fancy extender logo
85
     *
86
     * @return  string
87
     */
88 View Code Duplication
    private static function ascii() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
90
        $ascii = "\r\n   ______                                __            __        \r\n";
91
        $ascii .= "  / ____/ ____    ____ ___   ____   ____/ / ____      / /  ____  \r\n";
92
        $ascii .= " / /     / __ \  / __ `__ \ / __ \ / __  / / __ \    / /  / __ \ \r\n";
93
        $ascii .= "/ /___  / /_/ / / / / / / // /_/ // /_/ / / /_/ /   / /  / /_/ / \r\n";
94
        $ascii .= "\____/  \____/ /_/ /_/ /_/ \____/ \__,_/  \____/  _/ /   \____/  \r\n";
95
        $ascii .= "----------------------------------------------  /___/  --------- \r\n";
96
        $ascii .= "                 __                      __                      \r\n";
97
        $ascii .= "  ___    _  __  / /_  ___    ____   ____/ / ___    _____ (dev)   \r\n";
98
        $ascii .= " / _ \  | |/_/ / __/ / _ \  / __ \ / __  / / _ \  / ___/         \r\n";
99
        $ascii .= "/  __/ _>  <  / /_  /  __/ / / / // /_/ / /  __/ / /             \r\n";
100
        $ascii .= "\___/ /_/|_|  \__/  \___/ /_/ /_/ \__,_/  \___/ /_/              \r\n";
101
        $ascii .= "--------------------------------------------------------         \r\n";
102
103
        return $ascii;
104
105
    }
106
107
}
108