@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | $doc_root = 'public'; |
22 | 22 | |
23 | 23 | if (realpath($system_path) !== false) { |
24 | - $system_path = realpath($system_path) . '/'; |
|
24 | + $system_path = realpath($system_path).'/'; |
|
25 | 25 | } |
26 | -$system_path = rtrim($system_path, '/') . '/'; |
|
26 | +$system_path = rtrim($system_path, '/').'/'; |
|
27 | 27 | |
28 | 28 | define('BASEPATH', str_replace("\\", "/", $system_path)); |
29 | -define('FCPATH', $doc_root . '/'); |
|
30 | -define('APPPATH', $application_folder . '/'); |
|
31 | -define('VIEWPATH', $application_folder . '/views/'); |
|
29 | +define('FCPATH', $doc_root.'/'); |
|
30 | +define('APPPATH', $application_folder.'/'); |
|
31 | +define('VIEWPATH', $application_folder.'/views/'); |
|
32 | 32 | |
33 | -require(BASEPATH . 'core/Common.php'); |
|
33 | +require(BASEPATH.'core/Common.php'); |
|
34 | 34 | |
35 | -if (file_exists(APPPATH . 'config/' . ENVIRONMENT . '/constants.php')) { |
|
36 | - require(APPPATH . 'config/' . ENVIRONMENT . '/constants.php'); |
|
35 | +if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) { |
|
36 | + require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); |
|
37 | 37 | } else { |
38 | - require(APPPATH . 'config/constants.php'); |
|
38 | + require(APPPATH.'config/constants.php'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $charset = strtoupper(config_item('charset')); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | load_class('Input', 'core'); |
74 | 74 | load_class('Lang', 'core'); |
75 | 75 | |
76 | -require(BASEPATH . 'core/Controller.php'); |
|
76 | +require(BASEPATH.'core/Controller.php'); |
|
77 | 77 | |
78 | 78 | function &get_instance() |
79 | 79 | { |
@@ -27,6 +27,6 @@ |
||
27 | 27 | |
28 | 28 | // set the mode here only if it is not already set. |
29 | 29 | // this allows for setting via shell variables, integration testing, etc. |
30 | -if (! isset($_ENV['AURA_CONFIG_MODE'])) { |
|
30 | +if (!isset($_ENV['AURA_CONFIG_MODE'])) { |
|
31 | 31 | $_ENV['AURA_CONFIG_MODE'] = 'dev'; |
32 | 32 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | $di->set('aura/project-kernel:logger', $di->newInstance('Monolog\Logger')); |
31 | 31 | |
32 | 32 | /* @var $ci \CI_Controller */ |
33 | - $ci =& get_instance(); |
|
33 | + $ci = & get_instance(); |
|
34 | 34 | |
35 | 35 | // register built-in command classes |
36 | 36 | foreach ($this->commands as $command) { |
37 | - $class = 'Kenjis\CodeIgniter_Cli\Command\\' . $command; |
|
37 | + $class = 'Kenjis\CodeIgniter_Cli\Command\\'.$command; |
|
38 | 38 | $di->params[$class] = [ |
39 | 39 | 'context' => $di->lazyGet('aura/cli-kernel:context'), |
40 | 40 | 'stdio' => $di->lazyGet('aura/cli-kernel:stdio'), |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | ]; |
43 | 43 | } |
44 | 44 | |
45 | - $seeder_path = APPPATH . 'database/seeds/'; |
|
45 | + $seeder_path = APPPATH.'database/seeds/'; |
|
46 | 46 | $di->setter['Kenjis\CodeIgniter_Cli\Command\Seed']['setSeederPath'] |
47 | 47 | = $seeder_path; |
48 | 48 | |
49 | - $this->user_command_paths = [ APPPATH . 'commands/' ]; |
|
49 | + $this->user_command_paths = [APPPATH.'commands/']; |
|
50 | 50 | // register user command classes |
51 | 51 | UserConfig::registerCommandClasses($di, $ci, $this->user_command_paths); |
52 | 52 | } |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | |
83 | 83 | // register built-in commands |
84 | 84 | foreach ($this->commands as $command) { |
85 | - $class = 'Kenjis\CodeIgniter_Cli\Command\\' . $command; |
|
85 | + $class = 'Kenjis\CodeIgniter_Cli\Command\\'.$command; |
|
86 | 86 | $command_name = strtolower($command); |
87 | 87 | $dispatcher->setObject( |
88 | 88 | $command_name, |
89 | 89 | $di->lazyNew($class) |
90 | 90 | ); |
91 | 91 | |
92 | - $help_class = 'Kenjis\CodeIgniter_Cli\Command\\' . $command . 'Help'; |
|
92 | + $help_class = 'Kenjis\CodeIgniter_Cli\Command\\'.$command.'Help'; |
|
93 | 93 | $help_service->set( |
94 | 94 | $command_name, |
95 | 95 | $di->lazyNew($help_class) |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $success = copy($src, $dst); |
32 | 32 | if ($success) { |
33 | - echo 'copied: ' . $dst . PHP_EOL; |
|
33 | + echo 'copied: '.$dst.PHP_EOL; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | |
52 | 52 | foreach ($iterator as $file) { |
53 | 53 | if ($file->isDir()) { |
54 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
54 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
55 | 55 | } else { |
56 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
56 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
57 | 57 | if ($success) { |
58 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
58 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -2,38 +2,38 @@ discard block |
||
2 | 2 | |
3 | 3 | error_reporting(E_ALL); |
4 | 4 | |
5 | -$autoloader = __DIR__ . '/vendor/autoload.php'; |
|
6 | -if (! file_exists($autoloader)) { |
|
7 | - echo "Composer autoloader not found: $autoloader" . PHP_EOL; |
|
8 | - echo "Please issue 'composer install' and try again." . PHP_EOL; |
|
5 | +$autoloader = __DIR__.'/vendor/autoload.php'; |
|
6 | +if (!file_exists($autoloader)) { |
|
7 | + echo "Composer autoloader not found: $autoloader".PHP_EOL; |
|
8 | + echo "Please issue 'composer install' and try again.".PHP_EOL; |
|
9 | 9 | exit(1); |
10 | 10 | } |
11 | 11 | require $autoloader; |
12 | 12 | |
13 | 13 | /** @const ROOTPATH CodeIgniter project root directory */ |
14 | -define('ROOTPATH', realpath(__DIR__ . '/../../..') . '/'); |
|
14 | +define('ROOTPATH', realpath(__DIR__.'/../../..').'/'); |
|
15 | 15 | chdir(ROOTPATH); |
16 | 16 | |
17 | 17 | class_alias('Kenjis\CodeIgniter_Cli\Command\Command', 'Command'); |
18 | -class_alias('Kenjis\CodeIgniter_Cli\Command\Seed', 'Seeder'); |
|
18 | +class_alias('Kenjis\CodeIgniter_Cli\Command\Seed', 'Seeder'); |
|
19 | 19 | class_alias('Aura\Cli\Help', 'Help'); |
20 | 20 | |
21 | 21 | // Fix argv |
22 | 22 | $_SERVER['argv'] = [ |
23 | - ROOTPATH . 'cli', |
|
23 | + ROOTPATH.'cli', |
|
24 | 24 | ]; |
25 | 25 | $_SERVER['argc'] = 1; |
26 | 26 | |
27 | -require ROOTPATH . '/ci_instance.php'; |
|
27 | +require ROOTPATH.'/ci_instance.php'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Fixture for testing |
31 | 31 | */ |
32 | -$ci =& get_instance(); |
|
32 | +$ci = & get_instance(); |
|
33 | 33 | |
34 | 34 | // switch database to SQLite for testing |
35 | 35 | $config = [ |
36 | - 'hostname' => 'sqlite:' . __DIR__ . '/tests/data/sqlite-database.db', |
|
36 | + 'hostname' => 'sqlite:'.__DIR__.'/tests/data/sqlite-database.db', |
|
37 | 37 | 'username' => '', |
38 | 38 | 'password' => '', |
39 | 39 | 'database' => '', |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | 'migration_table' => 'migrations', |
58 | 58 | 'migration_auto_latest' => false, |
59 | 59 | 'migration_version' => 20150429110003, |
60 | - 'migration_path' => __DIR__ . '/tests/Fake/migrations/', |
|
60 | + 'migration_path' => __DIR__.'/tests/Fake/migrations/', |
|
61 | 61 | ]; |
62 | 62 | $ci->load->library('migration', $config); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // check class exist |
63 | - foreach (glob($migration_path . '*_*.php') as $file) { |
|
63 | + foreach (glob($migration_path.'*_*.php') as $file) { |
|
64 | 64 | $name = basename($file, '.php'); |
65 | 65 | if (preg_match($migration_type === 'timestamp' ? '/^\d{14}_(\w+)$/' : '/^\d{3}_(\w+)$/', $name, $match)) { |
66 | 66 | if (strtolower($match[1]) === strtolower($classname)) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - $template = file_get_contents(__DIR__ . '/templates/Migration.txt'); |
|
75 | + $template = file_get_contents(__DIR__.'/templates/Migration.txt'); |
|
76 | 76 | $search = [ |
77 | 77 | '@@classname@@', |
78 | 78 | '@@date@@', |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $generated = @file_put_contents($file_path, $output, LOCK_EX); |
86 | 86 | |
87 | 87 | if ($generated !== false) { |
88 | - $this->stdio->outln('<<green>>Generated: ' . $file_path . '<<reset>>'); |
|
88 | + $this->stdio->outln('<<green>>Generated: '.$file_path.'<<reset>>'); |
|
89 | 89 | } else { |
90 | 90 | $this->stdio->errln( |
91 | 91 | "<<red>>Can't write to \"$file_path\"<<reset>>" |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $migrations = []; |
101 | 101 | |
102 | 102 | // find max version |
103 | - foreach (glob($migration_path . '*_*.php') as $file) { |
|
103 | + foreach (glob($migration_path.'*_*.php') as $file) { |
|
104 | 104 | $name = basename($file, '.php'); |
105 | 105 | |
106 | 106 | if (preg_match('/^\d{3}_(\w+)$/', $name)) { |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $version = max($migrations); |
115 | 115 | } |
116 | 116 | |
117 | - return $migration_path . sprintf('%03d', ++$version) . '_' . $classname . '.php'; |
|
117 | + return $migration_path.sprintf('%03d', ++$version).'_'.$classname.'.php'; |
|
118 | 118 | } |
119 | 119 | |
120 | - return $migration_path . date('YmdHis') . '_' . $classname . '.php'; |
|
120 | + return $migration_path.date('YmdHis').'_'.$classname.'.php'; |
|
121 | 121 | } |
122 | 122 | } |
@@ -16,10 +16,10 @@ |
||
16 | 16 | { |
17 | 17 | public function __invoke($type, $classname = null) |
18 | 18 | { |
19 | - $generator = __NAMESPACE__ . '\\Generate\\' . ucfirst($type); |
|
20 | - if (! class_exists($generator)) { |
|
19 | + $generator = __NAMESPACE__.'\\Generate\\'.ucfirst($type); |
|
20 | + if (!class_exists($generator)) { |
|
21 | 21 | $this->stdio->errln( |
22 | - '<<red>>No such generator class: ' . $generator . '<<reset>>' |
|
22 | + '<<red>>No such generator class: '.$generator.'<<reset>>' |
|
23 | 23 | ); |
24 | 24 | return Status::FAILURE; |
25 | 25 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | array_shift($argv); |
29 | 29 | $arguments = implode(' ', $argv); |
30 | 30 | |
31 | - $console = FCPATH . 'index.php'; |
|
31 | + $console = FCPATH.'index.php'; |
|
32 | 32 | $this->stdio->outln( |
33 | 33 | "<<green>>php {$console} {$controller} {$method} {$arguments}<<reset>>" |
34 | 34 | ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | if ($command !== null) { |
48 | 48 | $this->stdio->errln( |
49 | - '<<red>>No such command: ' . $command . '<<reset>>' |
|
49 | + '<<red>>No such command: '.$command.'<<reset>>' |
|
50 | 50 | ); |
51 | 51 | return Status::USAGE; |
52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // if no argument, migrate to current |
55 | 55 | if ($this->migration->current() === false) { |
56 | 56 | $this->stdio->errln( |
57 | - '<<red>>' . $this->migration->error_string() . '<<reset>>' |
|
57 | + '<<red>>'.$this->migration->error_string().'<<reset>>' |
|
58 | 58 | ); |
59 | 59 | return Status::FAILURE; |
60 | 60 | } else { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | if ($this->migration->version($version) === false) { |
68 | 68 | $this->stdio->errln( |
69 | - '<<red>>' . $this->migration->error_string() . '<<reset>>' |
|
69 | + '<<red>>'.$this->migration->error_string().'<<reset>>' |
|
70 | 70 | ); |
71 | 71 | return false; |
72 | 72 | } |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | private function showVersions() |
84 | 84 | { |
85 | 85 | $this->stdio->outln( |
86 | - ' current: <<green>>' . $this->config->item('migration_version') . '<<reset>>' |
|
86 | + ' current: <<green>>'.$this->config->item('migration_version').'<<reset>>' |
|
87 | 87 | . ' (in config/migration.php)' |
88 | 88 | ); |
89 | 89 | $version = $this->getDbVersion(); |
90 | 90 | $this->stdio->outln( |
91 | - 'database: <<bold>>' . $version . '<<reset>>' |
|
91 | + 'database: <<bold>>'.$version.'<<reset>>' |
|
92 | 92 | . ' (in database table)' |
93 | 93 | ); |
94 | 94 | $version = $this->getLatestVersion(); |
95 | 95 | $this->stdio->outln( |
96 | - ' latest: ' . $version . '' |
|
96 | + ' latest: '.$version.'' |
|
97 | 97 | . ' (in migration files)' |
98 | 98 | ); |
99 | 99 | } |
@@ -123,18 +123,18 @@ discard block |
||
123 | 123 | foreach ($files as $v => $file) { |
124 | 124 | if ($v == $current && $v == $db) { |
125 | 125 | $this->stdio->outln( |
126 | - ' <<green>>' . basename($file) .' (current/database)<<reset>>' |
|
126 | + ' <<green>>'.basename($file).' (current/database)<<reset>>' |
|
127 | 127 | ); |
128 | 128 | } elseif ($v == $current) { |
129 | 129 | $this->stdio->outln( |
130 | - ' <<green>>' . basename($file) .' (current)<<reset>>' |
|
130 | + ' <<green>>'.basename($file).' (current)<<reset>>' |
|
131 | 131 | ); |
132 | 132 | } elseif ($v == $db) { |
133 | 133 | $this->stdio->outln( |
134 | - ' <<bold>>' . basename($file) .' (database)<<reset>>' |
|
134 | + ' <<bold>>'.basename($file).' (database)<<reset>>' |
|
135 | 135 | ); |
136 | 136 | } else { |
137 | - $this->stdio->outln(' ' . basename($file)); |
|
137 | + $this->stdio->outln(' '.basename($file)); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |