#53 ✓invalid
Gustavo Di Pietro

Allow dispatch to handle class methods

Reported by Gustavo Di Pietro | 2011-04-04 11:30:52 UTC

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');

Comments and changes to this ticket

  • xangelo (at gmail)

    xangelo (at gmail) 2011-04-04 22:44:12 UTC

    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

  • xangelo (at gmail)

    xangelo (at gmail) 2011-04-05 17:00:13 UTC

    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');
    
  • Fabrice Luraine

    Fabrice Luraine 2011-05-27 07:01:00 UTC

    • 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.

  • JuanCena

    JuanCena 2020-09-28 12:44:41 UTC

    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/

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.

New ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Limonade is a PHP micro-framework.

People watching this ticket

Pages