Code Duplication    Length = 29-33 lines in 2 locations

src/BaseDataMapper.php 1 location

@@ 11-43 (lines=33) @@
8
 * @package Thruster\Component\DataMapper
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
abstract class BaseDataMapper implements DataMapperInterface
12
{
13
    /**
14
     * @var DataMappers
15
     */
16
    protected $dataMappers;
17
    
18
    /**
19
     * @inheritDoc
20
     */
21
    public function setDataMappers(DataMappers $dataMappers)
22
    {
23
        $this->dataMappers = $dataMappers;
24
25
        return $this;
26
    }
27
28
    /**
29
     * @inheritDoc
30
     */
31
    public function getMapper(string $name) : DataMapper
32
    {
33
        return $this->dataMappers->getMapper($name);
34
    }
35
36
    /**
37
     * @inheritDoc
38
     */
39
    public function supports($input) : bool
40
    {
41
        return true;
42
    }
43
}
44

src/DataMappersTrait.php 1 location

@@ 11-39 (lines=29) @@
8
 * @package Thruster\Component\DataMapper
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
trait DataMappersTrait
12
{
13
    /**
14
     * @var DataMappers
15
     */
16
    protected $dataMappers;
17
18
    /**
19
     * @param DataMappers $dataMappers
20
     *
21
     * @return $this
22
     */
23
    public function setDataMappers(DataMappers $dataMappers)
24
    {
25
        $this->dataMappers = $dataMappers;
26
27
        return $this;
28
    }
29
30
    /**
31
     * @param string $name
32
     *
33
     * @return DataMapper
34
     */
35
    public function getDataMapper(string $name) : DataMapper
36
    {
37
        return $this->dataMappers->getMapper($name);
38
    }
39
}
40