Completed
Push — dev ( 81bde7...979e1f )
by Marc
02:06
created

Artificer::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use Mascame\Artificer\Model\Model;
8
9
class Artificer
10
{
11
12
    public static $booted = false;
13
14
    public static function isBooted() {
15
        return self::$booted;
16
    }
17
18
    /**
19
     * @return Model
20
     */
21
    public static function getModel()
22
    {
23
        return App::make('ArtificerModel');
24
    }
25
26
    public static function assets()
27
    {
28
        return BaseController::assets();
29
    }
30
31
    public static function getCurrentModelId($items)
32
    {
33
        return BaseModelController::getCurrentModelId($items);
34
    }
35
36
    /**
37
     * @param $t
38
     * @return bool
39
     */
40
    public static function isClosure($t)
41
    {
42
        return is_object($t) && ($t instanceof \Closure);
43
    }
44
45
    /**
46
     * @return PluginManager
47
     */
48
    public static function pluginManager()
49
    {
50
        return App::make('ArtificerPluginManager');
51
    }
52
    /**
53
     * @param $plugin
54
     * @return mixed
55
     */
56
    public static function getPlugin($plugin)
57
    {
58
        return with(App::make('ArtificerPluginManager'))->make($plugin);
59
    }
60
61
    // Todo is it used anywhere?
62
//    public static function store($filepath = null, $content, $overide = false)
63
//    {
64
//        if (!$filepath) {
65
//            $pathinfo = pathinfo($filepath);
66
//            $filepath = $pathinfo['dirname'];
67
//        }
68
//
69
//        $path = explode('/', $filepath);
70
//        array_pop($path);
71
//        $path = join('/', $path);
72
//
73
//        if (!file_exists($path)) {
74
//            \File::makeDirectory($path, 0777, true, true);
75
//        }
76
//
77
//        if (!file_exists($filepath) || $overide) {
78
//            return \File::put($filepath, $content);
79
//        }
80
//
81
//        return false;
82
//    }
83
}