# responsive-menu/3.0.17/src/app/ViewModels/Components/ComponentFactory.php

Responsive Menu – Create Mobile-Friendly Menu, version 3.0.17. 22 lines.

- Page: https://pluginprobe.com/plugins/responsive-menu/3.0.17/code/src/app/ViewModels/Components/ComponentFactory.php
- Raw: https://pluginprobe.com/plugins/responsive-menu/3.0.17/raw/src/app/ViewModels/Components/ComponentFactory.php
- Modified: 2016-08-20T23:47:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/responsive-menu/3.0.17/code/src/app/ViewModels/Components/ComponentFactory.php#L10-L20`.

```php
<?php

namespace ResponsiveMenu\ViewModels\Components;
use ResponsiveMenu\Translation\Translator;

class ComponentFactory {

  public function build($key) {

    $components = [
      'title' => 'ResponsiveMenu\ViewModels\Components\Menu\Title',
      'menu' => 'ResponsiveMenu\ViewModels\Components\Menu\Menu',
      'search' => 'ResponsiveMenu\ViewModels\Components\Menu\Search',
      'additional content' => 'ResponsiveMenu\ViewModels\Components\Menu\AdditionalContent'
    ];

    return new $components[$key](new Translator);

  }

}

```
