class test{
public $table;
public function table(string $table)
{
$this->table = $table;
return $this;
}
public function delete()
{
echo $this->table;
}
}
$db = new test;
$db->table('users')->delete(); // users
test::table('users')->delete();
class Test
{
private $tableName;
public function __construct($tableName)
{
$this->tableName = $tableName;
}
public static function table($tableName)
{
return new self($tableName);
}
public function delete()
{
// do something
}
}