added Bootstrap + Module + model class map helper + message translation config
This commit is contained in:
49
lib/User/Helper/ClassMapHelper.php
Normal file
49
lib/User/Helper/ClassMapHelper.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Da\User\Helper;
|
||||
|
||||
/**
|
||||
*
|
||||
* ModelMapHelper.php
|
||||
*
|
||||
* Date: 3/12/16
|
||||
* Time: 18:10
|
||||
* @author Antonio Ramirez <hola@2amigos.us>
|
||||
*/
|
||||
class ClassMapHelper
|
||||
{
|
||||
protected $map = [];
|
||||
|
||||
/**
|
||||
* ModelClassMapHelper constructor.
|
||||
*
|
||||
* @param array $map
|
||||
*/
|
||||
public function __construct($map = [])
|
||||
{
|
||||
$this->map = $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $class
|
||||
*/
|
||||
public function set($key, $class)
|
||||
{
|
||||
$this->map[$key] = $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
if (array_key_exists($key, $this->map)) {
|
||||
return $this->map[$key];
|
||||
};
|
||||
throw new \Exception('Unknown model map key: ' . $key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user