AB
Size: a a a
L
AB
AB
L
AB
SA
<?php
interface NamedInterface {
public function name(): string;
}
class WidgetClass implements NamedInterface {
private $name;
private $width;
public function __construct(string $name, int $width) {
$this->name = $name;
$this->width = $width;
}
public function name(): string {
return $this->name;
}
public function setWidth(int $arg) {
$this->width = $arg;
}
}
class FactoryClass {
public function generate(): NamedInterface {
$widget = new WidgetClass('top', 42);
return $widget;
}
}
$f = new FactoryClass();
$w = $f->generate();
$w->setWidth(42);
SA
SA
AB
AB
AB
SA
AB
AB
SA
AB
SA
AB
AB