Skip to content

Why code is checking if $this->connectionHandler is_array? #14

@adrianharabula

Description

@adrianharabula

Hello,

I was looking over the following code

if( is_array( $this->connectionHandler ) ) {
$object = $this->connectionHandler[0];
$method = $this->connectionHandler[1];
$object->$method( $socketClient );
}
else {
$function = $this->connectionHandler;
$function( $socketClient );
}

And was asking why is not just

$function = $this->connectionHandler;
$function( $socketClient );

Can you give an example of a connectionHandler passed as an array?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions