@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $users = array(); |
| 87 | 87 | |
| 88 | - if(!$load_stmt->execute()) { |
|
| 88 | + if (!$load_stmt->execute()) { |
|
| 89 | 89 | throw new \Exception("Unable to load users."); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - while($user = $load_stmt->fetch()) { |
|
| 92 | + while ($user = $load_stmt->fetch()) { |
|
| 93 | 93 | |
| 94 | 94 | $users[] = $this->_ScrubUser($user); |
| 95 | 95 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | throw new \Exception("Unable to create user."); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $user->id = (int) $this->app['db']->lastInsertId(); |
|
| 120 | + $user->id = (int)$this->app['db']->lastInsertId(); |
|
| 121 | 121 | |
| 122 | 122 | return $user; |
| 123 | 123 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $result = $update_stmt->execute(); |
| 157 | 157 | |
| 158 | - if($result == false) { |
|
| 158 | + if ($result == false) { |
|
| 159 | 159 | throw new \Exception("Unable to erase verification key for user."); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $delete_stmt = $this->app['db']->prepare("DELETE FROM users WHERE id = ?"); |
| 167 | 167 | $delete_stmt->bindParam(1, $user->id); |
| 168 | 168 | |
| 169 | - if(!$delete_stmt->execute()) { |
|
| 169 | + if (!$delete_stmt->execute()) { |
|
| 170 | 170 | throw new \Exception("Unable to delete user #$user->id"); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | public function NameIsUnique($name, $id = null) { |
| 177 | 177 | $name = strtolower($name); |
| 178 | - if($id == null) { |
|
| 178 | + if ($id == null) { |
|
| 179 | 179 | $name_stmt = $this->app['db']->prepare("SELECT name FROM users WHERE name LIKE ?"); |
| 180 | 180 | $name_stmt->bindParam(1, $name); |
| 181 | 181 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $name_stmt->bindParam(2, $id); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(!$name_stmt->execute()) { |
|
| 187 | + if (!$name_stmt->execute()) { |
|
| 188 | 188 | throw new \Exception(sprintf('Name %s is invalid', $name)); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | public function EmailExists($email, $id = null) { |
| 195 | - if($id == null) { |
|
| 195 | + if ($id == null) { |
|
| 196 | 196 | $email_stmt = $this->app['db']->prepare("SELECT email FROM users WHERE email = ?"); |
| 197 | 197 | $email_stmt->bindParam(1, $email); |
| 198 | 198 | } else { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $email_stmt = $this->app['db']->prepare("SELECT email FROM users WHERE email = ? LIMIT 1"); |
| 214 | 214 | $email_stmt->bindParam(1, $email); |
| 215 | 215 | |
| 216 | - if(!$email_stmt->execute()) { |
|
| 216 | + if (!$email_stmt->execute()) { |
|
| 217 | 217 | throw new \Exception(sprintf('Email %s is invalid', $email)); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $users = array(); |
| 231 | 231 | |
| 232 | - if(!$search_stmt->execute()) { |
|
| 232 | + if (!$search_stmt->execute()) { |
|
| 233 | 233 | throw new \Exception("Unable to load users"); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - while($user = $search_stmt->fetch()) { |
|
| 236 | + while ($user = $search_stmt->fetch()) { |
|
| 237 | 237 | unset($user->enabled); |
| 238 | 238 | unset($user->email); |
| 239 | 239 | unset($user->password); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $verification_stmt->bindParam(1, $email); |
| 254 | 254 | $verification_stmt->bindParam(2, $verificationKey); |
| 255 | 255 | |
| 256 | - if(!$verification_stmt->execute()) { |
|
| 256 | + if (!$verification_stmt->execute()) { |
|
| 257 | 257 | throw new \Exception('Verification is invalid.'); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -25,11 +25,13 @@ discard block |
||
| 25 | 25 | $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user); |
| 26 | 26 | $load_stmt->bindParam(1, $email); |
| 27 | 27 | |
| 28 | - if (!$load_stmt->execute()) |
|
| 29 | - throw new \Exception(sprintf('Email "%s" does not exist.', $email)); |
|
| 28 | + if (!$load_stmt->execute()) { |
|
| 29 | + throw new \Exception(sprintf('Email "%s" does not exist.', $email)); |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | - if (!$load_stmt->fetch()) |
|
| 32 | - throw new \Exception(sprintf('Email "%s" does not exist.', $email)); |
|
| 32 | + if (!$load_stmt->fetch()) { |
|
| 33 | + throw new \Exception(sprintf('Email "%s" does not exist.', $email)); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | return $user; |
| 35 | 37 | } |
@@ -43,11 +45,13 @@ discard block |
||
| 43 | 45 | $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user); |
| 44 | 46 | $load_stmt->bindParam(1, $id); |
| 45 | 47 | |
| 46 | - if (!$load_stmt->execute()) |
|
| 47 | - throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 48 | + if (!$load_stmt->execute()) { |
|
| 49 | + throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 50 | + } |
|
| 48 | 51 | |
| 49 | - if (!$load_stmt->fetch()) |
|
| 50 | - throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 52 | + if (!$load_stmt->fetch()) { |
|
| 53 | + throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 54 | + } |
|
| 51 | 55 | |
| 52 | 56 | return $user; |
| 53 | 57 | } |
@@ -61,11 +65,13 @@ discard block |
||
| 61 | 65 | $load_stmt->setFetchMode(\PDO::FETCH_INTO, $user); |
| 62 | 66 | $load_stmt->bindParam(1, $id); |
| 63 | 67 | |
| 64 | - if (!$load_stmt->execute()) |
|
| 65 | - throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 68 | + if (!$load_stmt->execute()) { |
|
| 69 | + throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 70 | + } |
|
| 66 | 71 | |
| 67 | - if (!$load_stmt->fetch()) |
|
| 68 | - throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 72 | + if (!$load_stmt->fetch()) { |
|
| 73 | + throw new \Exception(sprintf('User #%s does not exist.', $id)); |
|
| 74 | + } |
|
| 69 | 75 | |
| 70 | 76 | unset($user->enabled); |
| 71 | 77 | unset($user->email); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class RoundTimeValidatorTest extends TestCase { |
| 10 | 10 | function setUp() { |
| 11 | - $this->app = require dirname(__FILE__).'/../../../../api/config/_app.php'; |
|
| 11 | + $this->app = require dirname(__FILE__) . '/../../../../api/config/_app.php'; |
|
| 12 | 12 | $this->roundTimeCreateModel = new RoundTimeCreateModel(); |
| 13 | 13 | $this->sut = new RoundTimeValidator($this->app); |
| 14 | 14 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | class PickValidatorTest extends TestCase { |
| 12 | 12 | function setUp() { |
| 13 | - $this->app = require dirname(__FILE__).'/../../../../api/config/_app.php'; |
|
| 13 | + $this->app = require dirname(__FILE__) . '/../../../../api/config/_app.php'; |
|
| 14 | 14 | $draftDataRepository = new DraftDataRepository($this->app); |
| 15 | 15 | $this->app['phpdraft.DraftDataRepository'] = $draftDataRepository; |
| 16 | 16 | $this->sut = new PickValidator($this->app); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ProPlayerValidatorTest extends TestCase { |
| 9 | 9 | function setUp() { |
| 10 | - $this->app = require dirname(__FILE__).'/../../../../api/config/_app.php'; |
|
| 10 | + $this->app = require dirname(__FILE__) . '/../../../../api/config/_app.php'; |
|
| 11 | 11 | $draftDataRepository = new DraftDataRepository($this->app); |
| 12 | 12 | $this->sut = new ProPlayerValidator($this->app); |
| 13 | 13 | $this->app['phpdraft.DraftDataRepository'] = $draftDataRepository; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | class TradeValidatorTest extends TestCase { |
| 13 | 13 | function setUp() { |
| 14 | - $this->app = require dirname(__FILE__).'/../../../../api/config/_app.php'; |
|
| 14 | + $this->app = require dirname(__FILE__) . '/../../../../api/config/_app.php'; |
|
| 15 | 15 | $this->draft = new Draft(); |
| 16 | 16 | $this->trade = new Trade(); |
| 17 | 17 | $this->trade->manager1 = new Manager(); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $items_required_for_packaging = [ |
| 19 | 19 | 'app', |
| 20 | 20 | 'db', |
| 21 | - 'deploy', |
|
| 21 | + 'deploy', |
|
| 22 | 22 | 'gulp' |
| 23 | 23 | ]; |
| 24 | 24 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'db', |
| 96 | 96 | 'deploy', |
| 97 | 97 | 'fonts', |
| 98 | - 'images', |
|
| 98 | + 'images', |
|
| 99 | 99 | 'vendor', |
| 100 | 100 | 'js' |
| 101 | 101 | ]; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'composer.json', |
| 106 | 106 | 'composer.lock', |
| 107 | 107 | 'README.MD', |
| 108 | - 'package.json', |
|
| 108 | + 'package.json', |
|
| 109 | 109 | 'index.html', |
| 110 | 110 | 'web.config' |
| 111 | 111 | ]; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $archivePath = get('phpdraft')['releasePath']; |
| 115 | 115 | |
| 116 | 116 | foreach($phpdraft_release_dirs as $archiveDirectory) { |
| 117 | - runLocally("7z a $archivePath/$releaseFileName $archiveDirectory"); |
|
| 117 | + runLocally("7z a $archivePath/$releaseFileName $archiveDirectory"); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | foreach($phpdraft_release_files as $archiveFile) { |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | //Hard-coded so we copy a working deploy.php so no one technically needs to edit a single file |
| 125 | - runLocally("7z a $archivePath/$releaseFileName deploy/deploy.php.release"); |
|
| 126 | - runLocally("7z a $archivePath/$releaseFileName deploy/appsettings.php.ci"); |
|
| 127 | - runLocally("7z a $archivePath/$releaseFileName deploy/phinx.yml.ci"); |
|
| 128 | - runLocally("7z rn $archivePath/$releaseFileName deploy/deploy.php.release deploy.php"); |
|
| 129 | - runLocally("7z rn $archivePath/$releaseFileName deploy/appsettings.php.ci appsettings.php"); |
|
| 130 | - runLocally("7z rn $archivePath/$releaseFileName deploy/phinx.yml.ci phinx.yml"); |
|
| 131 | - |
|
| 132 | - //Re-include them in case anyone using this packaged release needs CI versions of these! |
|
| 133 | - runLocally("7z a $archivePath/$releaseFileName deploy/appsettings.php.ci"); |
|
| 134 | - runLocally("7z a $archivePath/$releaseFileName deploy/phinx.yml.ci"); |
|
| 125 | + runLocally("7z a $archivePath/$releaseFileName deploy/deploy.php.release"); |
|
| 126 | + runLocally("7z a $archivePath/$releaseFileName deploy/appsettings.php.ci"); |
|
| 127 | + runLocally("7z a $archivePath/$releaseFileName deploy/phinx.yml.ci"); |
|
| 128 | + runLocally("7z rn $archivePath/$releaseFileName deploy/deploy.php.release deploy.php"); |
|
| 129 | + runLocally("7z rn $archivePath/$releaseFileName deploy/appsettings.php.ci appsettings.php"); |
|
| 130 | + runLocally("7z rn $archivePath/$releaseFileName deploy/phinx.yml.ci phinx.yml"); |
|
| 131 | + |
|
| 132 | + //Re-include them in case anyone using this packaged release needs CI versions of these! |
|
| 133 | + runLocally("7z a $archivePath/$releaseFileName deploy/appsettings.php.ci"); |
|
| 134 | + runLocally("7z a $archivePath/$releaseFileName deploy/phinx.yml.ci"); |
|
| 135 | 135 | })->setPrivate(); |
| 136 | 136 | |
| 137 | 137 | desc('Package resources with 7zip'); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | 'gulp' |
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | - foreach($items_required_for_packaging as $directory) { |
|
| 26 | - if(file_exists($directory) !== true) { |
|
| 25 | + foreach ($items_required_for_packaging as $directory) { |
|
| 26 | + if (file_exists($directory) !== true) { |
|
| 27 | 27 | writeln("<error>Directory $directory does not exist, cannot package.</error>\n"); |
| 28 | 28 | writeln("<error>In order to package a release, you must start with sourcecode from the Github repository, not from a prepackaged release from the Github Releases (you've apparently done it backwards :) )</error>\n"); |
| 29 | 29 | throw new \Exception("PHP Draft cannot be packaged for release."); |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $yarn_output = runLocally('yarn -v'); |
| 34 | 34 | |
| 35 | - if(strpos($yarn_output, '.') == false) { |
|
| 35 | + if (strpos($yarn_output, '.') == false) { |
|
| 36 | 36 | writeln('<error>Yarn not found on path. Install Yarn globally for commandline use</error>'); |
| 37 | 37 | throw new \Exception("PHP Draft cannot be packaged for release"); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $sevenZip_output = runLocally('7z'); |
| 41 | 41 | |
| 42 | - if(strpos($sevenZip_output, 'Igor Pavlov') == false) { |
|
| 42 | + if (strpos($sevenZip_output, 'Igor Pavlov') == false) { |
|
| 43 | 43 | writeln('<error>7-Zip not found on path. Install 7-Zip for commandline use</error>'); |
| 44 | 44 | throw new \Exception("PHP Draft cannot be packaged for release"); |
| 45 | 45 | } |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $resourceFileName = get('phpdraft')['resourceFile']; |
| 49 | 49 | $archivePath = get('phpdraft')['releasePath']; |
| 50 | 50 | |
| 51 | - if(file_exists("$archivePath/$releaseFileName")) { |
|
| 51 | + if (file_exists("$archivePath/$releaseFileName")) { |
|
| 52 | 52 | throw new \Exception("File $archivePath/$releaseFileName already exists."); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(file_exists("$archivePath/$resourceFileName")) { |
|
| 55 | + if (file_exists("$archivePath/$resourceFileName")) { |
|
| 56 | 56 | throw new \Exception("File $archivePath/$resourceFileName already exists."); |
| 57 | 57 | } |
| 58 | 58 | })->setPrivate(); |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | $releaseFileName = get('phpdraft')['releaseFile']; |
| 114 | 114 | $archivePath = get('phpdraft')['releasePath']; |
| 115 | 115 | |
| 116 | - foreach($phpdraft_release_dirs as $archiveDirectory) { |
|
| 116 | + foreach ($phpdraft_release_dirs as $archiveDirectory) { |
|
| 117 | 117 | runLocally("7z a $archivePath/$releaseFileName $archiveDirectory"); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - foreach($phpdraft_release_files as $archiveFile) { |
|
| 120 | + foreach ($phpdraft_release_files as $archiveFile) { |
|
| 121 | 121 | runLocally("7z a $archivePath/$releaseFileName $archiveFile"); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $resourceFileName = get('phpdraft')['resourceFile']; |
| 145 | 145 | $archivePath = get('phpdraft')['releasePath']; |
| 146 | 146 | |
| 147 | - foreach($goodResources as $resourceFile) { |
|
| 147 | + foreach ($goodResources as $resourceFile) { |
|
| 148 | 148 | runLocally("7z a $archivePath/$resourceFileName $phpdraft_resource_dir/$resourceFile"); |
| 149 | 149 | } |
| 150 | 150 | })->setPrivate(); |