GithubHelp home page GithubHelp logo

scriptfusion / mapper Goto Github PK

View Code? Open in Web Editor NEW
84.0 5.0 3.0 170 KB

:earth_africa: Transforms arrays using an object composition DSL.

License: GNU Lesser General Public License v3.0

PHP 100.00%
convert-data data-mapping data-transform dsl composition mapper php-development

mapper's People

Contributors

a-barzanti avatar bilge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mapper's Issues

CollectionMapper requires Mapping instead of expression

The method signature for CollectionMapper::mapCollection currently reads as follows.

public function mapCollection(\Iterator $collection, Mapping $mapping = null, $context = null)

This is unnecessarily restrictive because it requires a Mapping when any valid expression should suffice. It is proposed this signature be changed to the following.

/**
 * @param Strategy|Mapping|array|mixed $expression Expression.
 */
public function mapCollection(\Iterator $collection, $expression = null, $context = null)

Unfortunately this would be a BC-breaking change because of PHP's type invariance so it should target version 2.0.0.

Merge KeyAware into MapperAware

When Mapper delegates to a strategy it places the burden on that strategy to propagate the key, which it does by invoking Mapper again with the key it received. If a strategy implements MapperAware but not KeyAware it will drop the key information, which is never desirable. Therefore, any strategy electing to be MapperAware should also accept the burden of being KeyAware, assuming we want to continue passing keys around in this fashion.

The reason they have been created as separate interfaces at this time is just to avoid breaking compatibility for code that currently implements MapperAware. In the next major version we should seek to either merge both interfaces into one or find a better way to propagate keys through the mapper altogether.

Hard to extend ScriptFUSION\Mapper\Mapping

I'm trying to extend Mapping so that I can implement a reverse functionality, but the $mapping property is declared as private, which makes fully extending that class almost impossible. Could you please change private to protected so that child classes can change $mapping as they need?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.