notEquals() 공개 정적인 메소드

Check that a value does not equal another value.
public static notEquals ( mixed $value ) : NotEquals
$value mixed The compared value.
리턴 Webmozart\Expression\Constraint\NotEquals The created expression.
 /**
  * {@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;
 }
예제 #2
0
 public function orNotEquals($value)
 {
     return $this->orX(Expr::notEquals($value));
 }
 /**
  * {@inheritdoc}
  */
 public function leaveExpression(Expression $expr)
 {
     if ($expr instanceof Key) {
         switch ($expr->getKey()) {
             case AssetMapping::UUID:
                 return Expr::key(BindingDescriptor::UUID, $expr->getExpression());
             case AssetMapping::GLOB:
                 $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::key(BindingDescriptor::QUERY, $queryExpr);
             case AssetMapping::SERVER_NAME:
                 return Expr::key(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::SERVER_PARAMETER, $expr->getExpression()));
             case AssetMapping::SERVER_PATH:
                 return Expr::key(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::PATH_PARAMETER, $expr->getExpression()));
         }
     }
     return $expr;
 }
 public function testAppendDefaultQuerySuffixForNotEquals()
 {
     $expr1 = Expr::notEquals('/path', AssetMapping::GLOB);
     $expr2 = Expr::same(BindingState::ENABLED, BindingDescriptor::STATE)->andSame(DiscoveryUrlGenerator::BINDING_TYPE, BindingDescriptor::TYPE_NAME)->andEndsWith('{,/**/*}', BindingDescriptor::QUERY)->andNotEquals('/path{,/**/*}', BindingDescriptor::QUERY);
     $this->assertEquals($expr2, $this->builder->buildExpression($expr1));
 }
예제 #5
0
 public function andNotEquals($value)
 {
     return $this->andX(Expr::notEquals($value));
 }