Skip to content

Commit

Permalink
[*]: Release version 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
microThread committed Dec 30, 2018
1 parent 234c862 commit 6fa2860
Show file tree
Hide file tree
Showing 7 changed files with 472 additions and 198 deletions.
39 changes: 35 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
/tests export-ignore
# Autodetect text files
* text=auto


# ...Unless the name matches the following overriding patterns

# Definitively text files
*.php text
*.css text
*.js text
*.txt text
*.md text
*.xml text
*.json text
*.bat text
*.sql text
*.yml text


# Ensure those won't be messed up with
*.png binary
*.jpg binary
*.gif binary
*.ttf binary


# Ignore some meta files when creating an archive of this repository
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml export-ignore
/phpcs.xml export-ignore
/phpmd.xml export-ignore
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/phpunit.xml.dist export-ignore
/phpcs.xml.dist export-ignore
/phpmd.xml.dist export-ignore


# Avoid merge conflicts in CHANGELOG
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
/CHANGELOG.md merge=union
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
DotArray Change Log
=====================

1.0.4 December 30, 2018
-----------------------------

- Refactoring DotArray:
- Using a Trait (DotPathTrait) to split code in more organized units.
- Refactor DotArray::mergeRecursive :: less `if ... else` branches.
- Refactor DotArray::normalize :: now is recursive and if type of the entry is DotArray then is converted to array.
- Apply DotArray::normalize after every DotArray::write used when DotArray::set is called.
- Fix composer.json `create-folders` script :: in case of fail creating the `build` folder, exit with code 0.
- Updating README.md
- Updating Tests

1.0.3 December 28, 2018
-----------------------------

Expand Down
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ DotArray::create(['config' => ['some.dotted.key' => 'value']])->get('config.{som
$dot['books.{sci-fi & fantasy}'] = [];
```
- **merge**:
- ```php
// Example 1.
$dot->merge(['key_1' => ['some_key' => 'some_value']]);
// Example 2.
$dot->merge(
[
'key_1' => ['some_key' => 'some_value'],
],
[
'key_2' => ['some_key' => 'some_value'],
],
[
'key_n' => ['some_key' => 'some_value']
],
);
```
- **delete** *(unset(...))*:
- ```php
$dot->delete('books.{sci-fi & fantasy}');
Expand Down Expand Up @@ -213,6 +232,58 @@ DotArray::create(['config' => ['some.dotted.key' => 'value']])->get('config.{som
});
```
- **toArray**:
- ```php
// Getting the internal raw array.
// Example 1.
$dot->toArray();
// Example 2.
$dot->get('books.{sci-fi & fantasy}')->toArray();
```
- **toJson**:
- ```php
// Getting the internal raw array as JSON.

// Example 1.
$dot->toJson();

// Example 2.
$dot->get('books.{sci-fi & fantasy}')->toJson();
```
- **toFlat**:
- ```php
$dot = DotArray::create(
[
'a' => [
'b' => 'value',
],

'b' => [
1,
2,
3,
],
]
);

$dot->toFlat();

/*
The output will be an array:

[
'{{a}}.{{b}}' => 'value',
'{{b}}.{{0}}' => 1,
'{{b}}.{{1}}' => 2,
'{{b}}.{{2}}' => 3,
],
*/
```
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
],

"create-folders": [
"mkdir build"
"[ ! -d build ] && mkdir -p build || exit 0;"
],

"cs-check": "phpcs",
Expand All @@ -95,5 +95,8 @@
"tests-report-html": "phpunit --coverage-html build/phpunit/coverage/html || exit 0;",
"tests-report-xml": "phpunit --coverage-xml build/phpunit/coverage/xml || exit 0;",
"tests-report-clover": "phpunit --coverage-clover build/phpunit/coverage/clover/index.xml || exit 0;"
},

"scripts-descriptions": {
}
}
Loading

0 comments on commit 6fa2860

Please sign in to comment.