public function setPackage($code) { if (!array_key_exists($code, self::$packagingTypes)) { throw new Exception('Error: That package code does not exist.'); } $this->packageType = $code; }