1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Rougin\Refinery; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Refinery Console |
7
|
|
|
* |
8
|
|
|
* @package Refinery |
9
|
|
|
* @author Rougin Royce Gutib <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class Refinery extends \Rougin\Blueprint\Console |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var \Rougin\Blueprint\Blueprint |
15
|
|
|
*/ |
16
|
|
|
protected static $application; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected static $name = 'Refinery'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected static $version = '0.3.0'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Prepares the console application. |
30
|
|
|
* |
31
|
|
|
* @param string $filename |
32
|
|
|
* @param \Auryn\Injector|null $injector |
33
|
|
|
* @param string|null $directory |
34
|
|
|
* @return \Rougin\Blueprint\Blueprint |
35
|
|
|
*/ |
36
|
33 |
|
public static function boot($filename = 'refinery.yml', \Auryn\Injector $injector = null, $directory = null) |
37
|
|
|
{ |
38
|
33 |
|
\Rougin\SparkPlug\Instance::create($directory); |
39
|
|
|
|
40
|
33 |
|
self::$application = parent::boot($filename, $injector, $directory); |
41
|
|
|
|
42
|
33 |
|
self::prepareDependencies(); |
43
|
|
|
|
44
|
33 |
|
$templates = self::$application->getTemplatePath(); |
45
|
|
|
|
46
|
33 |
|
self::$application->setTemplatePath($templates, null); |
47
|
33 |
|
self::$application->setCommandPath(__DIR__ . DIRECTORY_SEPARATOR . 'Commands'); |
48
|
33 |
|
self::$application->setCommandNamespace('Rougin\Refinery\Commands'); |
49
|
|
|
|
50
|
33 |
|
return self::$application; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Prepares the dependencies to be used. |
55
|
|
|
* |
56
|
|
|
* @return void |
57
|
|
|
*/ |
58
|
33 |
|
protected static function prepareDependencies() |
59
|
|
|
{ |
60
|
33 |
|
$basePath = BASEPATH; |
61
|
|
|
|
62
|
33 |
|
require APPPATH . 'config/database.php'; |
63
|
|
|
|
64
|
33 |
|
if (is_dir('vendor/rougin/codeigniter/src/')) { |
65
|
22 |
|
$basePath = 'vendor/rougin/codeigniter/src/'; |
66
|
22 |
|
} |
67
|
|
|
|
68
|
33 |
|
require $basePath . 'helpers/inflector_helper.php'; |
69
|
|
|
|
70
|
33 |
|
$driver = new \Rougin\Describe\Driver\CodeIgniterDriver($db[$active_group]); |
|
|
|
|
71
|
|
|
|
72
|
33 |
|
self::$application->injector->share(new \Rougin\Describe\Describe($driver)); |
73
|
33 |
|
} |
74
|
|
|
} |
75
|
|
|
|
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.