Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit f401a91

Browse files
committed
Added setStrictMode method
2 parents c0530e4 + a93bb9e commit f401a91

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2121
### Added
2222

2323
- Added parameters with default value to "ValidateService::setCollection" and "ValidateService::setSingle" methods
24+
25+
## 1.2.0 - 2020-03-17
26+
27+
### Added
28+
29+
- Added "ValidateService::setStrictMode" method

src/ValidateService.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ class ValidateService
5656
*/
5757
protected $version;
5858

59+
/**
60+
* Activate the strict mode when checking members names.
61+
*
62+
* @var bool
63+
*/
64+
protected $strict = true;
65+
5966
/**
6067
* The HTTP method of the request
6168
*
@@ -68,16 +75,32 @@ class ValidateService
6875
*
6976
* @param string|null $method The HTTP method of the request
7077
* @param string|null $version The version of the JSON:API specification
78+
* @param bool $strict If true, activate the strict mode when checking members names
7179
*
7280
* @return void
7381
*/
74-
public function __construct(string $method = null, string $version = null)
82+
public function __construct(string $method = null, string $version = null, bool $strict = true)
7583
{
7684
if ($method !== null) {
7785
$this->setMethod($method);
7886
}
7987

8088
$this->version = new VersionService($version);
89+
$this->strict = true;
90+
}
91+
92+
/**
93+
* Set the strict mode
94+
*
95+
* @param bool $strict
96+
*
97+
* @return static
98+
*/
99+
public function setStrictMode(bool $strict)
100+
{
101+
$this->strict = $strict;
102+
103+
return $this;
81104
}
82105

83106
/**

0 commit comments

Comments
 (0)