Пример #1
0
 public function register(Feature $feature, $strategyName)
 {
     if (!$this->isStrategyRegistered($strategyName)) {
         throw new \InvalidArgumentException(sprintf("Strategy '%s' is not registered.", $strategyName));
     }
     $this->features[] = $feature;
     $this->featureStrategyMapping[$feature->getName()] = $strategyName;
 }
Пример #2
0
 public function save(Feature $feature, $userKey, $variant)
 {
     $table = $this->tableName;
     $stmt = $this->pdo->prepare("INSERT INTO {$table} (id, user, feature, variant) VALUES (NULL, :user, :feature, :variant)");
     $stmt->bindParam('user', $userKey);
     $stmt->bindParam('feature', $feature->getName());
     $stmt->bindParam('variant', $variant);
     return $stmt->execute();
 }