GithubHelp home page GithubHelp logo

Comments (2)

mattsah avatar mattsah commented on July 20, 2024

If you're looking towards method cleanup in general, can I also add that I would like to see fURL as instantiable and able to modify (as it can with the current URL) a particular URL...

I'm not sure how you would go about cleanly maintaining backwards compatibility and not have more confusing methods, but it would be nice if I could create a URL object with any URL I want and use replaceInQueryString() and removeFromQueryString() or equivalents.

from flourish-classes.

mattsah avatar mattsah commented on July 20, 2024

Also, if the plan would be to have parts, might I suggest piggybacking the PHP parse_url constants?

fURL::get('http://www.example.com:8080/whatever/test?q=answer')->parse(PHP_URL_PORT);
fURL::get('http://www.example.com:8080/whatever/test?q=answer')->replaceInQuery('q', 'new_answer');

Similar to fDate() these objects could be immutable, so the methods always return new instances with differing internal states... the __toString() could always return the full URL, calling fURL::get() without a parameter would create an fURL object of the current URL. Idea being, if I pass fURL::get() to a method that takes a string, the __toString() method should be invoked, maintaining some if not all backwards compatibility.

Oh, and lastly, any ORM registered URL columns for validation, etc, could return fURL objects. Could even keep things consistent with a prepare() method, perhaps that could replaced %tokens with values. $url->prepare('%s%d%p/%r?%q') [scheme, domain, port, request, query]

from flourish-classes.

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.