for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Transphporm;
class FeatureSet {
private $properties = [];
private $pseudo = [];
public function __construct(Hook\DataFunction $data, Hook\Formatter $formatter, &$headers) {
$this->data = $data;
data
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;
$this->formatter = $formatter;
formatter
$this->headers = &$headers;
headers
}
public function getData() {
return $this->data;
public function getFormatter() {
return $this->formatter;
public function &getHeaders() {
return $this->headers;
public function registerFormatter($formatter) {
$this->formatter->register($formatter);
public function registerProperty($name, Property $property) {
$this->properties[$name] = $property;
public function registerPseudo(Pseudo $pseudo) {
$this->pseudo[] = $pseudo;
public function loadProperties(Hook\PropertyHook $hook) {
foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
public function createPseudoMatcher($pseudo) {
$pseudoMatcher = new Hook\PseudoMatcher($pseudo);
foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction($pseudoFunction);
return $pseudoMatcher;
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: