Passed
Branch master (ecaff5)
by Joao
02:24
created
src/builder/_Lib.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
         return $this->systemOs;
34 34
     }
35 35
 
36
+    /**
37
+     * @param string $command
38
+     */
36 39
     public function fixDir($command)
37 40
     {
38 41
         if ($this->getSystemOs() === "Windows") {
@@ -44,7 +47,7 @@  discard block
 block discarded – undo
44 47
     /**
45 48
      * Execute the given command by displaying console output live to the user.
46 49
      *
47
-     * @param string|array $cmd :  command to be executed
50
+     * @param string $cmd :  command to be executed
48 51
      * @return array   exit_status  :  exit status of the executed command
49 52
      *                  output       :  console output of the executed command
50 53
      * @throws ConfigNotFoundException
@@ -100,7 +103,7 @@  discard block
 block discarded – undo
100 103
     }
101 104
 
102 105
     /**
103
-     * @param string|Closure $variableValue
106
+     * @param string $variableValue
104 107
      * @return mixed
105 108
      * @throws ConfigNotFoundException
106 109
      * @throws EnvironmentException
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function __construct()
18 18
     {
19
-        $this->workdir = realpath(__DIR__ . '/../..');
19
+        $this->workdir = realpath(__DIR__.'/../..');
20 20
     }
21 21
 
22 22
     public function getSystemOs()
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         while (!feof($proc)) {
79 79
             $liveOutput     = fread($proc, 4096);
80
-            $completeOutput = $completeOutput . $liveOutput;
80
+            $completeOutput = $completeOutput.$liveOutput;
81 81
             echo "$liveOutput";
82 82
             @ flush();
83 83
         }
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         // }
94 94
 
95 95
         // return exit status and intended output
96
-        return array (
96
+        return array(
97 97
             'exit_status'  => $exitStatus,
98
-            'output'       => str_replace("Exit status : " . $matches[0], '', $completeOutput)
98
+            'output'       => str_replace("Exit status : ".$matches[0], '', $completeOutput)
99 99
         );
100 100
     }
101 101
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             foreach ($args[0] as $arg) {
116 116
                 $variableValue = str_replace(
117 117
                     $arg,
118
-                    Psr11::container()->get(substr($arg,1, -1)),
118
+                    Psr11::container()->get(substr($arg, 1, -1)),
119 119
                     $variableValue
120 120
                 );
121 121
             }
Please login to merge, or discard this patch.
src/project/Rest/Login.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 use ByJG\RestServer\ResponseBag;
16 16
 use Psr\SimpleCache\InvalidArgumentException;
17 17
 use ReflectionException;
18
-use RestTemplate\Model\User;
19 18
 use Swagger\Annotations as SWG;
20 19
 
21 20
 class Login extends ServiceAbstractBase
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
         }
132 132
 
133 133
         $users = Psr11::container()->get(UsersDBDataset::class);
134
-        $user = $users->getById(new Literal("X'" . str_replace("-", "", $result["data"]["userid"]) . "'"));
134
+        $user = $users->getById(new Literal("X'".str_replace("-", "", $result["data"]["userid"])."'"));
135 135
 
136 136
         $metadata = $this->createUserMetadata($user);
137 137
         
Please login to merge, or discard this patch.
src/project/Rest/ServiceAbstractBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     {
65 65
         $data = $this->requireAuthenticated($token);
66 66
         if ($data['role'] !== $role) {
67
-            throw new Error401Exception('Insufficient privileges - ' . print_r($data, true));
67
+            throw new Error401Exception('Insufficient privileges - '.print_r($data, true));
68 68
         }
69 69
         return $data;
70 70
     }
Please login to merge, or discard this patch.
src/project/Repository/BaseRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function get($itemId)
26 26
     {
27 27
         if (!($itemId instanceof Literal) && preg_match("/^\d{8}-?\d{4}-?\d{4}-?\d{4}-?\d{12}$/", $itemId)) {
28
-            $itemId = new Literal("X'" . str_replace("-", "", $itemId) . "'");
28
+            $itemId = new Literal("X'".str_replace("-", "", $itemId)."'");
29 29
         }
30 30
         return $this->repository->get($itemId);
31 31
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         $query = Query::getInstance()
53 53
             ->table($this->repository->getMapper()->getTable())
54
-            ->limit($page*$size, $size);
54
+            ->limit($page * $size, $size);
55 55
 
56 56
         if (!empty($orderBy)) {
57 57
             if (!is_array($orderBy)) {
Please login to merge, or discard this patch.
src/builder/PostCreateScript.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         // ------------------------------------------------
17 17
         // Defining function to interatively walking through the directories
18 18
         $directory = new RecursiveDirectoryIterator($workdir);
19
-        $filter = new RecursiveCallbackFilterIterator($directory, function ($current/*, $key, $iterator*/) {
19
+        $filter = new RecursiveCallbackFilterIterator($directory, function($current/*, $key, $iterator*/) {
20 20
             // Skip hidden files and directories.
21 21
             if ($current->getFilename()[0] === '.') {
22 22
                 return false;
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 
37 37
         // ------------------------------------------------
38 38
         //Replace composer name:
39
-        $contents = file_get_contents($workdir . '/composer.json');
39
+        $contents = file_get_contents($workdir.'/composer.json');
40 40
         file_put_contents(
41
-            $workdir . '/composer.json',
41
+            $workdir.'/composer.json',
42 42
             str_replace('byjg/resttemplate', $composerName, $contents)
43 43
         );
44 44
 
45 45
         // ------------------------------------------------
46 46
         // Replace Docker PHP Version
47
-        $files = [ 'docker/Dockerfile', 'docker/Dockerfile-dev' ];
47
+        $files = ['docker/Dockerfile', 'docker/Dockerfile-dev'];
48 48
         foreach ($files as $file) {
49 49
             $contents = file_get_contents("$workdir/$file");
50 50
             $contents = str_replace('ENV TZ=America/Sao_Paulo', "ENV TZ=${timezone}", $contents);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // Adjusting config files
59 59
         $files = [
60 60
             'config/config-dev.php',
61
-            'config/config-staging.php' ,
61
+            'config/config-staging.php',
62 62
             'config/config-prod.php',
63 63
             'config/config-test.php',
64 64
             'docker-compose.yml',
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $uri = new Uri($mysqlConnection);
68 68
         foreach ($files as $file) {
69 69
             $contents = file_get_contents("$workdir/$file");
70
-            $contents = str_replace( 'jwt_super_secret_key', JwtWrapper::generateSecret(64), $contents);
70
+            $contents = str_replace('jwt_super_secret_key', JwtWrapper::generateSecret(64), $contents);
71 71
             $contents = str_replace('mysql://root:mysqlp455w0rd@mysql-container/mydb', "$mysqlConnection", $contents);
72 72
             $contents = str_replace('mysql-container', $uri->getHost(), $contents);
73 73
             $contents = str_replace('mysqlp455w0rd', $uri->getPassword(), $contents);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 // Replace inside Quotes
90 90
                 $contents = preg_replace(
91 91
                     "/([\'\"])RestTemplate(.*?[\'\"])/",
92
-                    '$1' . str_replace('\\', '\\\\\\\\', $namespace) . '$2',
92
+                    '$1'.str_replace('\\', '\\\\\\\\', $namespace).'$2',
93 93
                     $contents
94 94
                 );
95 95
 
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 
115 115
     public static function run(Event $event)
116 116
     {
117
-        $workdir = realpath(__DIR__ . '/../..');
117
+        $workdir = realpath(__DIR__.'/../..');
118 118
         $stdIo = $event->getIO();
119 119
 
120 120
         $stdIo->write("========================================================");
121 121
         $stdIo->write("  Setup RestTemplate");
122 122
         $stdIo->write("========================================================");
123 123
         $stdIo->write("");
124
-        $stdIo->write("Project Directory: " . $workdir);
124
+        $stdIo->write("Project Directory: ".$workdir);
125 125
         $phpVersion = $stdIo->ask('PHP Version [7.2]: ', '7.2');
126 126
         $namespace = $stdIo->ask('Project namespace [MyRest]: ', 'MyRest');
127 127
         $composerName = $stdIo->ask('Composer name [me/myrest]: ', 'me/myrest');
Please login to merge, or discard this patch.
src/builder/Scripts.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 
69 69
         $dbConnection = Psr11::container($argumentList["--env"])->get('DBDRIVER_CONNECTION');
70 70
 
71
-        $migration = new Migration(new Uri($dbConnection), $this->workdir . "/db");
71
+        $migration = new Migration(new Uri($dbConnection), $this->workdir."/db");
72 72
         $migration->registerDatabase("mysql", MySqlDatabase::class);
73
-        $migration->addCallbackProgress(function ($cmd, $version) {
73
+        $migration->addCallbackProgress(function($cmd, $version) {
74 74
             echo "Doing $cmd, $version\n";
75 75
         });
76 76
 
77
-        $exec['reset'] = function () use ($migration, $argumentList) {
77
+        $exec['reset'] = function() use ($migration, $argumentList) {
78 78
             if (!$argumentList["--yes"]) {
79 79
                 throw new Exception("Reset require the argument --yes");
80 80
             }
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
         };
84 84
 
85 85
 
86
-        $exec["update"] = function () use ($migration, $argumentList) {
86
+        $exec["update"] = function() use ($migration, $argumentList) {
87 87
             $migration->update($argumentList["--up-to"], $argumentList["--force"]);
88 88
         };
89 89
 
90
-        $exec["version"] = function () use ($migration, $argumentList) {
90
+        $exec["version"] = function() use ($migration, $argumentList) {
91 91
             foreach ($migration->getCurrentVersion() as $key => $value) {
92 92
                 echo "$key: $value\n";
93 93
             }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $start = 1;
116 116
         }
117 117
 
118
-        for ($i=$start; $i < count($arguments); $i++) {
118
+        for ($i = $start; $i < count($arguments); $i++) {
119 119
             $args = explode("=", $arguments[$i]);
120 120
             $ret[$args[0]] = isset($args[1]) ? $args[1] : true;
121 121
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function runGenRestDocs($arguments)
135 135
     {
136
-        $docPath = $this->workdir . '/web/docs/';
136
+        $docPath = $this->workdir.'/web/docs/';
137 137
         chdir($this->workdir);
138 138
         $this->liveExecuteCommand(
139 139
             $this->fixDir("vendor/bin/swagger")
Please login to merge, or discard this patch.