GithubHelp home page GithubHelp logo

arraypath's People

Contributors

darkspider avatar mathiasgrimm avatar rdohms avatar thotty 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

Watchers

 avatar  avatar  avatar  avatar

arraypath's Issues

Change api to enforce parameters consistency

should always be consistently
($array, $index, $value, $dafault)

if one argument does not exist, the order should be shifted, excluding the option that does not exist
therefore
A::get($array, 'a/b/c', 'default value');
or
A::set($array, 'a/b/c', $value);

etc...

Add method to register class alias

class ArrayPath
{
public static function registerAlias($alias = 'A')
{
class_alias('MathiasGrimm\ArrayPath', $alias);
}
}

then one could just do this:

ArrayPath::registerAlias();
and then
A::get('a/b/c', $data);
A::set($value, 'a/b/c', $data);

Static approach makes this class unmockable

Hey there,

I found that you class seems to be unmockable for PHPUnit, because all its calls are static and the state is saved staticalled, too.

I could imagine, why you would have chosen this approach, but it hinders us from mocking it away.

Do you see a way of combining a 'correct' stateful approach with your easy accessible static one? Maybe with the singleton pattern for example?
With this approach there would be almost to none changes to your existing public api, because you could hide the instanciating process in your class.
Or maybe something else, like a new major with a compatibility break?

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.