title: Choose method depending on configurations array
body: <p>So I have the following import records method (<strong>I've removed the unneeded parts from the method</strong>):</p>
  
  <pre><code>private function import_records(array $config = []): array
  {
      // Loop through all Octopus records
      foreach ($result-&gt;data as $record) {
          if ($config['settings_key'] === 'import_profiles') {
              $this-&gt;sync_profile($record);
          } else if ($config['settings_key'] === 'import_offices') {
              $this-&gt;sync_office($record);
          }
      }
  
      return $config;
  }
  </code></pre>
  
  <p>Then I'm calling it as such:</p>
  
  <pre><code>public function import_offices(): array
  {
      return $this-&gt;import_records([
          'settings_key' =&gt; 'import_offices',
          'path' =&gt; 'offices',
      ]);
  }
  </code></pre>
  
  <p>Is there a cleaner way to call the <code>sync_profile</code> and <code>sync_office</code> methods in the if statement, than having to hardcode the <code>$config['settings_key'] === 'string'</code>?</p>