Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nilportugues/api-transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Aug 28, 2015
2 parents 5a33288 + 98b023f commit e52a4b2
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ php:
- "hhvm"

before_script:
- composer install --dev

script: ./bin/phpunit --coverage-text
- composer install

script:
- bin/phpunit --coverage-text

matrix:
allow_failures:
Expand Down
73 changes: 70 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

[![Build Status]
(https://travis-ci.org/nilportugues/api-transformer.svg)]
(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]
(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]
(https://scrutinizer-ci.com/g/nilportugues/api-transformer/badges/quality-score.png?b=master)]
(https://scrutinizer-ci.com/g/nilportugues/api-transformer/?branch=master) [![SensioLabsInsight]
(https://insight.sensiolabs.com/projects/b4e5056d-c552-407e-ae21-2da685e07c06/mini.png)]
Expand All @@ -15,3 +13,72 @@
(https://packagist.org/packages/nilportugues/api-transformer) [![License]
(https://poser.pugx.org/nilportugues/api-transformer/license)]
(https://packagist.org/packages/nilportugues/api-transformer)

## Purpose
This library provides the core functionality for API transformation. As a base library, by itself it's not usable at all.

## Used by

Currently the following transformers make use of this library as foundation:

- [nilportugues/json](https://github.com/nilportugues/json-transformer)
- [nilportugues/jsend](https://github.com/nilportugues/jsend-transformer)
- [nilportugues/haljson](https://github.com/nilportugues/hal-json-transformer)
- [nilportugues/json-api](https://github.com/nilportugues/jsonapi-transformer)


## Quality

To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.

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/).

If you notice compliance oversights, please send a patch via pull request.


## Installation

Use [Composer](https://getcomposer.org) to install the package:

```json
$ composer require nilportugues/api-transformer
```


## Quality

To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.

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/).

If you notice compliance oversights, please send a patch via [Pull Request](https://github.com/nilportugues/api-transformer/pulls).



## Contribute

Contributions to the package are always welcome!

* Report any bugs or issues you find on the [issue tracker](https://github.com/nilportugues/api-transformer/issues/new).
* You can grab the source code at the package's [Git repository](https://github.com/nilportugues/api-transformer).



## Support

Get in touch with me using one of the following means:

- Emailing me at <[email protected]>
- Opening an [Issue](https://github.com/nilportugues/api-transformer/issues/new)
- 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)



## Authors

* [Nil Portugués Calderó](http://nilportugues.com)
* [The Community Contributors](https://github.com/nilportugues/api-transformer/graphs/contributors)


## License
The code base is licensed under the [MIT license](LICENSE).
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
],
"require": {
"php": ">=5.5.0",
"nilportugues/serializer": "dev-master",
"nilportugues/serializer": "~1.1",
"psr/http-message": "~1.0",
"zendframework/zend-diactoros": "^1.1.0"
},
"require-dev": {
"phpunit/phpunit": "4.4.*",
"fabpot/php-cs-fixer": "^1.9",
"mmoreram/php-formatter": "dev-master"
"mmoreram/php-formatter": "dev-master",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions src/Mapping/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mapper
*
* @throws MappingException
*/
public function __construct(array &$mappings = null)
public function __construct(array $mappings = null)
{
if (is_array($mappings)) {
foreach ($mappings as $mappedClass) {
Expand All @@ -41,8 +41,8 @@ public function __construct(array &$mappings = null)
);
}

$this->classMap[$mapping->getClassName()] = $mapping;
$this->aliasMap[$mapping->getClassAlias()] = $mapping->getClassName();
$this->classMap[ltrim($mapping->getClassName(), "\\")] = $mapping;
$this->aliasMap[ltrim($mapping->getClassAlias(), "\\")] = $mapping->getClassName();
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/Mapping/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

class Mapping
{
/**
* @var string
*/
private $className = '';
/**
* @var string
*/
private $resourceUrlPattern = '';
/**
* @var string
*/
Expand Down

0 comments on commit e52a4b2

Please sign in to comment.