@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | parent::__construct($config, $options); |
36 | 36 | // Set default path for ChromeDriver |
37 | 37 | if (!isset($this->config['path'])) { |
38 | - $this->config['path'] = __DIR__ . '/bin/'.$this->chromeVersion.'/chromedriver-' . $this->getDriverSuffix(); |
|
38 | + $this->config['path'] = __DIR__.'/bin/'.$this->chromeVersion.'/chromedriver-'.$this->getDriverSuffix(); |
|
39 | 39 | } |
40 | 40 | // Set default WebDriver port |
41 | 41 | if (!isset($this->config['port'])) { |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | } |
82 | 82 | $descriptorSpec = array( |
83 | 83 | array('pipe', 'r'), |
84 | - array('file', $this->getLogDir() . 'ChromeDriver.output.txt', 'w'), |
|
85 | - array('file', $this->getLogDir() . 'ChromeDriver.errors.txt', 'a') |
|
84 | + array('file', $this->getLogDir().'ChromeDriver.output.txt', 'w'), |
|
85 | + array('file', $this->getLogDir().'ChromeDriver.errors.txt', 'a') |
|
86 | 86 | ); |
87 | 87 | $this->resource = proc_open($command, $descriptorSpec, $this->pipes, null, null, array('bypass_shell' => true)); |
88 | 88 | if (!is_resource($this->resource) || !proc_get_status($this->resource)['running']) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // Make sure the value is true/false and not 1/0 |
171 | 171 | $configValue = ($configValue) ? 'true' : 'false'; |
172 | 172 | } |
173 | - $params[] = $mapping[$configKey] . '=' . $configValue; |
|
173 | + $params[] = $mapping[$configKey].'='.$configValue; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | return implode(' ', $params); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // Prefix command with exec on non Windows systems to ensure that we receive the correct pid. |
184 | 184 | // See http://php.net/manual/en/function.proc-get-status.php#93382 |
185 | 185 | $commandPrefix = $this->isWindows() ? '' : 'exec '; |
186 | - return $commandPrefix . escapeshellarg(realpath($this->config['path'])) . ' ' . $this->getCommandParameters() . ' --url-base=/wd/hub'; |
|
186 | + return $commandPrefix.escapeshellarg(realpath($this->config['path'])).' '.$this->getCommandParameters().' --url-base=/wd/hub'; |
|
187 | 187 | } |
188 | 188 | /** |
189 | 189 | * Checks if the current machine is Windows. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $currentVersion = neon()->getVersion(); |
88 | 88 | $dbName = env('DB_NAME'); |
89 | - $filename = gmdate('ymd_His') . '_' . $dbName . '_' . $currentVersion . '.sql'; |
|
89 | + $filename = gmdate('ymd_His').'_'.$dbName.'_'.$currentVersion.'.sql'; |
|
90 | 90 | return $this->getBackupDirectory()."/$filename"; |
91 | 91 | } |
92 | 92 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | '--dump-date', |
110 | 110 | '--no-autocommit', |
111 | 111 | '--routines', |
112 | - '--default-character-set=' . $this->charset, |
|
112 | + '--default-character-set='.$this->charset, |
|
113 | 113 | '--set-charset', |
114 | 114 | '--triggers', |
115 | 115 | '--host='.env('DB_HOST'), |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function restore($path) |
137 | 137 | { |
138 | - $process = new Process('mysql ' . env('DB_NAME') . ' < "' . $path . '"'); |
|
138 | + $process = new Process('mysql '.env('DB_NAME').' < "'.$path.'"'); |
|
139 | 139 | $result = $process->run(); |
140 | 140 | if (!$process->isSuccessful()) { |
141 | 141 | throw new ProcessFailedException($process); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param int $depth |
78 | 78 | * @return int |
79 | 79 | */ |
80 | - public function rebuildTree($parent, $left, $depth=0) |
|
80 | + public function rebuildTree($parent, $left, $depth = 0) |
|
81 | 81 | { |
82 | 82 | // the right value of this node is the left value + 1 |
83 | 83 | $right = $left + 1; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @throws \Exception|\Throwable |
118 | 118 | * @return TreeRecord the child added |
119 | 119 | */ |
120 | - public function addChild(TreeRecord $node, callable $callable=null) : TreeRecord |
|
120 | + public function addChild(TreeRecord $node, callable $callable = null) : TreeRecord |
|
121 | 121 | { |
122 | 122 | $result = static::addAsLastChildOf($this, $node); |
123 | 123 | if ($callable) $callable($node); |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function makeRoot() |
62 | 62 | { |
63 | - if (static::find()->root()->exists()) |
|
64 | - throw new \Exception('You can only create one root node'); |
|
63 | + if (static::find()->root()->exists()) { |
|
64 | + throw new \Exception('You can only create one root node'); |
|
65 | + } |
|
65 | 66 | $this->tree_left = 1; |
66 | 67 | $this->tree_right = 2; |
67 | 68 | $this->tree_depth = 0; |
@@ -120,7 +121,9 @@ discard block |
||
120 | 121 | public function addChild(TreeRecord $node, callable $callable=null) : TreeRecord |
121 | 122 | { |
122 | 123 | $result = static::addAsLastChildOf($this, $node); |
123 | - if ($callable) $callable($node); |
|
124 | + if ($callable) { |
|
125 | + $callable($node); |
|
126 | + } |
|
124 | 127 | return $node; |
125 | 128 | } |
126 | 129 | |
@@ -155,8 +158,9 @@ discard block |
||
155 | 158 | */ |
156 | 159 | public function moveAsFirstChildOf(TreeRecord $parent) |
157 | 160 | { |
158 | - if ($parent === $this || $this->isAncestorOf($parent)) |
|
159 | - throw new \Excepton("Cannot move node as first child of itself or into a descendant"); |
|
161 | + if ($parent === $this || $this->isAncestorOf($parent)) { |
|
162 | + throw new \Excepton("Cannot move node as first child of itself or into a descendant"); |
|
163 | + } |
|
160 | 164 | $oldDepth = $this->tree_depth; |
161 | 165 | $this->tree_left = $parent->tree_depth + 1; |
162 | 166 | $this->tree_parent = $parent->getPrimaryKey(); |
@@ -230,12 +234,15 @@ discard block |
||
230 | 234 | public static function validateAdd(TreeRecord $parent, TreeRecord $node) |
231 | 235 | { |
232 | 236 | // cannot insert as child of itself |
233 | - if ($parent === $node) |
|
234 | - throw new \Exception("Cannot insert node as last child of itself"); |
|
235 | - if ($parent->getIsNewRecord()) |
|
236 | - throw new \Exception('The parent node must exist.'); |
|
237 | - if ($node->tree_depth === 0 && $parent->isRoot()) |
|
238 | - throw new \Exception('Can not put a root node inside another root node'); |
|
237 | + if ($parent === $node) { |
|
238 | + throw new \Exception("Cannot insert node as last child of itself"); |
|
239 | + } |
|
240 | + if ($parent->getIsNewRecord()) { |
|
241 | + throw new \Exception('The parent node must exist.'); |
|
242 | + } |
|
243 | + if ($node->tree_depth === 0 && $parent->isRoot()) { |
|
244 | + throw new \Exception('Can not put a root node inside another root node'); |
|
245 | + } |
|
239 | 246 | } |
240 | 247 | |
241 | 248 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $columns = ['tree_root' => SORT_ASC] + $columns; |
40 | 40 | } |
41 | 41 | |
42 | - $this->andWhere(['tree_right' => new Expression($db->quoteColumnName('tree_left') . ' + 1')]) |
|
42 | + $this->andWhere(['tree_right' => new Expression($db->quoteColumnName('tree_left').' + 1')]) |
|
43 | 43 | ->addOrderBy($columns); |
44 | 44 | |
45 | 45 | return $this; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param null $parent |
70 | 70 | * @param null $root |
71 | 71 | */ |
72 | - public function getProperties(&$left=null, &$right=null, &$parent=null, &$root=null) |
|
72 | + public function getProperties(&$left = null, &$right = null, &$parent = null, &$root = null) |
|
73 | 73 | { |
74 | 74 | $model = new $this->modelClass(); |
75 | 75 | $model->getPropertes($left, $right, $parent, $root); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | $r = new Renderer(); |
46 | 46 | $r->smarty->clearCompiledTemplate(); |
47 | 47 | $r->smarty->clearAllCache(); |
48 | - foreach(neon()->view->renderers as $ext => $config) { |
|
48 | + foreach (neon()->view->renderers as $ext => $config) { |
|
49 | 49 | $renderer = neon()->view->getRendererByExtension($ext); |
50 | 50 | if ($renderer instanceof ICanFlushTemplates) { |
51 | 51 | $renderer->flushTemplates(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // $connection->createCommand($sql)->execute(); |
26 | 26 | |
27 | 27 | // 1. add the choices datatype |
28 | -$sql =<<<EOQ |
|
28 | +$sql = <<<EOQ |
|
29 | 29 | SET foreign_key_checks = 0; |
30 | 30 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
31 | 31 | VALUES |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $connection = neon()->db; |
48 | 48 | |
49 | -$sql =<<<EOQ |
|
49 | +$sql = <<<EOQ |
|
50 | 50 | SET foreign_key_checks = 0; |
51 | 51 | DELETE FROM {{%dds_data_type}} WHERE `data_type_ref`='choice' LIMIT 1; |
52 | 52 | SET foreign_key_checks = 1; |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | |
5 | 5 | class m160913_121403__neon_dds_changes extends Migration |
6 | 6 | { |
7 | - // Use safeUp/safeDown to run migration code within a transaction |
|
8 | - public function safeUp() |
|
9 | - { |
|
7 | + // Use safeUp/safeDown to run migration code within a transaction |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | // add a series of default types to the datatypes |
11 | 11 | $sql =<<<EOQ |
12 | 12 | INSERT INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $command = $connection->createCommand($sql); |
41 | 41 | $command->execute(); |
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - public function safeDown() |
|
46 | - { |
|
45 | + public function safeDown() |
|
46 | + { |
|
47 | 47 | // delete the additional rows in the datatypes |
48 | 48 | $sql =<<<EOQ |
49 | 49 | DELETE FROM `dds_data_type` WHERE `data_type_ref` IN |
@@ -55,5 +55,5 @@ discard block |
||
55 | 55 | $command = $connection->createCommand($sql); |
56 | 56 | $command->execute(); |
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | public function safeUp() |
9 | 9 | { |
10 | 10 | // add a series of default types to the datatypes |
11 | - $sql =<<<EOQ |
|
11 | + $sql = <<<EOQ |
|
12 | 12 | INSERT INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
13 | 13 | VALUES |
14 | 14 | ('binary','Normal Binary','For normal binaries such as images up to 16MB in size','','binary',0), |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function safeDown() |
46 | 46 | { |
47 | 47 | // delete the additional rows in the datatypes |
48 | - $sql =<<<EOQ |
|
48 | + $sql = <<<EOQ |
|
49 | 49 | DELETE FROM `dds_data_type` WHERE `data_type_ref` IN |
50 | 50 | ('binary', 'binarylong', 'binaryshort', 'date', 'datetime', 'float', 'floatdouble', |
51 | 51 | 'integer', 'integerlong', 'integershort', 'integertiny', 'text', 'textlong', 'textshort', |
@@ -4,26 +4,26 @@ |
||
4 | 4 | |
5 | 5 | class m170904_201142_dds_multichoice_creation extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
9 | - $sql =<<<EOQ |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | + $sql =<<<EOQ |
|
10 | 10 | SET foreign_key_checks = 0; |
11 | 11 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
12 | 12 | VALUES |
13 | 13 | ('choice_multiple','Multiple Choice','For storing multiple choice keys','{"size":10000}','text',0); |
14 | 14 | SET foreign_key_checks = 1; |
15 | 15 | EOQ; |
16 | - $this->execute($sql); |
|
16 | + $this->execute($sql); |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function safeDown() |
|
21 | - { |
|
22 | - $sql =<<<EOQ |
|
20 | + public function safeDown() |
|
21 | + { |
|
22 | + $sql =<<<EOQ |
|
23 | 23 | SET foreign_key_checks=0; |
24 | 24 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='choice_multiple'; |
25 | 25 | SET foreign_key_checks=1; |
26 | 26 | EOQ; |
27 | - $this->execute($sql); |
|
28 | - } |
|
27 | + $this->execute($sql); |
|
28 | + } |
|
29 | 29 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | public function safeUp() |
8 | 8 | { |
9 | - $sql =<<<EOQ |
|
9 | + $sql = <<<EOQ |
|
10 | 10 | SET foreign_key_checks = 0; |
11 | 11 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
12 | 12 | VALUES |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function safeDown() |
21 | 21 | { |
22 | - $sql =<<<EOQ |
|
22 | + $sql = <<<EOQ |
|
23 | 23 | SET foreign_key_checks=0; |
24 | 24 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='choice_multiple'; |
25 | 25 | SET foreign_key_checks=1; |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | class m161111_161448__dds_removal_of_ids extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | // delete ids |
10 | 10 | $this->dropColumn('dds_class', 'id'); |
11 | 11 | $this->dropColumn('dds_data_type', 'id'); |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | |
15 | 15 | // add a uuid to object tables |
16 | 16 | $this->execute('ALTER TABLE `dds_object` ADD `_uuid` CHAR(36) NOT NULL FIRST, ADD PRIMARY KEY (`_uuid`)'); |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public function safeDown() |
|
20 | - { |
|
19 | + public function safeDown() |
|
20 | + { |
|
21 | 21 | // remove the uuid |
22 | 22 | $this->dropColumn('dds_object', '_uuid'); |
23 | 23 | // add ids back again |
@@ -25,5 +25,5 @@ discard block |
||
25 | 25 | $this->execute('ALTER TABLE `dds_data_type` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
26 | 26 | $this->execute('ALTER TABLE `dds_member` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
27 | 27 | $this->execute('ALTER TABLE `dds_object` ADD `_id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`_id`)'); |
28 | - } |
|
28 | + } |
|
29 | 29 | } |