当前属性以特定字符串结尾.

@param $attribute
@param string|null $value

@return static
502246
public function whereEndsWith($attribute, string $value)
    {
        $this->data->must()->regexp($attribute, '.*' . $value);

        return $this;
    }
1247433
public function attribute(string $name, string $value = null) : object
    {
        $this->attributes[$name] = $value;
        return $this;
    }
561824
public static function link( array $attributes = array(), $value = null )
    {
        $attributes['rel'] = 'stylesheet';
        $attributes['type'] = 'text/css';

        return static::tag( 'link', $attributes, $value, true, true );
    }
134463
public function attr(string $name, $value = null) {
        if (is_null($value)) {
            return $this->getAttr($name);
        } else {
            return $this->setAttr($name, $value);
        }
    }
662597
public function cell($value, array $attributes = null)
        {
            $cell = new self;
            $cell->setValue($value);

            if (null !== $attributes) {
                $cell->setAttributes($attributes);
            }

            return $cell;
        }
102015
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;
  }
564947
public function attr($name, $value = null)
    {
        if ($value === null) {
            return $this->getAttribute($name);
        }

        return $this->setAttribute($name, $value);
    }
510698
public function setItemParentAttribute(string $attribute, string $value = '')
    {
        $this->applyToAll(function (HasParentAttributes $item) use ($attribute, $value) {
            $item->setParentAttribute($attribute, $value);
        });

        return $this;
    }
354671
public function addAttributeValue(string $attribute, string $value = ''): self
    {
        // Retrieve the current values of the attribute
        $values = $this->getAttribute($attribute);

        // Merge the values
        if (! in_array($value, $values)) {
            $values[] = $value;
        }

        // Store the new values
        $this->setAttribute($attribute, $values);

        return $this;
    }
1081679
public function whereContains($attribute, string $value)
    {
        $this->data->must()->match($attribute, $value);

        return $this;
    }
1368217
public function setAttribute($key, $value = null)
    {
        if (is_array($key) && is_null($value)) {
            $this->attributes = $key;
        } else {
            array_set($this->attributes, $key, $value);
        }

        return $this;
    }
320080
public function with($attribute, $value)
    {
        $attribute = $this->snake($attribute);

        if (!$this->validate($attribute, $value)) {
            throw new InvalidArgumentException("错误的属性值'{$attribute}'");
        }

        $this->attributes[$attribute] = $value;

        return $this;
    }
1354259
public static function getAttributeByValue($attribute, $value)
    {
        $constant = self::getConstantConfigByValue($value);
        if (isset($constant[$attribute])) {
            return $constant[$attribute];
        }
        return false;
    }
1322016
public function value($value = null) {

        if(null !== $value && false === is_string($value) && false === is_numeric($value)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
        }

        $this -> value = (string) $value;
        $this -> attributes['value'] = (string) $value;

        return $this;
    }
1292589
public function removeAttributeValue(string $attribute, string $value): self
    {
        // Only remove value if attribute is present
        if (! array_key_exists($attribute, $this->attributes)) {
            return $this;
        }

        // Remove the value from the attribute
        $values = array_filter(
            $this->getAttribute($attribute),
            function ($attributeValue) use ($value) {
                return $attributeValue !== $value;
            }
        );

        // Stores the new values
        $this->setAttribute($attribute, $values);

        return $this;
    }
1092078
public static function create($attribute, $value)
    {
        $attributesType = self::getAllAttributeType();
        foreach ($attributesType as $attributeType) {
            if ($attributeType->isMember($attribute)) {
                return $attributeType->create($value);
            }
        }

        return $value;
    }
722763
public function setValueIfAttributeExists($attribute, $value)
    {
        if ($this->hasAttribute($attribute)) {
            $currentValue = $this->getAttribute('value');

            $this->setAttribute('value', $currentValue + $value);
        }
    }