Webmozart\Expression\Expr::startsWith PHP Method

startsWith() public static method

Check that a value starts with a given string.
public static startsWith ( string $prefix ) : StartsWith
$prefix string The prefix string.
return Webmozart\Expression\Constraint\StartsWith The created expression.
    public static function startsWith($prefix)
    {
        return new StartsWith($prefix);
    }

Usage Example

 public function testBuildExpressionWithCustomCriteria()
 {
     $expr1 = Expr::startsWith('abcd', AssetMapping::UUID)->orSame('local', AssetMapping::SERVER_NAME)->orX(Expr::same('/path', AssetMapping::GLOB)->andSame('css', AssetMapping::SERVER_PATH));
     $expr2 = Expr::same(BindingState::ENABLED, BindingDescriptor::STATE)->andSame(DiscoveryUrlGenerator::BINDING_TYPE, BindingDescriptor::TYPE_NAME)->andEndsWith('{,/**/*}', BindingDescriptor::QUERY)->andX(Expr::startsWith('abcd', BindingDescriptor::UUID)->orKey(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::SERVER_PARAMETER, Expr::same('local')))->orX(Expr::same('/path{,/**/*}', BindingDescriptor::QUERY)->andKey(BindingDescriptor::PARAMETER_VALUES, Expr::key(DiscoveryUrlGenerator::PATH_PARAMETER, Expr::same('css')))));
     $this->assertEquals($expr2, $this->builder->buildExpression($expr1));
 }
All Usage Examples Of Webmozart\Expression\Expr::startsWith