Webmozart\Expression\Expr::endsWith PHP Method

endsWith() public static method

Check that a value ends with a given string.
public static endsWith ( string $suffix ) : EndsWith
$suffix string The suffix string.
return Webmozart\Expression\Constraint\EndsWith The created expression.
    public static function endsWith($suffix)
    {
        return new EndsWith($suffix);
    }

Usage Example

コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function leaveExpression(Expression $expr)
 {
     if ($expr instanceof Method) {
         switch ($expr->getMethodName()) {
             case 'getUuid':
                 return Expr::method('getUuid', $expr->getExpression());
             case 'getGlob':
                 $queryExpr = $expr->getExpression();
                 if ($queryExpr instanceof Same) {
                     $queryExpr = Expr::same($queryExpr->getComparedValue() . '{,/**/*}');
                 } elseif ($queryExpr instanceof Equals) {
                     $queryExpr = Expr::equals($queryExpr->getComparedValue() . '{,/**/*}');
                 } elseif ($queryExpr instanceof NotSame) {
                     $queryExpr = Expr::notSame($queryExpr->getComparedValue() . '{,/**/*}');
                 } elseif ($queryExpr instanceof NotEquals) {
                     $queryExpr = Expr::notEquals($queryExpr->getComparedValue() . '{,/**/*}');
                 } elseif ($queryExpr instanceof EndsWith) {
                     $queryExpr = Expr::endsWith($queryExpr->getAcceptedSuffix() . '{,/**/*}');
                 }
                 return Expr::method('getBinding', Expr::method('getQuery', $queryExpr));
             case 'getServerName':
                 return Expr::method('getParameterValue', DiscoveryUrlGenerator::SERVER_PARAMETER, $expr->getExpression());
             case 'getServerPath':
                 return Expr::method('getParameterValue', DiscoveryUrlGenerator::PATH_PARAMETER, $expr->getExpression());
         }
     }
     return $expr;
 }
All Usage Examples Of Webmozart\Expression\Expr::endsWith