ObjectCreatorService::createObjectFromInterface()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 1/30/18
7
 * Time: 6:26 PM
8
 */
9
10
namespace Tfboe\FmLib\Service;
11
12
/**
13
 * Class ObjectCreatorService
14
 * @package Tfboe\FmLib\Service
15
 */
16
class ObjectCreatorService implements ObjectCreatorServiceInterface
17
{
18
19
//<editor-fold desc="Public Methods">
20
  /**
21
   * @inheritDoc
22
   * @param array|null config used config array, if null config('fm-lib') is used. Mainly used for testing purposes
23
   */
24
  public function createObjectFromInterface(string $interface, $args = [], $config = null)
25
  {
26
    $class = ($config == null ? config('fm-lib') : $config)['entityMaps'][$interface];
27
    return new $class(...$args);
28
  }
29
//</editor-fold desc="Public Methods">
30
31
}