Example #1
0
 public static function createWithFormat($parent, $spec)
 {
     if (is_string($spec) && strpos($spec, '@') !== false) {
         list($account, $host) = explode('@', $spec);
         $user = new self($parent);
         $user->account(trim($account, "`'"));
         $user->host(trim($host, "`'"));
         return $user;
     }
     throw new InvalidArgumentException('Invalid user spec format.');
 }