Skip to content

Commit 1cde16b

Browse files
committed
Merge pull request #6 from sagikazarmark/improvements
Improvements
2 parents bbf3e49 + fede2d3 commit 1cde16b

File tree

9 files changed

+89
-23
lines changed

9 files changed

+89
-23
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
spec/ export-ignore
2+
.editorconfig export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.travis.yml export-ignore
6+
phpspec.yml.dist export-ignore

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
vendor
1+
build/
2+
vendor/
23
composer.lock
4+
phpspec.yml

.travis.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
language: php
22

3+
sudo: false
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
8+
39
php:
410
- 5.3
511
- 5.4
612
- 5.5
713
- 5.6
14+
- 7.0
815
- hhvm
916

10-
before_script:
11-
- "composer require --dev phpspec/phpspec:~2.0.0-RC4 --no-update"
12-
- "composer install --no-progress --no-plugins"
17+
env:
18+
global:
19+
- TEST_COMMAND="composer test"
20+
21+
matrix:
22+
fast_finish: true
23+
include:
24+
- php: 5.3
25+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
26+
27+
before_install:
28+
- travis_retry composer self-update
29+
30+
install:
31+
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
1332

1433
script:
15-
- php vendor/bin/phpspec run
34+
- $TEST_COMMAND

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Change Log
2+
3+
4+
## Unreleased
5+
6+
### Changed
7+
8+
- AggregateNormalizer now implements `Symfony\Component\Serializer\SerializerAwareInterface`
9+
10+
11+
## 1.0.0 - 2014-03-25
12+
13+
- Initial release

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Bernard
3+
Copyright (c) 2014-2016 Bernard Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ Normalt
33

44
[![Build Status](https://travis-ci.org/bernardphp/normalt.png?branch=master)](https://travis-ci.org/bernardphp/normalt)
55

6-
Normalt contains additional normalizer's for use with the serializer component found in Symfony. It also
6+
Normalt contains additional normalizers for use with the serializer component found in Symfony. It also
77
implements a normalizer delegator that will look at the data you want normalized and/or denormalized
88
and call the normalizer which supports it.
99

1010
In the context of Normalt normalization is the act of converting an object into an array. Denormalization
1111
is the opposite direction (converting array into an object). This is to my knowledge the same concept
1212
Symfony serializer uses.
1313

14+
1415
Table of Contents
1516
-----------------
1617

@@ -28,14 +29,16 @@ Getting Started
2829
Getting started is as easy as requiring the library with composer.
2930

3031
``` bash
31-
$ composer require bernard/normalt:~0.1
32+
$ composer require bernard/normalt
3233
```
3334

35+
3436
Normalizers
3537
-----------
3638

3739
Theese normalizers can be used with the serializer component directly or through the `AggregateNormalizer`.
3840

41+
3942
### AggregateNormalizer
4043

4144
`AggregateNormalizer` is a delegator and aggregator as it aggregates multiple normalizers and denormalizers
@@ -48,6 +51,7 @@ It implements a subset of the full serializer and its only focus is normalizing
4851
denormalize arrays into objects. This lets you focus on normalization instead of converting
4952
into a specific format such as `xml`, `json` etc.
5053

54+
5155
#### Usage
5256

5357
You need to instantiate the normalizer and the list of normalizer/denormalizers you want to use.
@@ -95,6 +99,7 @@ echo $user->getName(); // outputs Henrik
9599
In contrast to the other normalizers in this package, it does __not__ make sense to use this with the
96100
serializer as the Serializer already does most of the functionality already.
97101

102+
98103
### DoctrineNormalizer
99104

100105
`DoctrineNormalizer` normalizes mapped objects (Entities, Documents etc.) into arrays and back again.
@@ -117,6 +122,7 @@ $array = $normalizer->normalize($user);
117122
$user = $normalizer->denormalize($array, null);
118123
```
119124

125+
120126
### RecursiveReflectionNormalizer
121127

122128
This normalizes also delegates like the `AggregateNormalizer`, but delegates for each property in the object
@@ -144,8 +150,8 @@ $array = $normalizer->normalize($profile);
144150
$profile = $normalize->denormalize($array, 'MyModel\Profile');
145151
```
146152

153+
147154
License
148155
-------
149156

150157
Please refer to the included `LICENSE` file.
151-

composer.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
{
2-
"name" : "bernard/normalt",
3-
"license" : "MIT",
4-
5-
"autoload" : {
6-
"psr-4" : { "Normalt\\" : "src" }
2+
"name": "bernard/normalt",
3+
"description": "Normalt is a extension to Symfony Serializer that only implements the Normalization part",
4+
"keywords": ["normalization", "denormalization"],
5+
"license": "MIT",
6+
"require": {
7+
"symfony/serializer": "^2.3 || ^3.0"
78
},
8-
9-
"autoload-dev" : {
10-
"psr-4" : { "Fixtures\\" : "spec/Fixtures" }
9+
"require-dev": {
10+
"doctrine/common": "^2.1",
11+
"phpspec/phpspec": "^2.5"
1112
},
12-
13-
"require" : {
14-
"symfony/serializer" : "~2.3 || ~3.0"
13+
"autoload": {
14+
"psr-4": { "Normalt\\": "src/" }
1515
},
16-
17-
"require-dev" : {
18-
"doctrine/common" : "~2.1"
16+
"autoload-dev": {
17+
"psr-4": { "Fixtures\\": "spec/Fixtures/" }
18+
},
19+
"scripts": {
20+
"test": "vendor/bin/phpspec"
21+
},
22+
"extra": {
23+
"branch-alias": {
24+
"dev-master": "1.1-dev"
25+
}
1926
}
2027
}

phpspec.yml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
suites:
2+
normalt_suite:
3+
namespace: Normalt
4+
formatter.name: pretty

0 commit comments

Comments
 (0)