Skip to content

Commit 14ac2f8

Browse files
authored
Merge pull request #17 from jr-cologne/jr_refactor
Refactor code
2 parents 225c588 + 684052d commit 14ac2f8

File tree

6 files changed

+80
-84
lines changed

6 files changed

+80
-84
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 JR Cologne
3+
Copyright (c) 2018 JR Cologne
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jr-cologne/db-class",
33
"type": "library",
4-
"version": "2.1.2",
4+
"version": "2.1.3",
55
"description": "A simple database class with PHP, PDO and a query builder.",
66
"keywords": [
77
"database",
@@ -30,7 +30,7 @@
3030
],
3131
"support": {
3232
"issues": "https://github.com/jr-cologne/db-class/issues",
33-
"source": "https://github.com/jr-cologne/db-class/tree/v2.1.2",
33+
"source": "https://github.com/jr-cologne/db-class/tree/v2.1.3",
3434
"docs": "https://github.com/jr-cologne/db-class/blob/README.md"
3535
}
3636
}

src/API.md

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Instantiates the class and sets `DB::query_builder` to the passed in `QueryBuild
117117
**Description:**
118118

119119
```php
120-
DB::connect(string $dsn, string $username = null, string $password = null, array $options = [])
120+
DB::connect(string $dsn, string $username = null, string $password = null, array $options = []) : bool
121121
```
122122

123123
Creates a connection to a specified database by PDO.
@@ -142,7 +142,7 @@ Creates a connection to a specified database by PDO.
142142
**Description:**
143143

144144
```php
145-
DB::connected()
145+
DB::connected() : bool
146146
```
147147

148148
Checks whether a connection to a database is established.
@@ -159,7 +159,7 @@ Checks whether a connection to a database is established.
159159
**Description:**
160160

161161
```php
162-
DB::table(string $table)
162+
DB::table(string $table) : self
163163
```
164164

165165
Sets the table to use for the following query.
@@ -178,7 +178,7 @@ Sets the table to use for the following query.
178178
**Description:**
179179

180180
```php
181-
DB::select(string $columns, array $where = [], int $fetch_mode = PDO::FETCH_ASSOC)
181+
DB::select(string $columns, array $where = [], int $fetch_mode = PDO::FETCH_ASSOC) : self
182182
```
183183

184184
Executes a SELECT query and fetches data from a database.
@@ -280,7 +280,7 @@ On failure: `boolean` false
280280
**Description:**
281281

282282
```php
283-
DB::insert(array $data)
283+
DB::insert(array $data) : bool
284284
```
285285

286286
Inserts data into a database.
@@ -320,7 +320,7 @@ Inserts multiple rows of data into a database.
320320
**Description:**
321321

322322
```php
323-
DB::update(array $data, array $where = [])
323+
DB::update(array $data, array $where = []) : bool
324324
```
325325

326326
Updates data of a database.
@@ -354,7 +354,7 @@ Example, which essentially translates to the where clause ``WHERE `username` = '
354354
**Description:**
355355

356356
```php
357-
DB::delete(array $where = [])
357+
DB::delete(array $where = []) : bool
358358
```
359359

360360
Deletes data from a database.
@@ -386,7 +386,7 @@ Example, which essentially translates to the where clause ``WHERE `username` = '
386386
**Description:**
387387

388388
```php
389-
DB::getPDOException()
389+
DB::getPDOException() : PDOException
390390
```
391391

392392
Returns the `PDOException` set when PDO raised an error.
@@ -403,7 +403,7 @@ Returns the `PDOException` set when PDO raised an error.
403403
**Description:**
404404

405405
```php
406-
DB::formatWhereData(array $where)
406+
DB::formatWhereData(array $where) : array
407407
```
408408

409409
Formats the data for the where clause which is passed into the method `PDOStatement::execute()`.
@@ -673,7 +673,7 @@ Sets the data for the update query.
673673
**Description:**
674674

675675
```php
676-
QueryBuilder::getQuery()
676+
QueryBuilder::getQuery() : string
677677
```
678678

679679
Gets the build query from the method `QueryBuilder::build()`.
@@ -690,7 +690,7 @@ Gets the build query from the method `QueryBuilder::build()`.
690690
**Description:**
691691

692692
```php
693-
QueryBuilder::formatColumns($columns)
693+
QueryBuilder::formatColumns($columns) : string
694694
```
695695

696696
Formats the columns for the query.
@@ -715,7 +715,7 @@ Examples of possible values:
715715
**Description:**
716716

717717
```php
718-
QueryBuilder::formatWhere(array $where)
718+
QueryBuilder::formatWhere(array $where) : string
719719
```
720720

721721
Formats the where clause for the query.
@@ -734,7 +734,7 @@ Formats the where clause for the query.
734734
**Description:**
735735

736736
```php
737-
QueryBuilder::formatValues($values)
737+
QueryBuilder::formatValues($values) : string
738738
```
739739

740740
Formats the values for the insert query.
@@ -758,7 +758,7 @@ Examples of possible values:
758758
**Description:**
759759

760760
```php
761-
QueryBuilder::formatData(array $data)
761+
QueryBuilder::formatData(array $data) : string
762762
```
763763

764764
Formats the data for the update query.
@@ -772,36 +772,12 @@ Formats the data for the update query.
772772
**Return Values:** `string`
773773

774774

775-
#### `QueryBuilder::formatValues()`
776-
777-
**Description:**
778-
779-
```php
780-
QueryBuilder::formatValues($values)
781-
```
782-
783-
Formats the values for the insert query.
784-
785-
**Visibility:** `protected`
786-
787-
**Parameters:**
788-
789-
`mixed $values`: A string or an array specifying the values for the insert query.
790-
791-
Examples of possible values:
792-
793-
- `'username, password'`
794-
- `[ 'username', 'password' ]`
795-
796-
**Return Values:** `string`
797-
798-
799775
#### `QueryBuilder::build()`
800776

801777
**Description:**
802778

803779
```php
804-
QueryBuilder::build()
780+
QueryBuilder::build() : string
805781
```
806782

807783
Builds the query.

0 commit comments

Comments
 (0)