thebigk
146
3
General

Static Methods and Method Chaining

Posted 5 months ago by thebigk

I'm trying to achieve following type of chaining ( like Laravel ) -

MyClass::MyStaticMethod($param)->method_one()->method_two();

I'm stuck at step 1 itself. Here's how my class looks like

class MyClass
{
    public static function MyStaticMethod($param)
    {
        // Some Stuff
               
        // return what? , $this or self does not work. 
    }

    public function method_one()
    {
        // Not sure what should be the scope of this method
    }
}

Can someone point me in the right direction?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.