for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yarak\Console\Command;
use Symfony\Component\Console\Command\Command;
abstract class Parser
{
/**
* Command to build.
*
* @var Command
*/
protected $command;
* Construct.
* @param Command $command
public function __construct(Command $command)
$this->command = $command;
}
* Set array modeArray value if value contains *.
* @param string $value
* @param string $constant
* @return string
protected function parseArray($value, $constant)
if (strpos($value, '*') !== false) {
$this->modeArray[] = $constant;
modeArray
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;
$value = str_replace('*', '', $value);
return $value;
* Parse an argument/option description.
* @return array [argument|option, description]
protected function parseDescription($value)
if (strpos($value, ':') !== false) {
return array_map('trim', explode(':', $value));
return [$value, null];
* Calculate the mode score.
* @param array $modeArray
* @param string $class
* @return int
protected function calculateMode(array $modeArray, $class)
$mode = 0;
foreach ($modeArray as $constant) {
$mode = $mode | constant($class.'::'.$constant);
return $mode;
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: