src/Attributes.php
function set($attribute, $value = null) {
    $attributes = is_array($attribute)
                ? $attribute
                : [$attribute => $value];

    foreach ($attributes as $attr => $val) {

      if ($this->getPropertyFor($attr, 'accepts')) {
          $acceptsConstraint = new Attributes\Constraint\Accepts($this->getPropertyFor($attr, 'accepts'));
          if (!$acceptsConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      if ($this->getPropertyFor($attr, 'minimum')) {
          $minimumConstraint = new Attributes\Constraint\Minimum($this->getPropertyFor($attr, 'minimum'));
          if (!$minimumConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      if ($this->getPropertyFor($attr, 'maximum')) {
          $maximumConstraint = new Attributes\Constraint\Maximum($this->getPropertyFor($attr, 'maximum'));
          if (!$maximumConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      $this->setPropertyFor($attr, 'value', $val, 'set');
    }

    return $this;
  }
function set($attribute, $value = null) {
    $attributes = is_array($attribute)
                ? $attribute
                : [$attribute => $value];

    foreach ($attributes as $attr => $val) {

      if ($this->getPropertyFor($attr, 'accepts')) {
          $acceptsConstraint = new Attributes\Constraint\Accepts($this->getPropertyFor($attr, 'accepts'));
          if (!$acceptsConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      if ($this->getPropertyFor($attr, 'minimum')) {
          $minimumConstraint = new Attributes\Constraint\Minimum($this->getPropertyFor($attr, 'minimum'));
          if (!$minimumConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      if ($this->getPropertyFor($attr, 'maximum')) {
          $maximumConstraint = new Attributes\Constraint\Maximum($this->getPropertyFor($attr, 'maximum'));
          if (!$maximumConstraint->isValid($val)) {
              throw new InvalidArgumentException(__CLASS__ . " does not accept {$val} as value for the property {$attr}");
          }
      }

      $this->setPropertyFor($attr, 'value', $val, 'set');
    }

    return $this;
  }
function set ( $ attribute , $ value = null ) { $ attributes = is_array ( $ attribute ) ? $ attribute : [ $ attribute => $ value ] ; foreach ( $ attributes as $ attr => $ val ) { if ( $ this -> getPropertyFor ( $ attr , 'accepts' ) ) { $ acceptsConstraint = new Attributes \ Constraint \ Accepts ( $ this -> getPropertyFor ( $ attr , 'accepts' ) ) ; if ( ! $ acceptsConstraint -> isValid ( $ val ) ) { throw new InvalidArgumentException ( __CLASS__ . " does not accept {$val} as value for the property {$attr}" ) ; } } if ( $ this -> getPropertyFor ( $ attr , 'minimum' ) ) { $ minimumConstraint = new Attributes \ Constraint \ Minimum ( $ this -> getPropertyFor ( $ attr , 'minimum' ) ) ; if ( ! $ minimumConstraint -> isValid ( $ val ) ) { throw new InvalidArgumentException ( __CLASS__ . " does not accept {$val} as value for the property {$attr}" ) ; } } if ( $ this -> getPropertyFor ( $ attr , 'maximum' ) ) { $ maximumConstraint = new Attributes \ Constraint \ Maximum ( $ this -> getPropertyFor ( $ attr , 'maximum' ) ) ; if ( ! $ maximumConstraint -> isValid ( $ val ) ) { throw new InvalidArgumentException ( __CLASS__ . " does not accept {$val} as value for the property {$attr}" ) ; } } $ this -> setPropertyFor ( $ attr , 'value' , $ val , 'set' ) ; } return $ this ; }
`set` attributes value

@param   string  $attribute  attribute name
@param   mixed   $value      attribute value

@return  $this
set attributes value