Completed
Push — master ( 3d7e33...391d5f )
by Arman
24s queued 20s
created
src/Libraries/Database/PaginatorInterface.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,35 +4,35 @@
 block discarded – undo
4 4
 
5 5
 interface PaginatorInterface
6 6
 {
7
-	public function getPagination(bool $withBaseUrl): ?string;
7
+    public function getPagination(bool $withBaseUrl): ?string;
8 8
 
9
-	public function currentPageNumber(): int;
9
+    public function currentPageNumber(): int;
10 10
 
11
-	public function currentPageLink(bool $withBaseUrl): ?string;
11
+    public function currentPageLink(bool $withBaseUrl): ?string;
12 12
 
13
-	public function previousPageLink(bool $withBaseUrl): ?string;
13
+    public function previousPageLink(bool $withBaseUrl): ?string;
14 14
 
15
-	public function previousPageNumber(): ?int;
15
+    public function previousPageNumber(): ?int;
16 16
 
17
-	public function firstPageLink(bool $withBaseUrl): ?string;
17
+    public function firstPageLink(bool $withBaseUrl): ?string;
18 18
 
19
-	public function nextPageLink(bool $withBaseUrl): ?string;
19
+    public function nextPageLink(bool $withBaseUrl): ?string;
20 20
 
21
-	public function nextPageNumber(): ?int;
21
+    public function nextPageNumber(): ?int;
22 22
 
23
-	public function lastPageLink(bool $withBaseUrl): ?string;
23
+    public function lastPageLink(bool $withBaseUrl): ?string;
24 24
 	
25
-	public function lastPageNumber();
25
+    public function lastPageNumber();
26 26
 
27
-	public function firstItem();
27
+    public function firstItem();
28 28
 
29
-	public function lastItem();
29
+    public function lastItem();
30 30
 
31
-	public function perPage();
31
+    public function perPage();
32 32
 
33
-	public function total();
33
+    public function total();
34 34
 
35
-	public function links(bool $withBaseUrl);
35
+    public function links(bool $withBaseUrl);
36 36
 
37
-	public function data();
37
+    public function data();
38 38
 }
Please login to merge, or discard this patch.
src/Libraries/Database/Sleekdb/Paginator.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -11,67 +11,67 @@
 block discarded – undo
11 11
 
12 12
 class Paginator extends BasePaginator
13 13
 {
14
-	/**
15
-	 * @var SleekDbal
16
-	 */
17
-	private $dbal;
14
+    /**
15
+     * @var SleekDbal
16
+     */
17
+    private $dbal;
18 18
 
19
-	/**
20
-	 * @var array
21
-	 */
22
-	public $data;
19
+    /**
20
+     * @var array
21
+     */
22
+    public $data;
23 23
 
24
-	/**
25
-	 * @param $sleekDbal
26
-	 * @param int $perPage
27
-	 * @param int $page
28
-	 * @throws DatabaseException
29
-	 * @throws ModelException
30
-	 * @throws IOException
31
-	 * @throws InvalidArgumentException
32
-	 * @throws InvalidConfigurationException
33
-	 */
34
-	public function __construct($sleekDbal, int $perPage, int $page = 1)
35
-	{
36
-		/** @var SleekDbal $sleekDbal */
37
-		$this->total = count($sleekDbal->getBuilder()->getQuery()->fetch());
38
-		$this->dbal = $sleekDbal;
39
-		$this->dbal->limit($perPage)->offset($perPage * ($page - 1));
40
-		$this->data = $this->dbal->getBuilder()->getQuery()->fetch();
41
-		$this->perPage = $perPage;
42
-		$this->page = $page;
43
-		$this->baseUrl = base_url();
44
-	}
24
+    /**
25
+     * @param $sleekDbal
26
+     * @param int $perPage
27
+     * @param int $page
28
+     * @throws DatabaseException
29
+     * @throws ModelException
30
+     * @throws IOException
31
+     * @throws InvalidArgumentException
32
+     * @throws InvalidConfigurationException
33
+     */
34
+    public function __construct($sleekDbal, int $perPage, int $page = 1)
35
+    {
36
+        /** @var SleekDbal $sleekDbal */
37
+        $this->total = count($sleekDbal->getBuilder()->getQuery()->fetch());
38
+        $this->dbal = $sleekDbal;
39
+        $this->dbal->limit($perPage)->offset($perPage * ($page - 1));
40
+        $this->data = $this->dbal->getBuilder()->getQuery()->fetch();
41
+        $this->perPage = $perPage;
42
+        $this->page = $page;
43
+        $this->baseUrl = base_url();
44
+    }
45 45
 
46
-	/**
47
-	 * @return mixed
48
-	 */
49
-	public function firstItem()
50
-	{
51
-		return $this->data[array_key_first($this->data)];
52
-	}
46
+    /**
47
+     * @return mixed
48
+     */
49
+    public function firstItem()
50
+    {
51
+        return $this->data[array_key_first($this->data)];
52
+    }
53 53
 
54
-	/**
55
-	 * @return mixed
56
-	 */
57
-	public function lastItem()
58
-	{
59
-		return $this->data[array_key_last($this->data)];
60
-	}
54
+    /**
55
+     * @return mixed
56
+     */
57
+    public function lastItem()
58
+    {
59
+        return $this->data[array_key_last($this->data)];
60
+    }
61 61
 
62
-	/**
63
-	 * @return array|SleekDbal[]
64
-	 */
65
-	public function data(): array
66
-	{
67
-		$result = array_map(function ($element) {
68
-			$item = clone $this->dbal;
69
-			$item->setData($element);
70
-			$item->setModifiedFields($element);
71
-			$item->setIsNew(false);
72
-			return $item;
73
-		}, $this->data);
62
+    /**
63
+     * @return array|SleekDbal[]
64
+     */
65
+    public function data(): array
66
+    {
67
+        $result = array_map(function ($element) {
68
+            $item = clone $this->dbal;
69
+            $item->setData($element);
70
+            $item->setModifiedFields($element);
71
+            $item->setIsNew(false);
72
+            return $item;
73
+        }, $this->data);
74 74
 
75
-		return $result ?? [];
76
-	}
75
+        return $result ?? [];
76
+    }
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this 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
 	public function data(): array
66 66
 	{
67
-		$result = array_map(function ($element) {
67
+		$result = array_map(function($element) {
68 68
 			$item = clone $this->dbal;
69 69
 			$item->setData($element);
70 70
 			$item->setModifiedFields($element);
Please login to merge, or discard this patch.
src/Libraries/Database/Idiorm/Paginator.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -8,64 +8,64 @@
 block discarded – undo
8 8
 
9 9
 class Paginator extends BasePaginator
10 10
 {
11
-	/**
12
-	 * @var IdiormDbal
13
-	 */
14
-	private $dbal;
11
+    /**
12
+     * @var IdiormDbal
13
+     */
14
+    private $dbal;
15 15
 
16
-	/**
17
-	 * @var array|IdiormResultSet
18
-	 */
19
-	public $data;
16
+    /**
17
+     * @var array|IdiormResultSet
18
+     */
19
+    public $data;
20 20
 
21
-	/**
22
-	 * @param $idiormDbal
23
-	 * @param int $perPage
24
-	 * @param int $page
25
-	 * @throws DatabaseException
26
-	 */
27
-	public function __construct($idiormDbal, int $perPage, int $page = 1)
28
-	{
29
-		/** @var IdiormDbal $idiormDbal */
30
-		$this->total = $idiormDbal->getOrmModel()->count();
31
-		$this->dbal = $idiormDbal;
32
-		$this->dbal->limit($perPage)->offset($perPage * ($page - 1));
33
-		$this->data = $this->dbal->getOrmModel()->find_many();
34
-		$this->perPage = $perPage;
35
-		$this->page = $page;
36
-		$this->baseUrl = base_dir();
37
-	}
21
+    /**
22
+     * @param $idiormDbal
23
+     * @param int $perPage
24
+     * @param int $page
25
+     * @throws DatabaseException
26
+     */
27
+    public function __construct($idiormDbal, int $perPage, int $page = 1)
28
+    {
29
+        /** @var IdiormDbal $idiormDbal */
30
+        $this->total = $idiormDbal->getOrmModel()->count();
31
+        $this->dbal = $idiormDbal;
32
+        $this->dbal->limit($perPage)->offset($perPage * ($page - 1));
33
+        $this->data = $this->dbal->getOrmModel()->find_many();
34
+        $this->perPage = $perPage;
35
+        $this->page = $page;
36
+        $this->baseUrl = base_dir();
37
+    }
38 38
 
39
-	/**
40
-	 * @return mixed
41
-	 */
42
-	public function firstItem()
43
-	{
44
-		if (!is_array($this->data)){
45
-			$this->data = $this->data->as_array();
46
-		}
47
-		return $this->data[array_key_first($this->data)];
48
-	}
39
+    /**
40
+     * @return mixed
41
+     */
42
+    public function firstItem()
43
+    {
44
+        if (!is_array($this->data)){
45
+            $this->data = $this->data->as_array();
46
+        }
47
+        return $this->data[array_key_first($this->data)];
48
+    }
49 49
 
50
-	/**
51
-	 * @return mixed
52
-	 */
53
-	public function lastItem()
54
-	{
55
-		if (!is_array($this->data)){
56
-			$this->data = $this->data->as_array();
57
-		}
58
-		return $this->data[array_key_last($this->data)];
59
-	}
50
+    /**
51
+     * @return mixed
52
+     */
53
+    public function lastItem()
54
+    {
55
+        if (!is_array($this->data)){
56
+            $this->data = $this->data->as_array();
57
+        }
58
+        return $this->data[array_key_last($this->data)];
59
+    }
60 60
 
61
-	/**
62
-	 * @return array
63
-	 */
64
-	public function data()
65
-	{
66
-		if (!empty($this->data) && !is_array($this->data)){
67
-			$this->data = $this->data->as_array();
68
-		}
69
-		return $this->data ?? [];
70
-	}
61
+    /**
62
+     * @return array
63
+     */
64
+    public function data()
65
+    {
66
+        if (!empty($this->data) && !is_array($this->data)){
67
+            $this->data = $this->data->as_array();
68
+        }
69
+        return $this->data ?? [];
70
+    }
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function firstItem()
43 43
 	{
44
-		if (!is_array($this->data)){
44
+		if (!is_array($this->data)) {
45 45
 			$this->data = $this->data->as_array();
46 46
 		}
47 47
 		return $this->data[array_key_first($this->data)];
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function lastItem()
54 54
 	{
55
-		if (!is_array($this->data)){
55
+		if (!is_array($this->data)) {
56 56
 			$this->data = $this->data->as_array();
57 57
 		}
58 58
 		return $this->data[array_key_last($this->data)];
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function data()
65 65
 	{
66
-		if (!empty($this->data) && !is_array($this->data)){
66
+		if (!empty($this->data) && !is_array($this->data)) {
67 67
 			$this->data = $this->data->as_array();
68 68
 		}
69 69
 		return $this->data ?? [];
Please login to merge, or discard this patch.
src/Libraries/Database/Sleekdb/Statements/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
      */
41 41
     public function get(): array
42 42
     {
43
-        return array_map(function ($element) {
43
+        return array_map(function($element) {
44 44
             $item = clone $this;
45 45
             $item->data = $element;
46 46
             $item->modifiedFields = $element;
Please login to merge, or discard this patch.
src/Libraries/Database/BasePaginator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
      */
138 138
     public function lastPageNumber(): int
139 139
     {
140
-        return (int)ceil($this->total() / $this->perPage);
140
+        return (int) ceil($this->total() / $this->perPage);
141 141
     }
142 142
 
143 143
     /**
Please login to merge, or discard this patch.
src/Http/Request/Header.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
      * @param string $key
33 33
      * @return bool
34 34
      */
35
-	  public static function hasHeader(string $key): bool
36
-	  {
37
-	  	  list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key);
35
+        public static function hasHeader(string $key): bool
36
+        {
37
+            list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key);
38 38
 
39
-	  	  return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]);
40
-	  }
39
+            return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]);
40
+        }
41 41
 
42 42
     /**
43 43
      * Gets the request header by given key
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public static function getHeader(string $key): ?string
48 48
     {
49
-	      if (self::hasHeader($key)) {
50
-		        list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key);
51
-		        return self::$__headers[$keyWithHyphens] ?? self::$__headers[$keyWithUnderscores];
52
-	      }
49
+            if (self::hasHeader($key)) {
50
+                list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key);
51
+                return self::$__headers[$keyWithHyphens] ?? self::$__headers[$keyWithUnderscores];
52
+            }
53 53
 
54
-				return null;
54
+                return null;
55 55
     }
56 56
 
57 57
     /**
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
         }
85 85
     }
86 86
 
87
-	  /**
88
-	   * @param string $key
89
-	   * @return array
90
-	   */
91
-	  private static function normalizeHeaderKey(string $key): array
92
-	  {
93
-	  	$keyWithHyphens = str_replace('_', '-', strtolower($key));
94
-	  	$keyWithUnderscores = str_replace('-', '_', $key);
95
-	  	return [$keyWithHyphens, $keyWithUnderscores];
96
-	  }
87
+        /**
88
+         * @param string $key
89
+         * @return array
90
+         */
91
+        private static function normalizeHeaderKey(string $key): array
92
+        {
93
+            $keyWithHyphens = str_replace('_', '-', strtolower($key));
94
+            $keyWithUnderscores = str_replace('-', '_', $key);
95
+            return [$keyWithHyphens, $keyWithUnderscores];
96
+        }
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
src/Libraries/Validation/Rules/General.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@
 block discarded – undo
82 82
         if (!empty($value)) {
83 83
             $captcha = CaptchaManager::getHandler();
84 84
 
85
-            if (!$captcha->verify($value)){
85
+            if (!$captcha->verify($value)) {
86 86
                 $errorCode = $captcha->getErrorMessage();
87
-                $this->addError($field, 'captcha.'.$errorCode, $param);
87
+                $this->addError($field, 'captcha.' . $errorCode, $param);
88 88
             }
89 89
         }
90 90
     }
Please login to merge, or discard this patch.
src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
                 'Content-Type' => $contentType
164 164
             ];
165 165
             return $this->sendRequest($url, $params, $headers, $method);
166
-        }catch (Exception $e){
166
+        } catch (Exception $e){
167 167
             throw new Exception($e->getMessage(), (int)$e->getCode());
168 168
         }
169 169
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
                 'Content-Type' => $contentType
218 218
             ];
219 219
             return $this->sendRequest($url, $params, $headers, $method);
220
-        }catch (Exception $e){
221
-            throw new Exception($e->getMessage(), (int)$e->getCode());
220
+        } catch (Exception $e) {
221
+            throw new Exception($e->getMessage(), (int) $e->getCode());
222 222
         }
223 223
     }
224 224
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      * @return mixed|null
231 231
      * @throws Exception
232 232
      */
233
-    public function getFileInfo(string $fileId, bool $media = false, array $params = []){
233
+    public function getFileInfo(string $fileId, bool $media = false, array $params = []) {
234 234
         $queryParam = $media ? '?alt=media' : '?fields=*';
235 235
         return $this->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $fileId . $queryParam, $params, 'GET');
236 236
     }
Please login to merge, or discard this patch.
src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
         try {
83 83
             if($this->isFile($filename)){
84 84
                 return $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_MEDIA_URL . '/' . $filename . '?uploadType=media', $content, 'PATCH', 'application/octet-stream');
85
-            }else{
85
+            } else{
86 86
                 $data = [
87 87
                     'name' => $filename,
88 88
                     'parents' => $parentId ? [$parentId] : ['root']
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function makeDirectory(string $dirname, ?string $parentId = null): bool
48 48
     {
49
-        try{
49
+        try {
50 50
             $data = [
51 51
                 'name' => $dirname,
52 52
                 'mimeType' => GoogleDriveApp::FOLDER_MIMETYPE,
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function get(string $filename)
75 75
     {
76 76
         try {
77
-            return (string)$this->googleDriveApp->getFileInfo($filename, true);
77
+            return (string) $this->googleDriveApp->getFileInfo($filename, true);
78 78
         } catch (Exception $e) {
79 79
             return false;
80 80
         }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
     public function put(string $filename, string $content, ?string $parentId = null)
87 87
     {
88 88
         try {
89
-            if($this->isFile($filename)){
89
+            if ($this->isFile($filename)) {
90 90
                 return $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_MEDIA_URL . '/' . $filename . '?uploadType=media', $content, 'PATCH', 'application/octet-stream');
91
-            }else{
91
+            } else {
92 92
                 $data = [
93 93
                     'name' => $filename,
94 94
                     'parents' => $parentId ? [$parentId] : ['root']
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function size(string $filename)
162 162
     {
163 163
         try {
164
-            $meta = (array)$this->googleDriveApp->getFileInfo($filename);
164
+            $meta = (array) $this->googleDriveApp->getFileInfo($filename);
165 165
             return $meta['size'];
166 166
         } catch (Exception $e) {
167 167
             return false;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     public function lastModified(string $filename)
175 175
     {
176 176
         try {
177
-            $meta = (array)$this->googleDriveApp->getFileInfo($filename);
177
+            $meta = (array) $this->googleDriveApp->getFileInfo($filename);
178 178
             return !empty($meta['modifiedTime']) ? strtotime($meta['modifiedTime']) : false;
179 179
         } catch (Exception $e) {
180 180
             return false;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public function isFile(string $filename): bool
203 203
     {
204 204
         try {
205
-            $meta = (array)$this->googleDriveApp->getFileInfo($filename);
205
+            $meta = (array) $this->googleDriveApp->getFileInfo($filename);
206 206
 
207 207
             return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] != GoogleDriveApp::FOLDER_MIMETYPE;
208 208
         } catch (Exception $e) {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     public function isDirectory(string $dirname): bool
217 217
     {
218 218
         try {
219
-            $meta = (array)$this->googleDriveApp->getFileInfo($dirname);
219
+            $meta = (array) $this->googleDriveApp->getFileInfo($dirname);
220 220
 
221 221
             return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] === GoogleDriveApp::FOLDER_MIMETYPE;
222 222
         } catch (Exception $e) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                 'q' => "'$dirname' in parents and trashed = false",
235 235
                 'fields' => '*'
236 236
             ];
237
-            $response = (array)$this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET');
237
+            $response = (array) $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET');
238 238
             return $response["files"];
239 239
         } catch (Exception $e) {
240 240
             return false;
Please login to merge, or discard this patch.