for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
namespace Churn\Factories;
use Churn\Processes\ChurnProcess;
use Churn\Values\Config;
use Churn\Values\File;
use Symfony\Component\Process\Process;
class ProcessFactory
{
/**
* ProcessFactory constructor.
* @param Config $config Configuration Settings.
*/
public function __construct(Config $config)
$this->config = $config;
config
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* Creates a Git Commit Process that will run on $file.
* @param File $file File that the process will execute on.
* @return ChurnProcess
public function createGitCommitProcess(File $file): ChurnProcess
$process = new Process(
'git -C ' . getcwd() . " log --since=\"" . $this->config->getCommitsSince() . "\" --name-only --pretty=format: " . $file->getFullPath(). " | sort | uniq -c | sort -nr"
);
return new ChurnProcess($file, $process, 'GitCommitProcess');
* Creates a Cyclomatic Complexity Process that will run on $file.
public function createCyclomaticComplexityProcess(File $file): ChurnProcess
$rootFolder = __DIR__ . '/../../';
"php {$rootFolder}CyclomaticComplexityAssessorRunner {$file->getFullPath()}"
return new ChurnProcess($file, $process, 'CyclomaticComplexityProcess');
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: