@@ -1,35 +1,35 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("../Module/Module.php"); |
3 | 3 | class Query extends Module { |
4 | - public $connection; |
|
5 | - public $currentConnection; |
|
6 | - public function __construct() { |
|
7 | - parent::__construct(); |
|
8 | - $this->connection = []; |
|
9 | - $this->currentConnection = null; |
|
10 | - } |
|
11 | - public function addConnection( $_name, $_connection ) { |
|
12 | - $this->connection["$_name"] = $_connection; |
|
13 | - $this->currentConnection = $_connection; |
|
4 | + public $connection; |
|
5 | + public $currentConnection; |
|
6 | + public function __construct() { |
|
7 | + parent::__construct(); |
|
8 | + $this->connection = []; |
|
9 | + $this->currentConnection = null; |
|
10 | + } |
|
11 | + public function addConnection( $_name, $_connection ) { |
|
12 | + $this->connection["$_name"] = $_connection; |
|
13 | + $this->currentConnection = $_connection; |
|
14 | 14 | |
15 | - foreach ($this->modules as &$module) |
|
16 | - if(isset($module->currentConnection)) |
|
17 | - $module->addConnection($_name, $_connection); |
|
18 | - } |
|
19 | - public function setConnection( $_name ) { |
|
20 | - $this->currentConnection = $this->connection["$_name"]; |
|
21 | - } |
|
22 | - public function query( $_query ) { |
|
23 | - return $this->currentConnection->database->query($_query); |
|
24 | - } |
|
25 | - public function queryInsert( $_query ) { |
|
26 | - return $this->currentConnection->database->queryInsert($_query); |
|
27 | - } |
|
28 | - public function queryFetch( $_query ) { |
|
29 | - return $this->currentConnection->database->queryFetch($_query); |
|
30 | - } |
|
31 | - public function queryArray( $_query ) { |
|
32 | - return $this->currentConnection->database->queryArray($_query); |
|
33 | - } |
|
15 | + foreach ($this->modules as &$module) |
|
16 | + if(isset($module->currentConnection)) |
|
17 | + $module->addConnection($_name, $_connection); |
|
18 | + } |
|
19 | + public function setConnection( $_name ) { |
|
20 | + $this->currentConnection = $this->connection["$_name"]; |
|
21 | + } |
|
22 | + public function query( $_query ) { |
|
23 | + return $this->currentConnection->database->query($_query); |
|
24 | + } |
|
25 | + public function queryInsert( $_query ) { |
|
26 | + return $this->currentConnection->database->queryInsert($_query); |
|
27 | + } |
|
28 | + public function queryFetch( $_query ) { |
|
29 | + return $this->currentConnection->database->queryFetch($_query); |
|
30 | + } |
|
31 | + public function queryArray( $_query ) { |
|
32 | + return $this->currentConnection->database->queryArray($_query); |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | ?> |
@@ -8,27 +8,27 @@ |
||
8 | 8 | $this->connection = []; |
9 | 9 | $this->currentConnection = null; |
10 | 10 | } |
11 | - public function addConnection( $_name, $_connection ) { |
|
11 | + public function addConnection($_name, $_connection) { |
|
12 | 12 | $this->connection["$_name"] = $_connection; |
13 | 13 | $this->currentConnection = $_connection; |
14 | 14 | |
15 | 15 | foreach ($this->modules as &$module) |
16 | - if(isset($module->currentConnection)) |
|
16 | + if (isset($module->currentConnection)) |
|
17 | 17 | $module->addConnection($_name, $_connection); |
18 | 18 | } |
19 | - public function setConnection( $_name ) { |
|
19 | + public function setConnection($_name) { |
|
20 | 20 | $this->currentConnection = $this->connection["$_name"]; |
21 | 21 | } |
22 | - public function query( $_query ) { |
|
22 | + public function query($_query) { |
|
23 | 23 | return $this->currentConnection->database->query($_query); |
24 | 24 | } |
25 | - public function queryInsert( $_query ) { |
|
25 | + public function queryInsert($_query) { |
|
26 | 26 | return $this->currentConnection->database->queryInsert($_query); |
27 | 27 | } |
28 | - public function queryFetch( $_query ) { |
|
28 | + public function queryFetch($_query) { |
|
29 | 29 | return $this->currentConnection->database->queryFetch($_query); |
30 | 30 | } |
31 | - public function queryArray( $_query ) { |
|
31 | + public function queryArray($_query) { |
|
32 | 32 | return $this->currentConnection->database->queryArray($_query); |
33 | 33 | } |
34 | 34 | } |
@@ -12,9 +12,10 @@ |
||
12 | 12 | $this->connection["$_name"] = $_connection; |
13 | 13 | $this->currentConnection = $_connection; |
14 | 14 | |
15 | - foreach ($this->modules as &$module) |
|
16 | - if(isset($module->currentConnection)) |
|
15 | + foreach ($this->modules as &$module) { |
|
16 | + if(isset($module->currentConnection)) |
|
17 | 17 | $module->addConnection($_name, $_connection); |
18 | + } |
|
18 | 19 | } |
19 | 20 | public function setConnection( $_name ) { |
20 | 21 | $this->currentConnection = $this->connection["$_name"]; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | function htmlParser( $_str) { |
3 | - return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
|
3 | + return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
|
4 | 4 | } |
5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | - function htmlParser( $_str) { |
|
2 | + function htmlParser($_str) { |
|
3 | 3 | return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
4 | 4 | } |
5 | 5 | ?> |
@@ -1,56 +1,56 @@ |
||
1 | 1 | <?php |
2 | 2 | function getGitLog( $_dir = "./" ) { |
3 | - if(!file_exists($_dir)) |
|
4 | - return []; |
|
5 | - $currentDir = getcwd(); |
|
6 | - chdir($_dir); |
|
7 | - $gitHistory = []; |
|
8 | - $gitLogs = []; |
|
9 | - $gitPath = str_replace('\\', '/', exec("git rev-parse --show-toplevel")); |
|
10 | - $rootPath = str_replace('\\', '/', getcwd ()); |
|
11 | - $lastHash = null; |
|
12 | - if( $gitPath != $rootPath ) { |
|
13 | - chdir($currentDir); |
|
14 | - return []; |
|
15 | - } |
|
16 | - exec("git log --decorate=full --tags", $gitLogs); |
|
17 | - foreach ($gitLogs as $line) { |
|
18 | - $line = trim($line); |
|
19 | - if (!empty($line)) { |
|
20 | - if (strpos($line, 'commit') === 0) { |
|
21 | - $hash = explode(' ', $line); |
|
22 | - $hash = trim(end($hash)); |
|
23 | - $gitHistory[$hash] = [ |
|
24 | - 'tag' => '-1.0.0', |
|
25 | - 'author' => '', |
|
26 | - 'date' => '', |
|
27 | - 'message' => '' |
|
28 | - ]; |
|
29 | - $lastHash = $hash; |
|
30 | - if (strpos($line, 'tag') !== false) { |
|
31 | - $tag = explode(':', $line); |
|
32 | - $tag = explode('/', $tag[1]); |
|
33 | - $tag = explode(',', $tag[2]); |
|
34 | - $tag = explode(')', $tag[0]); |
|
35 | - $tag = trim($tag[0]); |
|
36 | - $gitHistory[$lastHash]['tag'] = $tag; |
|
37 | - } |
|
38 | - } |
|
39 | - else if (strpos($line, 'Author') === 0) { |
|
40 | - $author = explode(':', $line); |
|
41 | - $author = trim(end($author)); |
|
42 | - $gitHistory[$lastHash]['author'] = $author; |
|
43 | - } |
|
44 | - else if (strpos($line, 'Date') === 0) { |
|
45 | - $date = explode(':', $line, 2); |
|
46 | - $date = trim(end($date)); |
|
47 | - $gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
|
48 | - } |
|
49 | - else |
|
50 | - $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
51 | - } |
|
52 | - } |
|
53 | - chdir($currentDir); |
|
54 | - return $gitHistory; |
|
3 | + if(!file_exists($_dir)) |
|
4 | + return []; |
|
5 | + $currentDir = getcwd(); |
|
6 | + chdir($_dir); |
|
7 | + $gitHistory = []; |
|
8 | + $gitLogs = []; |
|
9 | + $gitPath = str_replace('\\', '/', exec("git rev-parse --show-toplevel")); |
|
10 | + $rootPath = str_replace('\\', '/', getcwd ()); |
|
11 | + $lastHash = null; |
|
12 | + if( $gitPath != $rootPath ) { |
|
13 | + chdir($currentDir); |
|
14 | + return []; |
|
15 | + } |
|
16 | + exec("git log --decorate=full --tags", $gitLogs); |
|
17 | + foreach ($gitLogs as $line) { |
|
18 | + $line = trim($line); |
|
19 | + if (!empty($line)) { |
|
20 | + if (strpos($line, 'commit') === 0) { |
|
21 | + $hash = explode(' ', $line); |
|
22 | + $hash = trim(end($hash)); |
|
23 | + $gitHistory[$hash] = [ |
|
24 | + 'tag' => '-1.0.0', |
|
25 | + 'author' => '', |
|
26 | + 'date' => '', |
|
27 | + 'message' => '' |
|
28 | + ]; |
|
29 | + $lastHash = $hash; |
|
30 | + if (strpos($line, 'tag') !== false) { |
|
31 | + $tag = explode(':', $line); |
|
32 | + $tag = explode('/', $tag[1]); |
|
33 | + $tag = explode(',', $tag[2]); |
|
34 | + $tag = explode(')', $tag[0]); |
|
35 | + $tag = trim($tag[0]); |
|
36 | + $gitHistory[$lastHash]['tag'] = $tag; |
|
37 | + } |
|
38 | + } |
|
39 | + else if (strpos($line, 'Author') === 0) { |
|
40 | + $author = explode(':', $line); |
|
41 | + $author = trim(end($author)); |
|
42 | + $gitHistory[$lastHash]['author'] = $author; |
|
43 | + } |
|
44 | + else if (strpos($line, 'Date') === 0) { |
|
45 | + $date = explode(':', $line, 2); |
|
46 | + $date = trim(end($date)); |
|
47 | + $gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
|
48 | + } |
|
49 | + else |
|
50 | + $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
51 | + } |
|
52 | + } |
|
53 | + chdir($currentDir); |
|
54 | + return $gitHistory; |
|
55 | 55 | } |
56 | 56 | ?> |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | - function getGitLog( $_dir = "./" ) { |
|
3 | - if(!file_exists($_dir)) |
|
2 | + function getGitLog($_dir = "./") { |
|
3 | + if (!file_exists($_dir)) |
|
4 | 4 | return []; |
5 | 5 | $currentDir = getcwd(); |
6 | 6 | chdir($_dir); |
7 | 7 | $gitHistory = []; |
8 | 8 | $gitLogs = []; |
9 | 9 | $gitPath = str_replace('\\', '/', exec("git rev-parse --show-toplevel")); |
10 | - $rootPath = str_replace('\\', '/', getcwd ()); |
|
10 | + $rootPath = str_replace('\\', '/', getcwd()); |
|
11 | 11 | $lastHash = null; |
12 | - if( $gitPath != $rootPath ) { |
|
12 | + if ($gitPath != $rootPath) { |
|
13 | 13 | chdir($currentDir); |
14 | 14 | return []; |
15 | 15 | } |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | function getGitLog( $_dir = "./" ) { |
3 | - if(!file_exists($_dir)) |
|
4 | - return []; |
|
3 | + if(!file_exists($_dir)) { |
|
4 | + return []; |
|
5 | + } |
|
5 | 6 | $currentDir = getcwd(); |
6 | 7 | chdir($_dir); |
7 | 8 | $gitHistory = []; |
@@ -35,19 +36,17 @@ discard block |
||
35 | 36 | $tag = trim($tag[0]); |
36 | 37 | $gitHistory[$lastHash]['tag'] = $tag; |
37 | 38 | } |
38 | - } |
|
39 | - else if (strpos($line, 'Author') === 0) { |
|
39 | + } else if (strpos($line, 'Author') === 0) { |
|
40 | 40 | $author = explode(':', $line); |
41 | 41 | $author = trim(end($author)); |
42 | 42 | $gitHistory[$lastHash]['author'] = $author; |
43 | - } |
|
44 | - else if (strpos($line, 'Date') === 0) { |
|
43 | + } else if (strpos($line, 'Date') === 0) { |
|
45 | 44 | $date = explode(':', $line, 2); |
46 | 45 | $date = trim(end($date)); |
47 | 46 | $gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
47 | + } else { |
|
48 | + $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
48 | 49 | } |
49 | - else |
|
50 | - $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
51 | 50 | } |
52 | 51 | } |
53 | 52 | chdir($currentDir); |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | <div class="row" style="margin-top:20px;"> |
16 | 16 | <div class="col-lg-12"> |
17 | 17 | <?php |
18 | - $nPerCol = 6; |
|
19 | - $max = 12; |
|
20 | - $dim = $max / $nPerCol; |
|
21 | - $cont = 0; |
|
22 | - $percent; |
|
23 | - foreach (getGitLog() as $i) { |
|
24 | - $cont++; |
|
25 | - if($cont % $nPerCol == 1) |
|
26 | - echo '<div class="row">'; |
|
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
29 | - $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
|
30 | - } |
|
31 | - ?> |
|
18 | + $nPerCol = 6; |
|
19 | + $max = 12; |
|
20 | + $dim = $max / $nPerCol; |
|
21 | + $cont = 0; |
|
22 | + $percent; |
|
23 | + foreach (getGitLog() as $i) { |
|
24 | + $cont++; |
|
25 | + if($cont % $nPerCol == 1) |
|
26 | + echo '<div class="row">'; |
|
27 | + if(isset($i["tag"])) { |
|
28 | + $percent = explode(".",$i["tag"]); |
|
29 | + $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
|
30 | + } |
|
31 | + ?> |
|
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
48 | - echo '</div>'; |
|
49 | - } ?> |
|
47 | + if($cont % $nPerCol == 0) |
|
48 | + echo '</div>'; |
|
49 | + } ?> |
|
50 | 50 | </div> |
51 | 51 | </div> |
52 | 52 | </div> |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
25 | + if ($cont % $nPerCol == 1) |
|
26 | 26 | echo '<div class="row">'; |
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
27 | + if (isset($i["tag"])) { |
|
28 | + $percent = explode(".", $i["tag"]); |
|
29 | 29 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
30 | 30 | } |
31 | 31 | ?> |
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
35 | + <div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | 36 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 37 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 38 | <div class="progress"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
47 | + if ($cont % $nPerCol == 0) |
|
48 | 48 | echo '</div>'; |
49 | 49 | } ?> |
50 | 50 | </div> |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
26 | - echo '<div class="row">'; |
|
25 | + if($cont % $nPerCol == 1) { |
|
26 | + echo '<div class="row">'; |
|
27 | + } |
|
27 | 28 | if(isset($i["tag"])) { |
28 | 29 | $percent = explode(".",$i["tag"]); |
29 | 30 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | <div class="col-lg-<?=$dim?>"> |
33 | 34 | <div class="well well-sm miniblock"> |
34 | 35 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | + <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) { |
|
37 | + echo $i["tag"]?><br></div> |
|
36 | 38 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 39 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 40 | <div class="progress"> |
@@ -46,6 +48,7 @@ discard block |
||
46 | 48 | <?php |
47 | 49 | if($cont % $nPerCol == 0) |
48 | 50 | echo '</div>'; |
51 | +} |
|
49 | 52 | } ?> |
50 | 53 | </div> |
51 | 54 | </div> |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | if(!isset($GLOBALS["JATEPath"])) |
3 | - $GLOBALS["JATEPath"] = []; |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | 4 | $commonLocations = [ |
5 | - "bower_components/JATE/dist/" |
|
6 | - , "vendor/xaberr/jate/dist/" |
|
7 | - , "../../dist/" |
|
8 | - , "../dist/" |
|
9 | - , dirname(__FILE__)."/" |
|
5 | + "bower_components/JATE/dist/" |
|
6 | + , "vendor/xaberr/jate/dist/" |
|
7 | + , "../../dist/" |
|
8 | + , "../dist/" |
|
9 | + , dirname(__FILE__)."/" |
|
10 | 10 | ]; |
11 | 11 | $jSuccess = false; |
12 | 12 | foreach ($commonLocations as $path) |
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | - array_push($GLOBALS["JATEPath"], $path); |
|
15 | - require_once("${path}jate/coreEngine.php"); |
|
16 | - $jSuccess = true; |
|
17 | - break; |
|
18 | - } |
|
13 | + if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | + array_push($GLOBALS["JATEPath"], $path); |
|
15 | + require_once("${path}jate/coreEngine.php"); |
|
16 | + $jSuccess = true; |
|
17 | + break; |
|
18 | + } |
|
19 | 19 | if( !$jSuccess ) |
20 | - throw new Exception("JATE can't find coreEngine.php."); |
|
20 | + throw new Exception("JATE can't find coreEngine.php."); |
|
21 | 21 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
2 | + if (!isset($GLOBALS["JATEPath"])) |
|
3 | 3 | $GLOBALS["JATEPath"] = []; |
4 | 4 | $commonLocations = [ |
5 | 5 | "bower_components/JATE/dist/" |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | ]; |
11 | 11 | $jSuccess = false; |
12 | 12 | foreach ($commonLocations as $path) |
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
13 | + if (file_exists("${path}jate/coreEngine.php")) { |
|
14 | 14 | array_push($GLOBALS["JATEPath"], $path); |
15 | 15 | require_once("${path}jate/coreEngine.php"); |
16 | 16 | $jSuccess = true; |
17 | 17 | break; |
18 | 18 | } |
19 | - if( !$jSuccess ) |
|
19 | + if (!$jSuccess) |
|
20 | 20 | throw new Exception("JATE can't find coreEngine.php."); |
21 | 21 | ?> |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
3 | - $GLOBALS["JATEPath"] = []; |
|
2 | + if(!isset($GLOBALS["JATEPath"])) { |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | + } |
|
4 | 5 | $commonLocations = [ |
5 | 6 | "bower_components/JATE/dist/" |
6 | 7 | , "vendor/xaberr/jate/dist/" |
@@ -9,13 +10,15 @@ discard block |
||
9 | 10 | , dirname(__FILE__)."/" |
10 | 11 | ]; |
11 | 12 | $jSuccess = false; |
12 | - foreach ($commonLocations as $path) |
|
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
13 | + foreach ($commonLocations as $path) { |
|
14 | + if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | 15 | array_push($GLOBALS["JATEPath"], $path); |
16 | + } |
|
15 | 17 | require_once("${path}jate/coreEngine.php"); |
16 | 18 | $jSuccess = true; |
17 | 19 | break; |
18 | 20 | } |
19 | - if( !$jSuccess ) |
|
20 | - throw new Exception("JATE can't find coreEngine.php."); |
|
21 | -?> |
|
21 | + if( !$jSuccess ) { |
|
22 | + throw new Exception("JATE can't find coreEngine.php."); |
|
23 | + } |
|
24 | + ?> |
@@ -2,60 +2,60 @@ |
||
2 | 2 | declare( strict_types = 1 ); |
3 | 3 | // backward compatibility |
4 | 4 | if (!class_exists('\PHPUnit\Framework\TestCase')) { |
5 | - class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); |
|
5 | + class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); |
|
6 | 6 | } |
7 | 7 | use PHPUnit\Framework\TestCase; |
8 | 8 | |
9 | 9 | final class ModuleTest extends TestCase { |
10 | - public function testAddFile() { |
|
11 | - $this->expectException(InvalidArgumentException::class); |
|
12 | - $module = new Module(); |
|
13 | - $module->addFile(123); |
|
14 | - } |
|
15 | - public function testAddFileRequired() { |
|
16 | - $this->expectException(InvalidArgumentException::class); |
|
17 | - $module = new Module(); |
|
18 | - $module->addFileRequired(123); |
|
19 | - } |
|
20 | - public function testAddFiles() { |
|
21 | - $this->expectException(InvalidArgumentException::class); |
|
22 | - $module = new Module(); |
|
23 | - $module->addFiles("/file.php"); |
|
24 | - } |
|
25 | - public function testAddFilesRequired() { |
|
26 | - $this->expectException(InvalidArgumentException::class); |
|
27 | - $module = new Module(); |
|
28 | - $module->addFilesRequired("/file.php"); |
|
29 | - } |
|
30 | - public function testAddModuleClass() { |
|
31 | - $this->expectException(InvalidArgumentException::class); |
|
32 | - $module = new Module(); |
|
33 | - $module->addModule(123); |
|
34 | - } |
|
35 | - public function testAddModuleNoModule() { |
|
36 | - $this->expectException(InvalidArgumentException::class); |
|
37 | - $module = new Module(); |
|
38 | - $module->addModule((object)[1,2,3]); |
|
39 | - } |
|
40 | - public function testAddModules() { |
|
41 | - $this->expectException(InvalidArgumentException::class); |
|
42 | - $module = new Module(); |
|
43 | - $module->addModules("Module"); |
|
44 | - } |
|
45 | - public function testGetCss() { |
|
46 | - $module = new Module(); |
|
47 | - $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
48 | - $this->assertEquals(["1.css","3.css"], $module->getCss()); |
|
49 | - } |
|
50 | - public function testGetJs() { |
|
51 | - $module = new Module(); |
|
52 | - $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
53 | - $this->assertEquals(["2.js","4.js"], $module->getJs()); |
|
54 | - } |
|
55 | - public function testGetJsVariables() { |
|
56 | - $module = new Module(); |
|
57 | - $module->addFiles(["1.css",["variable","2"],"3.css","4.js"]); |
|
58 | - $this->assertEquals([["variable","2"]], $module->getJsVariables()); |
|
59 | - } |
|
10 | + public function testAddFile() { |
|
11 | + $this->expectException(InvalidArgumentException::class); |
|
12 | + $module = new Module(); |
|
13 | + $module->addFile(123); |
|
14 | + } |
|
15 | + public function testAddFileRequired() { |
|
16 | + $this->expectException(InvalidArgumentException::class); |
|
17 | + $module = new Module(); |
|
18 | + $module->addFileRequired(123); |
|
19 | + } |
|
20 | + public function testAddFiles() { |
|
21 | + $this->expectException(InvalidArgumentException::class); |
|
22 | + $module = new Module(); |
|
23 | + $module->addFiles("/file.php"); |
|
24 | + } |
|
25 | + public function testAddFilesRequired() { |
|
26 | + $this->expectException(InvalidArgumentException::class); |
|
27 | + $module = new Module(); |
|
28 | + $module->addFilesRequired("/file.php"); |
|
29 | + } |
|
30 | + public function testAddModuleClass() { |
|
31 | + $this->expectException(InvalidArgumentException::class); |
|
32 | + $module = new Module(); |
|
33 | + $module->addModule(123); |
|
34 | + } |
|
35 | + public function testAddModuleNoModule() { |
|
36 | + $this->expectException(InvalidArgumentException::class); |
|
37 | + $module = new Module(); |
|
38 | + $module->addModule((object)[1,2,3]); |
|
39 | + } |
|
40 | + public function testAddModules() { |
|
41 | + $this->expectException(InvalidArgumentException::class); |
|
42 | + $module = new Module(); |
|
43 | + $module->addModules("Module"); |
|
44 | + } |
|
45 | + public function testGetCss() { |
|
46 | + $module = new Module(); |
|
47 | + $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
48 | + $this->assertEquals(["1.css","3.css"], $module->getCss()); |
|
49 | + } |
|
50 | + public function testGetJs() { |
|
51 | + $module = new Module(); |
|
52 | + $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
53 | + $this->assertEquals(["2.js","4.js"], $module->getJs()); |
|
54 | + } |
|
55 | + public function testGetJsVariables() { |
|
56 | + $module = new Module(); |
|
57 | + $module->addFiles(["1.css",["variable","2"],"3.css","4.js"]); |
|
58 | + $this->assertEquals([["variable","2"]], $module->getJsVariables()); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - declare( strict_types = 1 ); |
|
2 | + declare(strict_types = 1); |
|
3 | 3 | // backward compatibility |
4 | 4 | if (!class_exists('\PHPUnit\Framework\TestCase')) { |
5 | 5 | class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function testAddModuleNoModule() { |
36 | 36 | $this->expectException(InvalidArgumentException::class); |
37 | 37 | $module = new Module(); |
38 | - $module->addModule((object)[1,2,3]); |
|
38 | + $module->addModule((object) [1, 2, 3]); |
|
39 | 39 | } |
40 | 40 | public function testAddModules() { |
41 | 41 | $this->expectException(InvalidArgumentException::class); |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | } |
45 | 45 | public function testGetCss() { |
46 | 46 | $module = new Module(); |
47 | - $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
48 | - $this->assertEquals(["1.css","3.css"], $module->getCss()); |
|
47 | + $module->addFiles(["1.css", "2.js", "3.css", "4.js"]); |
|
48 | + $this->assertEquals(["1.css", "3.css"], $module->getCss()); |
|
49 | 49 | } |
50 | 50 | public function testGetJs() { |
51 | 51 | $module = new Module(); |
52 | - $module->addFiles(["1.css","2.js","3.css","4.js"]); |
|
53 | - $this->assertEquals(["2.js","4.js"], $module->getJs()); |
|
52 | + $module->addFiles(["1.css", "2.js", "3.css", "4.js"]); |
|
53 | + $this->assertEquals(["2.js", "4.js"], $module->getJs()); |
|
54 | 54 | } |
55 | 55 | public function testGetJsVariables() { |
56 | 56 | $module = new Module(); |
57 | - $module->addFiles(["1.css",["variable","2"],"3.css","4.js"]); |
|
58 | - $this->assertEquals([["variable","2"]], $module->getJsVariables()); |
|
57 | + $module->addFiles(["1.css", ["variable", "2"], "3.css", "4.js"]); |
|
58 | + $this->assertEquals([["variable", "2"]], $module->getJsVariables()); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | ?> |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionPostgresqlAdapter implements ConnectionAdapterInterface { |
4 | - public $connection; |
|
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | - $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass") |
|
7 | - or die('Could not connect: '.pg_last_error()); |
|
8 | - } |
|
9 | - public function query( $_query ) { |
|
10 | - $this->stdQuery($_query); |
|
11 | - return true; |
|
12 | - } |
|
13 | - public function queryInsert( $_query ) { |
|
14 | - $this->stdQuery($_query); |
|
15 | - return $this->stdQuery("SELECT lastval()"); |
|
16 | - } |
|
17 | - public function queryFetch( $_query ) { |
|
18 | - $result = $this->stdQuery($_query); |
|
19 | - $rows = []; |
|
20 | - while($row = pg_fetch_assoc($result)) |
|
21 | - $rows[] = $row; |
|
22 | - pg_free_result($result); |
|
23 | - return $rows; |
|
24 | - } |
|
25 | - public function queryArray( $_query ) { |
|
26 | - $result = $this->stdQuery($_query); |
|
27 | - $rows = []; |
|
28 | - while($row = pg_fetch_array($result)) |
|
29 | - $rows[] = $row; |
|
30 | - pg_free_result($result); |
|
31 | - return $rows; |
|
32 | - } |
|
33 | - protected function stdQuery( $_query ) { |
|
34 | - $database = $this->connection; |
|
35 | - $error = "Error query [$_query]"; |
|
36 | - $result = pg_query($database, $_query); |
|
37 | - if(!$result) { |
|
38 | - echo "$_query<br>"; |
|
39 | - echo "Something wrong: $error"; |
|
40 | - var_dump(pg_last_error()); |
|
41 | - exit(); |
|
42 | - } |
|
43 | - return $result; |
|
44 | - } |
|
4 | + public $connection; |
|
5 | + public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
6 | + $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass") |
|
7 | + or die('Could not connect: '.pg_last_error()); |
|
8 | + } |
|
9 | + public function query( $_query ) { |
|
10 | + $this->stdQuery($_query); |
|
11 | + return true; |
|
12 | + } |
|
13 | + public function queryInsert( $_query ) { |
|
14 | + $this->stdQuery($_query); |
|
15 | + return $this->stdQuery("SELECT lastval()"); |
|
16 | + } |
|
17 | + public function queryFetch( $_query ) { |
|
18 | + $result = $this->stdQuery($_query); |
|
19 | + $rows = []; |
|
20 | + while($row = pg_fetch_assoc($result)) |
|
21 | + $rows[] = $row; |
|
22 | + pg_free_result($result); |
|
23 | + return $rows; |
|
24 | + } |
|
25 | + public function queryArray( $_query ) { |
|
26 | + $result = $this->stdQuery($_query); |
|
27 | + $rows = []; |
|
28 | + while($row = pg_fetch_array($result)) |
|
29 | + $rows[] = $row; |
|
30 | + pg_free_result($result); |
|
31 | + return $rows; |
|
32 | + } |
|
33 | + protected function stdQuery( $_query ) { |
|
34 | + $database = $this->connection; |
|
35 | + $error = "Error query [$_query]"; |
|
36 | + $result = pg_query($database, $_query); |
|
37 | + if(!$result) { |
|
38 | + echo "$_query<br>"; |
|
39 | + echo "Something wrong: $error"; |
|
40 | + var_dump(pg_last_error()); |
|
41 | + exit(); |
|
42 | + } |
|
43 | + return $result; |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | ?> |
@@ -2,39 +2,39 @@ |
||
2 | 2 | jRequire("ConnectionInterface.php"); |
3 | 3 | class ConnectionPostgresqlAdapter implements ConnectionAdapterInterface { |
4 | 4 | public $connection; |
5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
6 | 6 | $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass") |
7 | 7 | or die('Could not connect: '.pg_last_error()); |
8 | 8 | } |
9 | - public function query( $_query ) { |
|
9 | + public function query($_query) { |
|
10 | 10 | $this->stdQuery($_query); |
11 | 11 | return true; |
12 | 12 | } |
13 | - public function queryInsert( $_query ) { |
|
13 | + public function queryInsert($_query) { |
|
14 | 14 | $this->stdQuery($_query); |
15 | 15 | return $this->stdQuery("SELECT lastval()"); |
16 | 16 | } |
17 | - public function queryFetch( $_query ) { |
|
17 | + public function queryFetch($_query) { |
|
18 | 18 | $result = $this->stdQuery($_query); |
19 | 19 | $rows = []; |
20 | - while($row = pg_fetch_assoc($result)) |
|
20 | + while ($row = pg_fetch_assoc($result)) |
|
21 | 21 | $rows[] = $row; |
22 | 22 | pg_free_result($result); |
23 | 23 | return $rows; |
24 | 24 | } |
25 | - public function queryArray( $_query ) { |
|
25 | + public function queryArray($_query) { |
|
26 | 26 | $result = $this->stdQuery($_query); |
27 | 27 | $rows = []; |
28 | - while($row = pg_fetch_array($result)) |
|
28 | + while ($row = pg_fetch_array($result)) |
|
29 | 29 | $rows[] = $row; |
30 | 30 | pg_free_result($result); |
31 | 31 | return $rows; |
32 | 32 | } |
33 | - protected function stdQuery( $_query ) { |
|
33 | + protected function stdQuery($_query) { |
|
34 | 34 | $database = $this->connection; |
35 | 35 | $error = "Error query [$_query]"; |
36 | 36 | $result = pg_query($database, $_query); |
37 | - if(!$result) { |
|
37 | + if (!$result) { |
|
38 | 38 | echo "$_query<br>"; |
39 | 39 | echo "Something wrong: $error"; |
40 | 40 | var_dump(pg_last_error()); |
@@ -17,16 +17,18 @@ |
||
17 | 17 | public function queryFetch( $_query ) { |
18 | 18 | $result = $this->stdQuery($_query); |
19 | 19 | $rows = []; |
20 | - while($row = pg_fetch_assoc($result)) |
|
21 | - $rows[] = $row; |
|
20 | + while($row = pg_fetch_assoc($result)) { |
|
21 | + $rows[] = $row; |
|
22 | + } |
|
22 | 23 | pg_free_result($result); |
23 | 24 | return $rows; |
24 | 25 | } |
25 | 26 | public function queryArray( $_query ) { |
26 | 27 | $result = $this->stdQuery($_query); |
27 | 28 | $rows = []; |
28 | - while($row = pg_fetch_array($result)) |
|
29 | - $rows[] = $row; |
|
29 | + while($row = pg_fetch_array($result)) { |
|
30 | + $rows[] = $row; |
|
31 | + } |
|
30 | 32 | pg_free_result($result); |
31 | 33 | return $rows; |
32 | 34 | } |