/** * Creating the PaymentMethod * * @param string $name * @param string $description * * @return PaymentMethod */ public static function create($name, $description = '') { if (($entity = self::getByName($name)) instanceof PaymentMethod) { throw new Exception('The payment method already exsits: ' . $name); } $entity = new PaymentMethod(); return $entity->setName(trim($name))->setDescription(trim($description))->save(); }