Skip to content

Commit e52a4b2

Browse files
committed
Merge branch 'master' of github.com:nilportugues/api-transformer
2 parents 5a33288 + 98b023f commit e52a4b2

File tree

5 files changed

+88
-11
lines changed

5 files changed

+88
-11
lines changed

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ php:
66
- "hhvm"
77

88
before_script:
9-
- composer install --dev
10-
11-
script: ./bin/phpunit --coverage-text
9+
- composer install
10+
11+
script:
12+
- bin/phpunit --coverage-text
1213

1314
matrix:
1415
allow_failures:

README.md

+70-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
[![Build Status]
44
(https://travis-ci.org/nilportugues/api-transformer.svg)]
5-
(https://travis-ci.org/nilportugues/api-transformer) [![Coverage Status]
6-
(https://coveralls.io/repos/nilportugues/api-transformer/badge.svg?branch=master&service=github)]
7-
(https://coveralls.io/github/nilportugues/api-transformer?branch=master) [![Scrutinizer Code Quality]
5+
(https://travis-ci.org/nilportugues/api-transformer) [![Coverage Status](https://coveralls.io/repos/nilportugues/api-transformer/badge.svg?branch=master&service=github)](https://coveralls.io/github/nilportugues/api-transformer?branch=master) [![Scrutinizer Code Quality]
86
(https://scrutinizer-ci.com/g/nilportugues/api-transformer/badges/quality-score.png?b=master)]
97
(https://scrutinizer-ci.com/g/nilportugues/api-transformer/?branch=master) [![SensioLabsInsight]
108
(https://insight.sensiolabs.com/projects/b4e5056d-c552-407e-ae21-2da685e07c06/mini.png)]
@@ -15,3 +13,72 @@
1513
(https://packagist.org/packages/nilportugues/api-transformer) [![License]
1614
(https://poser.pugx.org/nilportugues/api-transformer/license)]
1715
(https://packagist.org/packages/nilportugues/api-transformer)
16+
17+
## Purpose
18+
This library provides the core functionality for API transformation. As a base library, by itself it's not usable at all.
19+
20+
## Used by
21+
22+
Currently the following transformers make use of this library as foundation:
23+
24+
- [nilportugues/json](https://github.com/nilportugues/json-transformer)
25+
- [nilportugues/jsend](https://github.com/nilportugues/jsend-transformer)
26+
- [nilportugues/haljson](https://github.com/nilportugues/hal-json-transformer)
27+
- [nilportugues/json-api](https://github.com/nilportugues/jsonapi-transformer)
28+
29+
30+
## Quality
31+
32+
To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.
33+
34+
This library attempts to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), [PSR-4](http://www.php-fig.org/psr/psr-4/) and [PSR-7](http://www.php-fig.org/psr/psr-7/).
35+
36+
If you notice compliance oversights, please send a patch via pull request.
37+
38+
39+
## Installation
40+
41+
Use [Composer](https://getcomposer.org) to install the package:
42+
43+
```json
44+
$ composer require nilportugues/api-transformer
45+
```
46+
47+
48+
## Quality
49+
50+
To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.
51+
52+
This library attempts to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), [PSR-4](http://www.php-fig.org/psr/psr-4/) and [PSR-7](http://www.php-fig.org/psr/psr-7/).
53+
54+
If you notice compliance oversights, please send a patch via [Pull Request](https://github.com/nilportugues/api-transformer/pulls).
55+
56+
57+
58+
## Contribute
59+
60+
Contributions to the package are always welcome!
61+
62+
* Report any bugs or issues you find on the [issue tracker](https://github.com/nilportugues/api-transformer/issues/new).
63+
* You can grab the source code at the package's [Git repository](https://github.com/nilportugues/api-transformer).
64+
65+
66+
67+
## Support
68+
69+
Get in touch with me using one of the following means:
70+
71+
- Emailing me at <[email protected]>
72+
- Opening an [Issue](https://github.com/nilportugues/api-transformer/issues/new)
73+
- Using Gitter: [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nilportugues/api-transformer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
74+
75+
76+
77+
## Authors
78+
79+
* [Nil Portugués Calderó](http://nilportugues.com)
80+
* [The Community Contributors](https://github.com/nilportugues/api-transformer/graphs/contributors)
81+
82+
83+
## License
84+
The code base is licensed under the [MIT license](LICENSE).

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
],
1515
"require": {
1616
"php": ">=5.5.0",
17-
"nilportugues/serializer": "dev-master",
17+
"nilportugues/serializer": "~1.1",
1818
"psr/http-message": "~1.0",
1919
"zendframework/zend-diactoros": "^1.1.0"
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "4.4.*",
2323
"fabpot/php-cs-fixer": "^1.9",
24-
"mmoreram/php-formatter": "dev-master"
24+
"mmoreram/php-formatter": "dev-master",
25+
"satooshi/php-coveralls": "dev-master"
2526
},
2627
"autoload": {
2728
"psr-4": {

src/Mapping/Mapper.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Mapper
2929
*
3030
* @throws MappingException
3131
*/
32-
public function __construct(array &$mappings = null)
32+
public function __construct(array $mappings = null)
3333
{
3434
if (is_array($mappings)) {
3535
foreach ($mappings as $mappedClass) {
@@ -41,8 +41,8 @@ public function __construct(array &$mappings = null)
4141
);
4242
}
4343

44-
$this->classMap[$mapping->getClassName()] = $mapping;
45-
$this->aliasMap[$mapping->getClassAlias()] = $mapping->getClassName();
44+
$this->classMap[ltrim($mapping->getClassName(), "\\")] = $mapping;
45+
$this->aliasMap[ltrim($mapping->getClassAlias(), "\\")] = $mapping->getClassName();
4646
}
4747
}
4848
}

src/Mapping/Mapping.php

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
class Mapping
88
{
9+
/**
10+
* @var string
11+
*/
12+
private $className = '';
13+
/**
14+
* @var string
15+
*/
16+
private $resourceUrlPattern = '';
917
/**
1018
* @var string
1119
*/

0 commit comments

Comments
 (0)