1 | <?php |
||
13 | class Git_Shell_Command { |
||
14 | /** |
||
15 | * Constructor! |
||
16 | * |
||
17 | * @param String $name repository name. |
||
18 | */ |
||
19 | public function __construct( $name ) { |
||
24 | |||
25 | /** |
||
26 | * Returns the latest repo tag |
||
27 | */ |
||
28 | public function get_latest_tag() { |
||
34 | |||
35 | /** |
||
36 | * Returns a `shortstat` diff between two tags |
||
37 | * |
||
38 | * @param String $source git tag or branch. |
||
39 | * @param String $target git tag or branch. |
||
40 | */ |
||
41 | public function get_diff_between( $source, $target ) { |
||
47 | |||
48 | /** |
||
49 | * Clones a repository |
||
50 | * |
||
51 | * @param String $type URL type to use. |
||
52 | */ |
||
53 | public function clone_repository( $type = 'ssh' ) { |
||
67 | |||
68 | /** |
||
69 | * Checkout to a new branch |
||
70 | * |
||
71 | * @param String $branch branch name. |
||
72 | */ |
||
73 | public function checkout_new_branch( $branch ) { |
||
79 | |||
80 | /** |
||
81 | * Tag new version |
||
82 | * |
||
83 | * @param String $name tag name. |
||
84 | */ |
||
85 | public function tag_new_version( $name ) { |
||
91 | |||
92 | /** |
||
93 | * Get status |
||
94 | */ |
||
95 | public function status() { |
||
100 | |||
101 | /** |
||
102 | * Commit all changes |
||
103 | */ |
||
104 | public function commit() { |
||
109 | |||
110 | /** |
||
111 | * Checkout to a new branch |
||
112 | * |
||
113 | * @param String $branch branch name. |
||
114 | */ |
||
115 | public function push_to_remote( $branch ) { |
||
124 | } |
||
125 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: