for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tworzenieweb\SqlProvisioner\Database;
use Symfony\Component\Process\InputStream;
use Symfony\Component\Process\Process;
use Tworzenieweb\SqlProvisioner\Model\Candidate;
/**
* @author Luke Adamczewski
* @package Tworzenieweb\SqlProvisioner\Database
*/
class Parser
{
* @param string $composerBinPath
public function __construct($composerBinPath)
$this->composerBinPath = $composerBinPath;
composerBinPath
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;
}
* @param Candidate $candidate
* @return array
public function execute(Candidate $candidate)
$input = new InputStream();
$input->write($candidate->getContent());
$process = new Process($this->getCommandString());
$process->setInput($input);
$process->start();
$input->close();
$process->wait();
// remove extra header
$parsingResult = explode("\n", $process->getOutput());
array_shift($parsingResult);
return implode("\n", $parsingResult);
* @return string
private function getCommandString()
return sprintf('%s/php-sqllint -', realpath($this->composerBinPath));
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: