@param bool $primary

@throws InvalidArgumentException

@return $this
435792
public function setPrimary($primary)
    {
        if (!is_bool($primary)) {
            throw new InvalidArgumentException(__CLASS__.'::'.__METHOD__.' must only be called with a boolean argument');
        }

        $this->{self::ATTR_IS_PRIMARY} = $primary;

        return $this;
    }
1066486
public function setPrimaryName($primary) {
		if (is_string($primary) || is_array($primary)) {
			$this->primary = $primary;
			return;
		}
		
		throw new Exceptions\InvalidOption('Name of primary identity must be a string or an array, "' . gettype($primary) . '" was given');
	}
961261
public function setTLS($isEnabled)
    {
        if (!is_bool($isEnabled)) {
            throw new InvalidArgumentException(
                sprintf('%s only accepts a boolean', __FUNCTION__)
            );
        }

        $this->tls = (bool)$isEnabled;

        return $this;
    }
1333031
public function setEarlyIntern($earlyIntern)
    {
        if (!is_bool($earlyIntern)) {
            throw new \InvalidArgumentException(
                __CLASS__ . ' ' . __METHOD__ . ': Not a boolean'
            );
        }

        $this->earlyIntern = $earlyIntern;

        return $this;
    }
283621
final public function setLevel($level)
    {
        if (!in_array(strtolower($level), $this->getAllowedLevel())) {
            throw new InvalidArgumentException();
        }

        $this->level = $level;

        return $this;
    }
1022968
public function setGetter($getter)
    {
        if (!is_bool($getter)) {
            throw new \InvalidArgumentException('The attribute getter on the class Attribute has to be boolean (' . gettype($getter) . ('object' === gettype($getter) ? ' ' . get_class($getter) : '') . ' given).');
        }

        $this->getter = $getter;

        return $this;
    }
1354190
public function set($requiredType)
    {
        if (!in_array($requiredType, $this->validTypes)) {
            throw new \InvalidArgumentException("{$requiredType} is not a supported number type");
        }
        if ($requiredType == self::TYPE_GMP && !extension_loaded('gmp')) {
            throw new \InvalidArgumentException('GMP not supported');
        }

        $this->requiredType = $requiredType;

        return $this;
    }
213228
public function add($constant)
    {
        if (!$constant instanceof ConstantInterface) {
            throw new \InvalidArgumentException(
                'This Constant must be a instance of \ClassGeneration\ConstantInterface'
            );
        }

        if ($constant->getName() === null) {
            $constant->setName('constant' . ($this->count() + 1));
        }

        return parent::add($constant);
    }
727901
public function prependArgument($argument) {
    if (is_scalar($argument)) {
      $argument = Node::fromValue($argument);
    }

    if ($argument instanceof ExpressionNode) {
      /** @var Node $argument */
      $this->arguments->prependItem($argument);
    }
    else {
      throw new \InvalidArgumentException();
    }

    return $this;
  }
288564
protected function createMainMenu($options = null)
    {
        $mainMenuConfig = $this->adminConfig('main_menu');

        if (!isset($mainMenuConfig['items'])) {
            throw new InvalidArgumentException(
                'Missing "admin.main_menu.items"'
            );
        }

        $mainMenuIdent = $this->mainMenuIdent($options);

        $menu = $this->menuBuilder->build([]);
        $menuItems = [];
        foreach ($mainMenuConfig['items'] as $menuIdent => $menuItem) {
            $menuItem['menu'] = $menu;
            $test = $this->menuItemBuilder->build($menuItem);

            if ($test->isAuthorized() === false) {
                continue;
            }
            unset($menuItem['menu']);

            if (isset($menuItem['active']) && $menuItem['active'] === false) {
                continue;
            }

            $menuItems[] = $this->parseMainMenuItem($menuItem, $menuIdent, $mainMenuIdent);
        }

        return $menuItems;
    }
348448
protected function isPrimarySet(array $primary)
    {
        foreach ($primary as $column) {
            if (is_null($this[$column])) {
                return false;
            }
        }

        return true;
    }
1338788
public function setValue($value) {
		if(!in_array($value, self::VALID_VALUES)) {
			throw new InvalidArgumentException('Value is not valid.');
		}

		$this->value = $value;

		return $this;
	}
274950
public function setType(?string $type): self
    {
        if (!$this->isValidType($type)) {
            throw new \InvalidArgumentException(\sprintf(
                "Invalid type '%s'. Must be either NULL, one of %s, or a fully qualified class name or interface",
                $type,
                \implode(', ', $this->getValidTypes())
            ));
        }

        $this->type = $type;

        return $this;
    }
1152455
public static function load($primary, bool $applySetters = false)
    {
        $connection = self::getConnection();
        $primary = static::normalizePrimaryKeys($primary);
        $object = null;

        $query = $connection->createQuery();
        $result = $query->from(static::$table)
            ->where(function (WhereClause $whereClause) use ($primary) {
                foreach ($primary as $key => $value) {
                    $whereClause->and($key, '=', '?');
                }
            })->execute(array_values($primary));

        if ($result->count()) {
            $rowData = $result->fetch()->getData();

            foreach (self::getDateFields() as $dateField) {
                $rowData[$dateField] = date_create_from_format(
                    $connection->getDateFormat(),
                    $rowData[$dateField]
                );
            }

            $object = new static();
            $object->fill($rowData, $applySetters);
        }

        return $object;
    }
1207699
public function setMainOperator($operator)
    {
        switch ($operator) {
            case self::OPERATOR_AND :
                $this->mainOperator = self::OPERATOR_AND;
                break;
            case self::OPERATOR_OR :
                $this->mainOperator = self::OPERATOR_OR;
                break;
            default :
                throw new \InvalidArgumentException(__CLASS__ . '::' . __FUNCTION__ . '() First argument should be ' . __CLASS__ . '::OPERATOR_AND or ' . __CLASS__ . '::OPERATOR_OR constant');
                break;
        }
        $this->rootOperation->setOperator($this->mainOperator);
    }
1265094
public function setIsOnly($isOnly)
    {
        if (is_bool($isOnly)) {
            $this->isOnly = $isOnly;

            return $this;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($isOnly). "' for argument 'isOnly' given."
            );
        }
    }
1001475
public function ifFalse($bool)
    {
        if (null !== $this->apply) {
            throw new \RuntimeException('Cannot nest ifTrue or ifFalse call');
        }

        $this->apply = (false === $bool);

        return $this;
    }