Skip to content

Commit 493c1eb

Browse files
committed
Fixed some scrutinizer issues
1 parent 25878f3 commit 493c1eb

File tree

10 files changed

+46
-31
lines changed

10 files changed

+46
-31
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,27 @@
44

55
# laravel-database-manager
66
Make your database simple and easyer
7+
8+
# Install package
9+
10+
```
11+
composer require codexshaper/laravel-database-manager
12+
```
13+
14+
# Setup database manager
15+
16+
```
17+
php artisan dbm:install
18+
```
19+
20+
# Create admin account to access all features
21+
22+
```
23+
php artisan dbm:admin 'user' 'action' 'options'
24+
```
25+
Example
26+
```
27+
php artisan [email protected] create --columns=email
28+
```
29+
30+
In this case ```email``` must be exists in your users table and ```[email protected]``` must be a record

src/Database/Drivers/MongoDB.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function getColumns($collectionName)
390390
*
391391
* @param string $collectionName
392392
*
393-
* @return \Illuminate\Support\Collection
393+
* @return array
394394
*/
395395
public function getColumnsName($collectionName)
396396
{

src/Database/Drivers/MongoDB/Field.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class Field
1010
* Create MongoDB collection field
1111
*
1212
* @param string $collection
13-
* @param clousure $clousure
1413
*
1514
* @return \CodexShaper\DBM\Database\Drivers\MongoDB\Collection
1615
*/

src/Database/Drivers/MongoDB/Type.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,10 @@ public static function decimal(string $value)
5656
/**
5757
* Get javascript
5858
*
59-
* @param string $code
60-
* @param array $scope
61-
*
6259
* @return \MongoDB\BSON\Javascript
6360
*/
64-
public static function javascript(string $code, $scope = [])
61+
public static function javascript(string $code, array $scope = [])
6562
{
66-
if (!is_array($scope) || !is_array()) {
67-
throw new \Exception($scope . " should be array or object");
68-
69-
}
70-
7163
return new Javascript($code, $scope);
7264
}
7365
/**
@@ -102,9 +94,9 @@ public static function objectId(string $value)
10294
*
10395
* @return \MongoDB\BSON\Regex
10496
*/
105-
public static function regex(string $pattern, string $flags)
97+
public static function regex(string $pattern, string $flags = "")
10698
{
107-
return new Regex($value);
99+
return new Regex($pattern, $flags);
108100
}
109101
/**
110102
* Get timestamp
@@ -118,7 +110,7 @@ public static function timestamp(int $increment, int $timestamp)
118110
/**
119111
* Get datetime
120112
*
121-
* @param int|nul $milliseconds
113+
* @param int|null $milliseconds
122114
*
123115
* @return \MongoDB\BSON\UTCDateTime
124116
*/

src/Database/Platforms/Platform.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ abstract public static function registerCustomTypeOptions();
1313
*
1414
* @param string $platformName
1515
*
16-
* @return \Illuminate\Support\Collection
16+
* @return string
1717
*/
1818
public static function getPlatform($platformName)
1919
{

src/Database/Schema/Index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function create($index)
6464
* @param string $type
6565
* @param string|null $table
6666
*
67-
* @return \Doctrine\DBAL\Schema\Index
67+
* @return string
6868
*/
6969
public static function createName($columns, $type, $table = null)
7070
{

src/Database/Schema/Table.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public static function getColumnsName($tableName)
8383
*
8484
* @param array $table
8585
*
86-
* @return void
86+
* @return array|object|void
8787
*/
88-
public static function create($table = [])
88+
public static function create($table)
8989
{
9090
if (!is_array($table)) {
9191
$table = json_decode($table, true);
@@ -108,7 +108,7 @@ public static function create($table = [])
108108
*
109109
* @return true|void
110110
*/
111-
public static function update($table = [])
111+
public static function update($table)
112112
{
113113
if (!is_array($table)) {
114114
$table = json_decode($table, true);
@@ -125,7 +125,7 @@ public static function update($table = [])
125125
*
126126
* @param string $tableName
127127
*
128-
* @return true|void
128+
* @return void
129129
*/
130130
public static function drop($tableName)
131131
{
@@ -142,7 +142,7 @@ public static function drop($tableName)
142142
*
143143
* @return \Doctrine\DBAL\Schema\Table
144144
*/
145-
public static function prepareTable($table = [])
145+
public static function prepareTable($table)
146146
{
147147

148148
if (!is_array($table)) {
@@ -246,7 +246,7 @@ public static function getForeignKeys(DoctrineTable $table)
246246
*
247247
* @param string $tableName
248248
*
249-
* @return true
249+
* @return boolean
250250
*/
251251
public static function exists($tableName)
252252
{
@@ -264,7 +264,7 @@ public static function exists($tableName)
264264
* Get tables with pagination
265265
*
266266
* @param int $perPage
267-
* @param string|null $page
267+
* @param int|null $page
268268
* @param array $options
269269
* @param string $query
270270
*

src/Database/Schema/UpdateManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UpdateManager
2121
*
2222
* @return void
2323
*/
24-
public function update($table = [])
24+
public function update($table)
2525
{
2626
if (!is_array($table)) {
2727
$table = json_decode($table, true);

src/Database/Types/Common/CharType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class CharType extends Type
1818
*/
1919
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
2020
{
21-
$field['length'] = empty($field['length']) ? 1 : $field['length'];
21+
$fieldDeclaration['length'] = empty($fieldDeclaration['length']) ? 1 : $fieldDeclaration['length'];
2222

23-
return "char({$field['length']})";
23+
return "char({$fieldDeclaration['length']})";
2424
}
2525
}

src/Http/Controllers/BackupController.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function index()
2222
/**
2323
* Get all backup files
2424
*
25-
* @return \Illuminate\Http\Response
25+
* @return \Illuminate\Http\JsonResponse
2626
*/
2727
public function backups(Request $request)
2828
{
@@ -54,7 +54,7 @@ public function backups(Request $request)
5454
/**
5555
* Create new backup
5656
*
57-
* @return \Illuminate\Http\Response
57+
* @return \Illuminate\Http\JsonResponse
5858
*/
5959
public function backup(Request $request)
6060
{
@@ -92,7 +92,7 @@ public function backup(Request $request)
9292
/**
9393
* Restore from a specific backup
9494
*
95-
* @return \Illuminate\Http\Response
95+
* @return \Illuminate\Http\JsonResponse
9696
*/
9797
public function restore(Request $request)
9898
{
@@ -124,7 +124,7 @@ public function restore(Request $request)
124124
/**
125125
* Return specific backup file for download
126126
*
127-
* @return \Illuminate\Http\Response
127+
* @return \Illuminate\Http\JsonResponse
128128
*/
129129
public function download(Request $request)
130130
{
@@ -153,7 +153,7 @@ public function download(Request $request)
153153
/**
154154
* Remove a backup
155155
*
156-
* @return \Illuminate\Http\Response
156+
* @return \Illuminate\Http\JsonResponse
157157
*/
158158
public function delete(Request $request)
159159
{

0 commit comments

Comments
 (0)