State::__invoke()

Proxy for the current object, called as a function.

Table of Contents
  1. Description
  2. Example

Description

State::__invoke(...$lot): mixed;

This method will be called when a State instance is called as a function. If at least two arguments is supplied, this method will execute State::set(), otherwise this method will execute State::get().

Example

$state = new State(['test' => 1]);

$state('foo'); // Is the same as `State::get('foo')`
$state('foo', 1); // Is the same as `State::set('foo', 1)`
$state(); // Is the same as `State::get()`

State::__invoke()

Proxy for the current object, called as a function.