public static function create($name, $abstract) { $widget = new self($name); if (is_callable($abstract)) { $widget->instance($abstract); } elseif (is_string($abstract)) { $widget->abstract = $abstract; } else { throw new \InvalidArgumentException('Second argument must be a string or closure'); } return $widget; }