Code Duplication    Length = 17-18 lines in 2 locations

libs/Helper/TGetter.php 1 location

@@ 7-24 (lines=18) @@
4
5
////////////////////////////////////////////////////////////////
6
7
trait TGetter
8
{
9
	/**
10
	 * Allow setting fooBar getter with getFooBar().
11
	 *
12
	 * @access public
13
	 *
14
	 * @param  string $attribute
15
	 *
16
	 * @return mixed
17
	 */
18
	public function __get( $attribute )
19
	{
20
		if( is_callable([static::class, $getter= 'get'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){
21
			return static::$getter();
22
		}else{
23
			throw new \Exception(static::class.' has no attribute named '.$attribute);
24
		}
25
	}
26
}
27

libs/Helper/TSetter.php 1 location

@@ 7-23 (lines=17) @@
4
5
////////////////////////////////////////////////////////////////
6
7
trait TSetter
8
{
9
	/**
10
	 * Allow setting fooBar setter with setFooBar().
11
	 *
12
	 * @access public
13
	 *
14
	 * @param  string $attribute
15
	 * @param  mixed  $value
16
	 */
17
	public function __set( $attribute, $value )
18
	{
19
		if( is_callable([static::class, $setter= 'set'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){
20
			return static::$setter($value);
21
		}else{
22
			throw new \Exception(static::class.' has no attribute named '.$attribute);
23
		}
24
	}
25
}
26