hamid reza
hamid reza

Reputation: 33

What is the meaning of php phrase?

I study Laravel framework source code. I reach the following command.

class Application extends Container implements ApplicationContract, HttpKernelInterface
{


    public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true)
    {
        return $this[HttpKernelContract::class]->handle(Request::createFromBase($request));
    }


}

So, I need to know the meaning of $this[MyClass:class]->someMethod() phrase in php syntax.

Is $this array?! How?

Thanks

Upvotes: 3

Views: 267

Answers (1)

tkausl
tkausl

Reputation: 14279

The class Application extends Container which itself implements ArrayAccess, so $this[HttpKernelContract::class] essentially calls $this->offsetGet(HttpKernelContract::class) which should be implemented in Container.

Upvotes: 3

Related Questions