Matthew Weier O'Phinney
@mwop
Skill Level / Mental Function | Novice | Advanced Beginner | Competence | Proficient | Expert |
---|---|---|---|---|---|
Recollection | Non-Situational | Situational | Situational | Situational | Situational |
Recognition | Decomposed | Decomposed | Holistic | Holistic | Holistic |
Decision | Analytical | Analytical | Analytical | Intuitive | Intuitive |
Awareness | Monitoring | Monitoring | Monitoring | Monitoring | Absorbed |
Rules-Based | Big Picture |
final class Quantity
{
private $value;
public __construct(int $value)
{
$this->value = $value;
}
public function getValue(): int
{
return $this->value;
}
}
class ValueOfSomeKind
{
public function getParameter()
{
if (! $this->parameter) {
$this->parameter = new ParameterValue();
}
return $this->parameter;
}
}
public function testGetter()
{
$instance = new ValueOfSomeKind();
$parameter = new ParameterValue();
$instance->setParameter($parameter);
$this->assertSame($parameter, $instance->getParameter());
}
public function testReturnsPreviouslyInjectedParameter()
{
$instance = new ValueOfSomeKind();
$parameter = new ParameterValue();
$instance->setParameter($parameter);
$this->assertSame($parameter, $instance->getParameter());
}
public function testInitializesAParameterIfNoneInjected()
{
$instance = new ValueOfSomeKind();
$parameter = $instance->getParameter();
$this->assertInstanceOf(ParameterValue::class, $parameter);
}
/**
* @param string|array|Emittable $name
* @param null|object|Emittable $target
* @param array|callable|Emittable $argv
* @param null|callable $callback
* @return mixed
*/
function emit(
$name,
$target = null,
$argv = [],
$callback = null
)
How many behaviors does this have?
/**
* @param string|array|Emittable $name
* @param null|object|Emittable $target
* @param array|callable|Emittable $argv
* @param null|callable $callback
*/
function emit(
$name,
$target = null,
$argv = [],
$callback = null
): void
/**
* @param null|callable $callback
* @return void
*/
function emit(
Emittable $emittable,
callable $callback = null
): void
function emit(Emittable $emittable): void
{
}
function emitUntil(
Emittable $emittable,
callable $callback
): void
{
}
More info in The ThoughtWorks Anthology