Skip to content

Commit 48f3155

Browse files
authored
Merge pull request #161 from contentful/fix/PHP-137-regex-validation-issue
Prohibit regexp validations
2 parents b8f6bcb + f3f6c17 commit 48f3155

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the contentful/contentful-management package.
5+
*
6+
* @copyright 2015-2020 Contentful GmbH
7+
* @license MIT
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace Contentful\Management\Mapper\ContentType\Validation;
13+
14+
use Contentful\Management\Mapper\BaseMapper;
15+
use Contentful\Management\Resource\ContentType\Validation\RegexpValidation as ResourceClass;
16+
17+
/**
18+
RegexpValidation class.
19+
*/
20+
class ProhibitRegexpValidation extends BaseMapper
21+
{
22+
/**
23+
{@inheritdoc}
24+
*/
25+
public function map($resource, array $data): ResourceClass
26+
{
27+
return new ResourceClass(
28+
$data['prohibitRegexp']['pattern'] ?? null,
29+
$data['prohibitRegexp']['flags'] ?? null
30+
);
31+
}
32+
}

0 commit comments

Comments
 (0)