getMessage() . "\n"); return null; } return $nosClient; } public static function getTestBucketName() { return self::bucket; } public static function createBucket() { $nosClient = self::getNosClient(); if (is_null($nosClient)) exit(1); try { $exist = $nosClient->doesBucketExist(self::bucket); } catch (NosException $e) { printf(__FUNCTION__ . ": FAILED\n"); printf($e->getMessage() . "\n"); return; } if ($exist) { return; } $acl = NosClient::NOS_ACL_TYPE_PUBLIC_READ; try { $nosClient->createBucket(self::bucket, $acl); } catch (NosException $e) { printf(__FUNCTION__ . ": FAILED\n"); printf($e->getMessage() . "\n"); return; } printf(__FUNCTION__ . ": OK\n"); } public static function println($message) { if (! empty($message)) { echo strval($message) . "\n"; } } } Common::createBucket();