GithubHelp home page GithubHelp logo

Comments (7)

simensen avatar simensen commented on July 24, 2024

How would having an all method that did the same thing as fromRequest and fromResponse make it easier to use from a container? I think I'm probably misunderstanding something about how you'd like to see it used.

Right now the easiest way to use this would be to not use them from a container at all as the facade classes are meant to just be used directly (static methods) as the classes don't make sense outside of the context of having a request or response to begin w/.

Perhaps if you could tell me more about your use case / how you would like to use it / how it currently isn't able to do what you'd like I'd be able to better figure out a solution that would make your life easier.

Thanks for the feedback!

from dflydev-fig-cookies.

designermonkey avatar designermonkey commented on July 24, 2024

I'm using Slim PHP 3 and trying to come up with a cookies implementation that will have to be stored inside the container. Using static classes like this in a DI app is bad practice (not preaching to you by any means).

As it currently is, I would have request-cookies and response-cookies in the container which return instances of the classes I mention. Then they can be used in object context, not static which fits the design principal at work with Slim.

The only thing missing is the ability to get a package of all the current cookies from the headers in that object context, without making a wrapper class.

from dflydev-fig-cookies.

simensen avatar simensen commented on July 24, 2024

I see! So the two things you mentioned were completely separate. 1) You like it but it is awkward to use w/ a container and 2) You want an all method so you can get all of Cookies or SetCookies. Is that correct?

I'd not be opposed to adding some sort of all method to get all of the Cookies and SetCookies from a request or response. If you want to add it / prototype it and send a PR I'd happily take a look.

I'd probably go w/ getAll as that maps better with what is inside Cookies and SetCookies since both of those classes already have a getAll method.

from dflydev-fig-cookies.

designermonkey avatar designermonkey commented on July 24, 2024

I hadn't realised that the whole thing was static methods when I wrote the original issue, sorry.

from dflydev-fig-cookies.

simensen avatar simensen commented on July 24, 2024

Is ok. :) If you'd still like to add a getAll method for the outermost facades that would be awesome. I think it would be very useful. :) I don't think I'll take it away from being static methods, though.

And to be fair, I think the primitives (Cookie and SetCookie) themselves are not entirely static but they are entirely immutable so the mutators return new copies of the objects rather than modifying the object itself (much like PSR-7). That still won't help you much, though. :)

from dflydev-fig-cookies.

designermonkey avatar designermonkey commented on July 24, 2024

entirely immutable

which is why I like this :D

When I get a spare minute or few, I'll put something together. Thanks.

from dflydev-fig-cookies.

simensen avatar simensen commented on July 24, 2024

Thanks again for the issue. I'm closing this for now as I think that it was resolved (or as resolved as it was going to get) already?

from dflydev-fig-cookies.

Related Issues (20)

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.