Webmozart\Assert\Assert::true PHP Method

true() public static method

public static true ( $value, $message = '' )
    public static function true($value, $message = '')
    {
        if (true !== $value) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected a value to be true. Got: %s', static::valueToString($value)));
        }
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function createForPromotion(PromotionInterface $promotion)
 {
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
All Usage Examples Of Webmozart\Assert\Assert::true