getName()] = $motive; } public static function getMotiveByName(string $name) : ?PaintingMotive{ if(!self::$initialized){ self::init(); } return self::$motives[$name] ?? null; } /** * @return PaintingMotive[] */ public static function getAll() : array{ if(!self::$initialized){ self::init(); } return self::$motives; } public function __construct( protected int $width, protected int $height, protected string $name ){} public function getName() : string{ return $this->name; } public function getWidth() : int{ return $this->width; } public function getHeight() : int{ return $this->height; } public function __toString() : string{ return "PaintingMotive(name: " . $this->getName() . ", height: " . $this->getHeight() . ", width: " . $this->getWidth() . ")"; } }