@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | $branch = exec('git rev-parse --abbrev-ref HEAD'); |
29 | 29 | // find readme file |
30 | - $readme = $readmeFile; |
|
30 | + $readme = $readmeFile; |
|
31 | 31 | // read the entire readme |
32 | 32 | $str = file_get_contents($readme); |
33 | 33 | // replace the branch tags |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | // Check the version number conforms to semver format - 2.0.1 or 3.0.0[-beta][+build] |
62 | 62 | if (!preg_match('/^v[0-9]+\.[0-9]+\.[0-9]+([-+].*)?$/', $version, $match)) { |
63 | - $this->stderr("!! The version number is not a valid version it must be in the format 'v#.#.#' or 'v#.#.#[-description][+build]'.\n", Console::FG_RED); |
|
63 | + $this->stderr("!! The version number is not a valid version it must be in the format 'v#.#.#' or 'v#.#.#[-description][+build]'.\n", Console::FG_RED); |
|
64 | 64 | return ExitCode::UNSPECIFIED_ERROR; |
65 | 65 | } |
66 | 66 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | // Check to see if the javascript has been built since changing |
77 | 77 | if (!$this->confirm("=> Have you run the neon build process?\n")) { |
78 | - $this->stdout("-> Please run the build process before continuing! =>./neo core/build/neon\n", Console::FG_CYAN); |
|
78 | + $this->stdout("-> Please run the build process before continuing! =>./neo core/build/neon\n", Console::FG_CYAN); |
|
79 | 79 | return ExitCode::UNSPECIFIED_ERROR; |
80 | 80 | } |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // need to make sure that the version to update to is specified and checked in, in the composer.json file |
84 | 84 | // this ensures the tag will have the correct version listed |
85 | 85 | if (!$this->confirm("=> Are your tests passing?\n")) { |
86 | - $this->stdout("-> Please run all of the tests! =>./codecept run\n", Console::FG_CYAN); |
|
86 | + $this->stdout("-> Please run all of the tests! =>./codecept run\n", Console::FG_CYAN); |
|
87 | 87 | return ExitCode::UNSPECIFIED_ERROR; |
88 | 88 | } |
89 | 89 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | $process->wait(); |
101 | 101 | $gitVersions = explode("\n", $process->getOutput()); |
102 | 102 | $versions = []; |
103 | - foreach($gitVersions as $v) { |
|
104 | - $v = substr($v, strrpos($v, "/")+1); |
|
103 | + foreach ($gitVersions as $v) { |
|
104 | + $v = substr($v, strrpos($v, "/") + 1); |
|
105 | 105 | if ($v == '') continue; |
106 | - $versions[] = $v ; |
|
106 | + $versions[] = $v; |
|
107 | 107 | } |
108 | 108 | dp($versions); |
109 | 109 | if (in_array($version, $versions)) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if (isset($commands['core/help'])) { |
35 | 35 | unset($commands['core/help']); |
36 | 36 | } |
37 | - $this->stdout("\nThis is Neon version " . \Neon::getVersion() . ".\n"); |
|
37 | + $this->stdout("\nThis is Neon version ".\Neon::getVersion().".\n"); |
|
38 | 38 | if (!empty($commands)) { |
39 | 39 | $this->stdout("\nThe following commands are available:\n\n", Console::BOLD); |
40 | 40 | $len = 0; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (!empty($actions)) { |
48 | 48 | $prefix = $controller->getUniqueId(); |
49 | 49 | foreach ($actions as $action) { |
50 | - $string = $prefix . '/' . $action; |
|
50 | + $string = $prefix.'/'.$action; |
|
51 | 51 | if ($action === $controller->defaultAction) { |
52 | 52 | $string .= ' (default)'; |
53 | 53 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } elseif (($l = strlen($command)) > $len) { |
60 | 60 | $len = $l; |
61 | 61 | } |
62 | - $this->stdout('- ' . $this->ansiFormat($command, Console::FG_YELLOW)); |
|
62 | + $this->stdout('- '.$this->ansiFormat($command, Console::FG_YELLOW)); |
|
63 | 63 | $this->stdout(str_repeat(' ', $len + 4 - strlen($command))); |
64 | 64 | $this->stdout(Console::wrapText($description, $len + 4 + 2), Console::BOLD); |
65 | 65 | $this->stdout("\n"); |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | if (!empty($actions)) { |
72 | 72 | $prefix = $controller->getUniqueId(); |
73 | 73 | foreach ($actions as $action) { |
74 | - $string = ' ' . $prefix . '/' . $action; |
|
75 | - $this->stdout(' ' . $this->ansiFormat($string, Console::FG_GREEN)); |
|
74 | + $string = ' '.$prefix.'/'.$action; |
|
75 | + $this->stdout(' '.$this->ansiFormat($string, Console::FG_GREEN)); |
|
76 | 76 | if ($action === $controller->defaultAction) { |
77 | 77 | $string .= ' (default)'; |
78 | 78 | $this->stdout(' (default)', Console::FG_YELLOW); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } |
91 | 91 | $scriptName = $this->getScriptName(); |
92 | 92 | $this->stdout("\nTo see the help of each command, enter:\n", Console::BOLD); |
93 | - $this->stdout("\n $scriptName " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' |
|
94 | - . $this->ansiFormat('<command-name>', Console::FG_CYAN) . "\n\n"); |
|
93 | + $this->stdout("\n $scriptName ".$this->ansiFormat('help', Console::FG_YELLOW).' ' |
|
94 | + . $this->ansiFormat('<command-name>', Console::FG_CYAN)."\n\n"); |
|
95 | 95 | } else { |
96 | 96 | $this->stdout("\nNo commands are found.\n\n", Console::BOLD); |
97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function getDefaultHelpHeader() |
106 | 106 | { |
107 | - return "\nThis is Yii version " . \Yii::getVersion() . ".\n" |
|
108 | - . "\nThis is Neon version " . \Neon::getVersion() . ".\n"; |
|
107 | + return "\nThis is Yii version ".\Yii::getVersion().".\n" |
|
108 | + . "\nThis is Neon version ".\Neon::getVersion().".\n"; |
|
109 | 109 | |
110 | 110 | } |
111 | 111 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | */ |
115 | 115 | protected function getModuleCommands($module) |
116 | 116 | { |
117 | - $prefix = $module instanceof Application ? '' : $module->getUniqueId() . '/'; |
|
117 | + $prefix = $module instanceof Application ? '' : $module->getUniqueId().'/'; |
|
118 | 118 | |
119 | 119 | $commands = []; |
120 | 120 | |
121 | 121 | if ($module->id != 'core') { |
122 | 122 | foreach (array_keys($module->controllerMap) as $id) { |
123 | - $commands[] = $prefix . $id; |
|
123 | + $commands[] = $prefix.$id; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | $files = scandir($controllerPath); |
131 | 131 | foreach ($files as $file) { |
132 | 132 | if (!empty($file) && substr_compare($file, 'Controller.php', -14, 14) === 0) { |
133 | - $controllerClass = $module->controllerNamespace . '\\' . substr(basename($file), 0, -4); |
|
133 | + $controllerClass = $module->controllerNamespace.'\\'.substr(basename($file), 0, -4); |
|
134 | 134 | if ($this->validateControllerClass($controllerClass)) { |
135 | 135 | // if ($prefix == 'core' || $prefix == 'core/') |
136 | 136 | // continue; |
137 | - $commands[] = $prefix . Inflector::camel2id(substr(basename($file), 0, -14)); |
|
137 | + $commands[] = $prefix.Inflector::camel2id(substr(basename($file), 0, -14)); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if ($app === null) { |
77 | 77 | throw new Exception('No app exists with id "'.$this->app.'"'); |
78 | 78 | } |
79 | - $this->getMigrator()->migrationPath = $app->getClassAlias() . '/migrations'; |
|
79 | + $this->getMigrator()->migrationPath = $app->getClassAlias().'/migrations'; |
|
80 | 80 | $this->migrationPath = $this->getMigrator()->migrationPath; |
81 | 81 | } |
82 | 82 | return true; |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | if (!preg_match('/^\w+$/', $name)) { |
121 | 121 | throw new Exception("The migration name should contain letters, digits and/or underscore characters only."); |
122 | 122 | } |
123 | - $name = 'm' . gmdate('Ymd_His') . '_' . $app . '_' . $name; |
|
124 | - $file = neon()->getAlias($this->migrationPath . DIRECTORY_SEPARATOR . $name . '.php'); |
|
123 | + $name = 'm'.gmdate('Ymd_His').'_'.$app.'_'.$name; |
|
124 | + $file = neon()->getAlias($this->migrationPath.DIRECTORY_SEPARATOR.$name.'.php'); |
|
125 | 125 | if ($this->confirm("Create new migration '$file'?")) { |
126 | 126 | $content = Yii::$app->getView()->renderFile(Neon::getAlias($this->templateFile), ['className' => $name]); |
127 | 127 | FileHelper::createDirectory(dirname($file)); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $success = $this->migrator->migrateUp($class); |
152 | 152 | $time = microtime(true) - $start; |
153 | 153 | if ($success) { |
154 | - $this->stdout("*** applied $class (time: " . sprintf("%.3f", $time) . "s)\n\n", Console::FG_GREEN); |
|
154 | + $this->stdout("*** applied $class (time: ".sprintf("%.3f", $time)."s)\n\n", Console::FG_GREEN); |
|
155 | 155 | return true; |
156 | 156 | } else { |
157 | - $this->stdout("*** failed to apply $class (time: " . sprintf("%.3f", $time) . "s)\n\n", Console::FG_RED); |
|
157 | + $this->stdout("*** failed to apply $class (time: ".sprintf("%.3f", $time)."s)\n\n", Console::FG_RED); |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | } |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | $success = $this->migrator->migrateDown($class); |
172 | 172 | if ($success) { |
173 | 173 | $time = microtime(true) - $start; |
174 | - $this->stdout("*** reverted $class (time: " . sprintf("%.3f", $time) . "s)\n\n", Console::FG_GREEN); |
|
174 | + $this->stdout("*** reverted $class (time: ".sprintf("%.3f", $time)."s)\n\n", Console::FG_GREEN); |
|
175 | 175 | return true; |
176 | 176 | } else { |
177 | 177 | $time = microtime(true) - $start; |
178 | - $this->stdout("*** failed to revert $class (time: " . sprintf("%.3f", $time) . "s)\n\n", Console::FG_RED); |
|
178 | + $this->stdout("*** failed to revert $class (time: ".sprintf("%.3f", $time)."s)\n\n", Console::FG_RED); |
|
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @var bool if true stop execution after first failed test |
21 | 21 | */ |
22 | - public $failFast=false; |
|
22 | + public $failFast = false; |
|
23 | 23 | /** |
24 | 24 | * @var string Comma separated list of tests to run for e.g. unit,acceptance,api |
25 | 25 | */ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * run a codecept test |
41 | 41 | * @param string $tests |
42 | 42 | */ |
43 | - public function actionIndex($tests='unit,api,acceptance') |
|
43 | + public function actionIndex($tests = 'unit,api,acceptance') |
|
44 | 44 | { |
45 | 45 | $options = $this->failFast ? ' --fail-fast' : ''; |
46 | 46 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | |
50 | 50 | $options .= " $tests"; |
51 | 51 | |
52 | - $command = './codecept run ' . $options; |
|
52 | + $command = './codecept run '.$options; |
|
53 | 53 | $process = new Process($command, null, null, null, null); |
54 | 54 | |
55 | 55 | $this->stdout("-> Running command: $command\n", Console::FG_CYAN); |
56 | 56 | // enable real time output |
57 | - $process->run(function ($type, $buffer) { |
|
57 | + $process->run(function($type, $buffer) { |
|
58 | 58 | echo $buffer; |
59 | 59 | }); |
60 | 60 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $root = neon()->getAlias("@root").DIRECTORY_SEPARATOR; |
83 | 83 | |
84 | 84 | // 1. Check that Babel is installed and if not install it |
85 | - if (($result = $this->checkBabel())!=0) |
|
85 | + if (($result = $this->checkBabel()) != 0) |
|
86 | 86 | return $result; |
87 | 87 | |
88 | 88 | // 2. Create the babel config file |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return $result; |
91 | 91 | |
92 | 92 | // 3. Run babel over the project |
93 | - $sourceDirectory = $root.$path;; |
|
93 | + $sourceDirectory = $root.$path; ; |
|
94 | 94 | $outDirectory = $root.'babelOut'; |
95 | 95 | $command = "babel --root-mode=upward $sourceDirectory --out-dir=$outDirectory --out-file-extension=.build.js --ignore='$sourceDirectory/**/*.build.js','$sourceDirectory/**/vendor/*','$sourceDirectory/**/*.min.js'"; |
96 | 96 | $this->stdout("\n-> Running the babel command over $path\n"); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // 5. Remove the babel directory |
112 | 112 | $this->stdout("\n-> Removing the temporary directory $outDirectory\n"); |
113 | - $deleteCommand="rm -rf $outDirectory"; |
|
113 | + $deleteCommand = "rm -rf $outDirectory"; |
|
114 | 114 | $this->stdout("-> $deleteCommand\n"); |
115 | 115 | $delete = new Process($deleteCommand); |
116 | 116 | $delete->start(); |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | */ |
18 | 18 | trait PropertiesTrait |
19 | 19 | { |
20 | - public function toArray($except=[]) |
|
20 | + public function toArray($except = []) |
|
21 | 21 | { |
22 | - $array= []; |
|
22 | + $array = []; |
|
23 | 23 | $properties = $this->getProperties(); |
24 | - foreach($properties as $key => $value) { |
|
24 | + foreach ($properties as $key => $value) { |
|
25 | 25 | if (in_array($value, $except)) { continue; } |
26 | 26 | list($prop, $value) = $this->resolveProperty($key, $value); |
27 | 27 | $array[$prop] = $this->valueToArray($value); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function valueToArray($value) |
48 | 48 | { |
49 | 49 | if (is_array($value)) { |
50 | - foreach($value as $key => $val) { |
|
50 | + foreach ($value as $key => $val) { |
|
51 | 51 | $value[$key] = $this->valueToArray($val); |
52 | 52 | } |
53 | 53 | } else if (is_object($value) && $value instanceof IArrayable) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require NEON_VENDOR . '/yiisoft/yii2/BaseYii.php'; |
|
3 | +require NEON_VENDOR.'/yiisoft/yii2/BaseYii.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * The Neon class extends YiiBase and is a convenience class for setting up a Yii application |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public static function getVersion() |
20 | 20 | { |
21 | - return trim(file_get_contents(__DIR__ . '/../../version')); |
|
21 | + return trim(file_get_contents(__DIR__.'/../../version')); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function powered() |
105 | 105 | { |
106 | - return 'Powered by <a href="' . self::neonLink() . '" rel="external" target="_blank">Neon</a>'; |
|
106 | + return 'Powered by <a href="'.self::neonLink().'" rel="external" target="_blank">Neon</a>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $stop = microtime(true); |
152 | 152 | $bootstrapTime = $stop - $start; |
153 | 153 | if ($bootstrapTime > $maxTime) { |
154 | - $error = $error ? $error : 'The profile "' . $token . '" took longer than ' . $maxTime . ' seconds'; |
|
154 | + $error = $error ? $error : 'The profile "'.$token.'" took longer than '.$maxTime.' seconds'; |
|
155 | 155 | \Neon::error($error, $category); |
156 | 156 | } |
157 | 157 | self::endProfile($token, $category); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - public static function endProfile($token=null, $category = 'application') |
|
171 | + public static function endProfile($token = null, $category = 'application') |
|
172 | 172 | { |
173 | 173 | if (neon()->debug) { |
174 | 174 | if ($token === null) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param int $length - the number of rows to return |
36 | 36 | * @return array an array of key value pairs |
37 | 37 | */ |
38 | - public function getDataMap($key, $query='', $filters=[], $fields=[], $start = 0, $length = 100); |
|
38 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Looks up maps from the map ids. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * If not set then return the default map field for the class. |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - public function makeMapLookupRequest($key, $ids, $fields=[]); |
|
53 | + public function makeMapLookupRequest($key, $ids, $fields = []); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Return results from a previously called makeMapLookupRequest request |