public static function createForManifest(Manifest $manifest, string $pathToZip) : Zip { $zip = new static($pathToZip); $zip->open(); foreach ($manifest->files() as $file) { $zip->add($file, self::determineNameOfFileInZip($file, $pathToZip)); } $zip->close(); return $zip; }
/** * 启用日志 * * @param array $arr * @return void */ static function open($arr = null) { if (!isset(static::$object)) { static::init(); static::$object = true; } static::$open = true; if ($arr) { static::$enable = $arr; } }
/** * Establish LDAP connection * * @static * @access public * @param string $username * @param string $password * @return Client */ public static function connect($username = null, $password = null) { $client = new static(); $client->open($client->getLdapServer()); $username = $username ?: $client->getLdapUsername(); $password = $password ?: $client->getLdapPassword(); if (empty($username) && empty($password)) { $client->useAnonymousAuthentication(); } else { $client->authenticate($username, $password); } return $client; }