Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\PropertyConditionGenerator::in PHP Method

in() public method

public in ( mixed $operandDefinition ) : PropertyConditionGenerator
$operandDefinition mixed
return PropertyConditionGenerator the current instance to allow for method chaining
    public function in($operandDefinition)
    {
        $this->operator = 'in';
        $this->operand = $this->getValueForOperand($operandDefinition);
        if (is_array($this->operand) === false && $this->operand instanceof \Traversable === false) {
            throw new InvalidPolicyException(sprintf('The "in" operator needs an array as operand! Got: "%s"', $this->operand), 1416313526);
        }
        foreach ($this->operand as $iterator => $singleOperandValueDefinition) {
            $this->operandDefinition['inOperandValue' . $iterator] = $singleOperandValueDefinition;
        }
        return $this;
    }

Usage Example

 /**
  * @param string|array $workspaceNames
  * @return PropertyConditionGenerator
  */
 public function isInWorkspace($workspaceNames)
 {
     $propertyConditionGenerator = new PropertyConditionGenerator('workspace');
     if (!is_array($workspaceNames)) {
         $workspaceNames = array($workspaceNames);
     }
     return $propertyConditionGenerator->in($workspaceNames);
 }