bandwidthThrottle\tokenBucket\storage\PDOStorage::__construct PHP Метод

__construct() публичный Метод

The name should be the same for all token buckets which share the same token storage. The transaction isolation level should avoid lost updates, i.e. it should be at least Repeatable Read.
public __construct ( string $name, PDO $pdo )
$name string The name of the token bucket.
$pdo PDO The PDO.
    public function __construct($name, \PDO $pdo)
    {
        if (strlen($name) > 128) {
            throw new \LengthException("The name should not be longer than 128 characters.");
        }
        if ($pdo->getAttribute(\PDO::ATTR_ERRMODE) !== \PDO::ERRMODE_EXCEPTION) {
            throw new \InvalidArgumentException("The pdo must have PDO::ERRMODE_EXCEPTION set.");
        }
        $this->pdo = $pdo;
        $this->name = $name;
        $this->mutex = new TransactionalMutex($pdo);
    }