For solely to reduce duplicated code and when injection isn't applicable, should one use inheritance or traits?
<?php
abstract class BaseClass
{
private $id, $name;
public function __construct(int $id, string $name) {
$this->id=$id;
$this->name=$name;
}
public function getId():int
{
return $this->id;
}
public function getName():string
{
return $this->name;
}
}
<?php
class A extends BaseClass{}
class B e