public function __construct (char $mark) : void {
$this->mark = $mark;
}
Does not do any validation: it accepts any character.
You should actually check if it's 'X' or '0' and throw an exception otherwise.
Also, constructors don't need a return type, as they never return anything, the object is already constructed by the time __construct is called. A better name for "constructor" would be "initializer".
The constructor:
Does not do any validation: it accepts any character.
You should actually check if it's 'X' or '0' and throw an exception otherwise.
Also, constructors don't need a return type, as they never return anything, the object is already constructed by the time
__construct
is called. A better name for "constructor" would be "initializer".