| 1 | <?php declare(strict_types = 1); |
||
| 9 | class ChurnProcess |
||
| 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 | * @param Process $process The process being executed on the file. |
||
| 21 | * @param string $type The type of process. |
||
| 22 | */ |
||
| 23 | public function __construct(File $file, Process $process, string $type) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Start the process. |
||
| 32 | * @return void |
||
| 33 | */ |
||
| 34 | public function start() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Determines if the process was successful. |
||
| 41 | * @return boolean |
||
| 42 | */ |
||
| 43 | public function isSuccessful(): bool |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Gets the output of the process. |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getOutput(): string |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Gets the file name of the file the process |
||
| 59 | * is being executed on. |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getFilename(): string |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Gets a unique key used for storing the process in data structures. |
||
| 69 | * @return string |
||
| 70 | */ |
||
| 71 | public function getKey(): string |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Get the type of this process. |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | public function getType(): string |
||
| 84 | } |
||
| 85 |
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: