コード例 #1
0
 private function addOption($name, $value)
 {
     Assert::notBlank($name, 'Option name cannot be empty');
     $value = (int) $value;
     $this->options[$name] = $value;
     return $this;
 }
コード例 #2
0
 /**
  * @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();
 }
コード例 #3
0
ファイル: Styles.php プロジェクト: wookieb/zorro-data-schema
 /**
  * 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;
 }
コード例 #4
0
 /**
  * @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;
 }
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
 public function setClassName($className)
 {
     Assert::nullOrnotBlank($className, 'Class name cannot be empty');
     $this->className = $className;
     return $this;
 }
コード例 #7
0
 /**
  * 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;
 }
コード例 #8
0
 /**
  * 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;
 }
コード例 #9
0
 /**
  * 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;
 }
コード例 #10
0
 /**
  * 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;
 }
コード例 #11
0
 private function setClass($class)
 {
     Assert::notBlank($class, 'Class name cannot be empty');
     $this->reflection = null;
     $this->class = $class;
     return $this;
 }
コード例 #12
0
ファイル: MethodSchema.php プロジェクト: wookieb/zorro-rpc
 private function setName($name)
 {
     Assert::notBlank($name, 'Method name cannot be empty');
     $this->name = $name;
     return $this;
 }
コード例 #13
0
 public function mapToSpecialType($typeOutlineName, $targetTypeClass)
 {
     Assert::notBlank($typeOutlineName, 'Type outline name to map cannot be empty');
     $this->map[$typeOutlineName] = $targetTypeClass;
     return $this;
 }
コード例 #14
0
 private function setName($name)
 {
     Assert::notBlank($name, 'Name of property cannot be empty');
     $this->name = $name;
     return $this;
 }
コード例 #15
0
 /**
  * @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;
 }
コード例 #16
0
ファイル: ArgumentSchema.php プロジェクト: wookieb/zorro-rpc
 private function setName($name)
 {
     Assert::notBlank($name, 'Argument name cannot be blank');
     $this->name = $name;
 }
コード例 #17
0
ファイル: AssertTest.php プロジェクト: wookieb/assert
 public function testExceptionWhenAssertionMethodDoesNotExist2()
 {
     $this->setExpectedException('\\BadMethodCallException', '"nullOrAssertion" does not exist');
     Assert::nullOrAssertion('land');
 }