scriptfusion / mapper Goto Github PK
View Code? Open in Web Editor NEW:earth_africa: Transforms arrays using an object composition DSL.
License: GNU Lesser General Public License v3.0
:earth_africa: Transforms arrays using an object composition DSL.
License: GNU Lesser General Public License v3.0
CollectionMapper
is currently undocumented in the readme.
The advanced mapping example needs to be rewritten to better demonstrate the usefulness of Mapper. The current example relies too heavily on the Callback
strategy, which should seldom be used. Construct a better example utilising other strategies.
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.
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.
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.