Skip to content

Commit 6b1dfe6

Browse files
committed
Merge branch 'release/0.3.4'
2 parents 008ce8a + 5f7c74b commit 6b1dfe6

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ use Noname\Common\Validator;
153153

154154
$values = ['a' => 2];
155155
$rules = ['a' => ['type' => 'equals_2']];
156-
$validator = new Validator();
156+
$validator = new Validator($values, $rules);
157157
$validator->addType('equals_2', [
158158
'extends' => 'numeric',
159159
'validator' => function ($value, $rule, $validator) {
@@ -250,6 +250,10 @@ A helper library for working with arrays.
250250

251251
#### Arr Methods
252252

253-
##### `Arr::flatten(array $array, string $separator = '.', string $prepend = '') : array`
253+
##### `static flatten(array $array, string $separator = '.', string $prepend = '') : array`
254254

255-
Flatten an associative array using a custom separator.
255+
Flatten an associative array using a custom separator.
256+
257+
##### `static dot(array $array) : array`
258+
259+
Flatten an associative array using a dot (.) separator.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nonamephp/php7-common",
33
"description": "A collection of common PHP 7 libraries",
4-
"version": "0.3.3",
4+
"version": "0.3.4",
55
"license": "MIT",
66
"authors": [
77
{

src/Arr.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,15 @@ public static function flatten(array $array, string $separator = '.', string $pr
3232

3333
return $flatArray;
3434
}
35+
36+
/**
37+
* Flatten an associative array using a dot (.) separator.
38+
*
39+
* @param array $array
40+
* @return array
41+
*/
42+
public static function dot(array $array): array
43+
{
44+
return self::flatten($array);
45+
}
3546
}

0 commit comments

Comments
 (0)