Имя метода из переменной в ООП в PHP

По аналогии с названиями свойств в переменной также можно хранить и имена методов. Давайте посмотрим на примере. Пусть у нас дан вот такой класс User с геттерами свойств:

php<?php
  class User
  {
    private $name;
    private $surn;
    
    public function __construct($name, $surn)
    {
      $this->name = $name;
      $this->surn = $surn;
    }
    
    public function getName()
    {
      return $this->name;
    }
    
    public function getSurn()
    {
      return $this->surn;
    }
  }
?>

Создадим объект этого класса:

php<?php
  $user = new User('john', 'smit');
?>

Пусть в переменной хранится имя метода:

php<?php
  $method = 'getName';
?>

Давайте вызовем метод с именем из переменной:

php<?php
  echo $user->$method(); // выведет 'john'
?>
Задание 1

Дан следующий класс:

php<?php
  class Employee
  {
    private $name;
    private $salary;
    private $position;
    
    public function __construct($name, $salary, $position)
    {
      $this->name = $name;
      $this->salary = $salary;
      $this->position = $position;
    }
    
    public function getName()
    {
      return $this->name;
    }
    
    public function getSalary()
    {
      return $this->salary;
    }
    
    public function getPosition()
    {
      return $this->position;
    }
  }
?>

Дан массив:

php<?php
  $methods = [
    'method1' => 'getName',
    'method2' => 'getSalary',
    'method3' => 'getPosition',
  ];
?>

Создайте объект класса Employee, а затем обратитесь к его свойствам через элементы массива.