1
|
|
|
<?php namespace Mascame\Artificer; |
2
|
|
|
|
3
|
|
|
use App; |
4
|
|
|
use Mascame\Artificer\Http\Controllers\BaseController; |
5
|
|
|
use Mascame\Artificer\Http\Controllers\BaseModelController; |
6
|
|
|
use Mascame\Artificer\Extension\PluginManager; |
7
|
|
|
|
8
|
|
|
class Artificer |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
public static $booted = false; |
12
|
|
|
|
13
|
|
|
public static function isBooted() { |
14
|
|
|
return self::$booted; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public static function assets() |
18
|
|
|
{ |
19
|
|
|
return BaseController::assets(); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public static function getCurrentModelId($items) |
23
|
|
|
{ |
24
|
|
|
return BaseModelController::getCurrentModelId($items); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param $t |
29
|
|
|
* @return bool |
30
|
|
|
*/ |
31
|
|
|
public static function isClosure($t) |
32
|
|
|
{ |
33
|
|
|
return is_object($t) && ($t instanceof \Closure); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return PluginManager |
38
|
|
|
*/ |
39
|
|
|
public static function pluginManager() |
40
|
|
|
{ |
41
|
|
|
return App::make('ArtificerPluginManager'); |
42
|
|
|
} |
43
|
|
|
/** |
44
|
|
|
* @param $plugin |
45
|
|
|
* @return mixed |
46
|
|
|
*/ |
47
|
|
|
public static function getPlugin($plugin) |
48
|
|
|
{ |
49
|
|
|
return with(App::make('ArtificerPluginManager'))->make($plugin); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
// Todo is it used anywhere? |
53
|
|
|
// public static function store($filepath = null, $content, $overide = false) |
54
|
|
|
// { |
55
|
|
|
// if (!$filepath) { |
56
|
|
|
// $pathinfo = pathinfo($filepath); |
57
|
|
|
// $filepath = $pathinfo['dirname']; |
58
|
|
|
// } |
59
|
|
|
// |
60
|
|
|
// $path = explode('/', $filepath); |
61
|
|
|
// array_pop($path); |
62
|
|
|
// $path = join('/', $path); |
63
|
|
|
// |
64
|
|
|
// if (!file_exists($path)) { |
65
|
|
|
// \File::makeDirectory($path, 0777, true, true); |
66
|
|
|
// } |
67
|
|
|
// |
68
|
|
|
// if (!file_exists($filepath) || $overide) { |
69
|
|
|
// return \File::put($filepath, $content); |
70
|
|
|
// } |
71
|
|
|
// |
72
|
|
|
// return false; |
73
|
|
|
// } |
74
|
|
|
} |