private function addOption($name, $value) { Assert::notBlank($name, 'Option name cannot be empty'); $value = (int) $value; $this->options[$name] = $value; return $this; }
/** * @param string $name name of property * * @throws \InvalidArgumentException when name is invalid */ public function __construct($name) { Assert::notBlank($name, 'Name of class type cannot be empty'); $this->name = $name; $this->init(); }
/** * Register new style * * @param string $name style name * @param StyleInterface $style * @return self */ public function registerStyle($name, StyleInterface $style) { Assert::notBlank($name, 'Name of style cannot be empty'); $this->styles[$name] = $style; return $this; }
/** * @param string $name * @param TypeInterface $type * @return self * @throws \InvalidArgumentException when name is empty */ public function addType($name, TypeInterface $type) { Assert::notBlank($name, 'Name of type cannot be empty'); $this->types[$name] = $type; return $this; }
/** * @param string $name * @param TypeInterface $type * @throws \InvalidArgumentException when name is empty */ public function __construct($name, TypeInterface $type) { Assert::notBlank($name, 'Name of collection cannot be empty'); $this->name = $name; $this->setType($type); }
public function setClassName($className) { Assert::nullOrnotBlank($className, 'Class name cannot be empty'); $this->className = $className; return $this; }
/** * Sets target property name which gives us ability to map current property to another one with different name * * @param string $targetPropertyName * @return self * * @throws \InvalidArgumentException */ public function setTargetPropertyName($targetPropertyName) { Assert::notBlank($targetPropertyName, 'Name of target property cannot be empty'); $this->targetPropertyName = $targetPropertyName; return $this; }
/** * Sets name of getter method * * @param string $getter * @return self * * @throws \InvalidArgumentException when name is empty * @throws \BadMethodCallException when accessors are disabled */ public function setGetter($getter = null) { Assert::nullOrNotBlank($getter, 'Getter name cannot be empty'); $this->getter = $getter; return $this; }
/** * Registers alias for a type * * @param string $alias * @param string $type * @throws \InvalidArgumentException when alias or type is blank */ public static function registerTypeAlias($alias, $type) { Assert::notBlank($alias, 'Alias name cannot be blank'); Assert::notBlank($type, 'Target type name cannot be blank'); self::$aliases[strtolower($alias)] = $type; }
/** * Set current name as provided in argument * If name is null then default name (from defaultName property) will be set * * @param null|string $name * * @throws \InvalidArgumentException when name is invalid */ public function __construct($name = null) { Assert::nullOrNotBlank($name, 'Name of type outline cannot be empty'); $this->name = $name ?: $this->defaultName; }
private function setClass($class) { Assert::notBlank($class, 'Class name cannot be empty'); $this->reflection = null; $this->class = $class; return $this; }
private function setName($name) { Assert::notBlank($name, 'Method name cannot be empty'); $this->name = $name; return $this; }
public function mapToSpecialType($typeOutlineName, $targetTypeClass) { Assert::notBlank($typeOutlineName, 'Type outline name to map cannot be empty'); $this->map[$typeOutlineName] = $targetTypeClass; return $this; }
private function setName($name) { Assert::notBlank($name, 'Name of property cannot be empty'); $this->name = $name; return $this; }
/** * @param string $className * @param bool $exactMatch comparison should be performed by exact class name match (true) or instanceof operator (false) */ public function __construct($className, $exactMatch = false) { Assert::notBlank($className, 'Class name cannot be blank'); $this->className = ltrim($className, '\\'); $this->exactMatch = (bool) $exactMatch; }
private function setName($name) { Assert::notBlank($name, 'Argument name cannot be blank'); $this->name = $name; }
public function testExceptionWhenAssertionMethodDoesNotExist2() { $this->setExpectedException('\\BadMethodCallException', '"nullOrAssertion" does not exist'); Assert::nullOrAssertion('land'); }