| Total Complexity | 10 |
| Total Lines | 107 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class SchemaFacade { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var $instance |
||
|
|
|||
| 13 | */ |
||
| 14 | protected static $instance; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var $schema |
||
| 18 | */ |
||
| 19 | protected $schema; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | protected static $config=array(); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var array $tables |
||
| 28 | */ |
||
| 29 | protected static $tables=array(); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * SchemaFacade constructor. |
||
| 33 | */ |
||
| 34 | public function __construct($config=array()) |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param array $params |
||
| 43 | * @return SchemaFacadeContract |
||
| 44 | */ |
||
| 45 | public static function setConfig($params=array()) |
||
| 46 | { |
||
| 47 | self::$config=$params; |
||
| 48 | |||
| 49 | return new static(); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param array $tables |
||
| 54 | * @return SchemaFacadeContract |
||
| 55 | */ |
||
| 56 | public static function tables($tables=array()) |
||
| 57 | { |
||
| 58 | self::$tables=$tables; |
||
| 59 | |||
| 60 | return new static(); |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $appName |
||
| 65 | * @return SchemaFacade |
||
| 66 | */ |
||
| 67 | public static function getInstance() |
||
| 68 | { |
||
| 69 | if(is_null(self::$instance)){ |
||
| 70 | self::$instance=new self(self::$config); |
||
| 71 | } |
||
| 72 | return self::$instance; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param $appName |
||
| 77 | * @return \Resta\Migration\Src\Schema |
||
| 78 | */ |
||
| 79 | protected static function getSchema() |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @return string |
||
| 86 | */ |
||
| 87 | public static function pull() |
||
| 88 | { |
||
| 89 | $schema = self::getSchema(); |
||
| 90 | |||
| 91 | $schema->params['tables']=self::$tables; |
||
| 92 | |||
| 93 | return $schema->pull(); |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @return string |
||
| 98 | */ |
||
| 99 | public static function push() |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @return mixed |
||
| 110 | */ |
||
| 111 | public function stub() |
||
| 116 | } |
||
| 117 | |||
| 118 | } |