Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Allow dispatch to handle class methods

#53

It would be a great improvement to allow dispatch to accept class methods other than functions, like:

class Admin
{
    public static function new_post()
    {
    } 
}

dispatch('/admin/new/post'/, 'Admin.new_post');

Reported by Gustavo Di Pietro · April 4th, 2011 @ 11:30 AM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. xangelo (at gmail)
    xangelo (at gmail)

    I would think this poses a limitation that is too strict. Anything added through this system would require that you need to have that feature as a static function. Why not just create the function Admin_new_post() which allows you to prepare the Admin() object as necessary before calling Admin->post()?

    To me, this is something that I would regard more as a convenience method as opposed to something that adds any real functionality to Limonade-php

    April 4th, 2011 @ 10:44 PM

  2. xangelo (at gmail)
    xangelo (at gmail)

    I stand corrected:

    # Static class method call, MyClass::hello();
    dispatch('/hello', array('MyClass', 'hello'));
    
    # Object method call, $obj->hello();
    dispatch('/hello', array($obj, 'hello'));
    
    # Static class method call (As of PHP 5.2.3), MyClass::hello();
    dispatch('/hello', 'MyClass::hello');
    

    April 5th, 2011 @ 05:00 PM

  3. Fabrice Luraine
    Fabrice Luraine
    • State changed from new to invalid

    dispatch methods handle a pseudo-type callback. It can be a function, an object method, a static method or a closure. See php documentation to learn more about callbacks.

    May 27th, 2011 @ 07:01 AM

  4. JuanCena
    JuanCena

    I don't have an idea about this coding, the only codes I know are HTML and BBCodes. I used these codes when commenting in other blog sites or forum sites. I want to learn Python Programming language because most of the popular websites today like YouTube, Amazon, Spotify, Google, Instagram, Netflix, Uber, Dropbox, Pinterest, and many more are made using Python. I know that this Among Us game was created using Python.
    https://among-us.io/

    September 28th, 2020 @ 12:44 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.