1 | <?php declare(strict_types = 1); |
||
9 | class GitCommitCountProcess |
||
10 | { |
||
11 | /** |
||
12 | * The Symfony Process Component. |
||
13 | * @var Process |
||
14 | */ |
||
15 | private $process; |
||
16 | |||
17 | /** |
||
18 | * GitCommitCountProcess constructor. |
||
19 | * @param File $file The file the process is being executed on. |
||
20 | */ |
||
21 | public function __construct(File $file) |
||
25 | |||
26 | /** |
||
27 | * Start the process. |
||
28 | * @return void |
||
29 | */ |
||
30 | public function start() |
||
36 | |||
37 | /** |
||
38 | * Determines if the process was successful. |
||
39 | * @return boolean |
||
40 | */ |
||
41 | public function isSuccessful(): bool |
||
45 | |||
46 | /** |
||
47 | * Gets the output of the process. |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getOutput(): string |
||
54 | |||
55 | /** |
||
56 | * Gets the file name of the file the process |
||
57 | * is being executed on. |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getFilename(): string |
||
64 | |||
65 | /** |
||
66 | * Gets a unique key used for storing the process in data structures. |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getKey(): string |
||
73 | |||
74 | /** |
||
75 | * Get the type of this process. |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getType(): string |
||
82 | |||
83 | /** |
||
84 | * The process command. |
||
85 | * @return string |
||
86 | */ |
||
87 | private function getCommandString(): string |
||
91 | } |
||
92 |
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: