Skip to content

Commit 767efcc

Browse files
author
Fredrick Peter
committed
Helpers Update
1 parent ae94e0f commit 767efcc

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
## Requirements
5252

53-
- `>= php5.3.3+`
53+
- `>= php7.2+`
5454

5555
## Installation
5656

@@ -59,7 +59,7 @@ Prior to installing `ultimate-uploader` get the [Composer](https://getcomposer.o
5959
**Step 1** — update your `composer.json`:
6060
```composer.json
6161
"require": {
62-
"peterson/php-form-validator": "^3.3.0"
62+
"peterson/php-form-validator": "^3.3.1"
6363
}
6464
```
6565

@@ -116,12 +116,12 @@ public function save(Request $request){
116116
```
117117

118118
## Methods That Should Always Come First
119-
- These methods are mandatory and should always come first before any others.
120-
- All are Optional `method`
119+
- All are Optional `method`
120+
- These methods are only mandatory on usage and should always come first before others.
121121

122122
| Methods | Description |
123123
|----------|-------------------------------|
124-
| ->et() | The method takes a `bool` parameter to decide how errors are displayed: `single or multiple` |
124+
| ->et() | Takes param as `bool` to format error's on display: `single or multiple` |
125125
| ->post() | No param needed. SET `form` request to `POST` only |
126126
| ->get() | No param needed. SET `form` request to `GET` only |
127127

@@ -138,9 +138,9 @@ $form->post()->submit([
138138

139139
| Array Keys | Description |
140140
|-------------|-----------------------------------------|
141-
| request | String `POST/|GET/|ALL` Default `POST` |
142-
| error_type | Boolean `true/|false` Default `false` |
143-
| csrf_token | Boolean `true/|false` Default `true` |
141+
| request | String `POST\|GET\|ALL` Default `POST` |
142+
| error_type | Boolean `true\|false` Default `false` |
143+
| csrf_token | Boolean `true\|false` Default `true` |
144144

145145
```
146146
Config_opForm([
@@ -223,7 +223,7 @@ $form->get()->submit([
223223
```
224224

225225
### All
226-
- Same as `POST/|GET`
226+
- Same as `POST\|GET`
227227
- This will set the Form Request using `$_SERVER['REQUEST_METHOD']`
228228

229229
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.0"
19+
"php": ">=7.2"
2020
},
2121
"autoload": {
2222
"files": [
@@ -34,7 +34,7 @@
3434
},
3535
"extra": {
3636
"branch-alias": {
37-
"dev-main": "3.3.0-dev"
37+
"dev-main": "3.3.1-dev"
3838
}
3939
},
4040
"minimum-stability": "stable",

src/helpers.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ function request(?string $key = null)
5050
function Config_opForm(?array $option = [])
5151
{
5252
$default = [
53-
'error_type' => $option['error_type'] && is_bool($option['error_type']) ?? false,
54-
'csrf_token' => $option['csrf_token'] && is_bool($option['csrf_token']) ?? true,
55-
'request' => $option['request'] ?? 'POST',
53+
'error_type' => $option['error_type'] ?? false,
54+
'csrf_token' => $option['csrf_token'] ?? true,
55+
'request' => $option['request'] ?? 'POST',
5656
];
5757

58+
// check if is boolean values
59+
$default['error_type'] = is_bool($default['error_type']) ? $default['error_type'] : false;
60+
$default['csrf_token'] = is_bool($default['csrf_token']) ? $default['csrf_token'] : true;
61+
5862
// Error type
5963
if(!defined('GLOBAL_OPFORM_ERROR')){
6064
define('GLOBAL_OPFORM_ERROR', $default['error_type']);

0 commit comments

Comments
 (0)