Completed
Push — test ( 96b5be...ae1689 )
by Temitope
02:29
created
src/Helper/Inflector.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 			'sex' => 'sexes',
75 75
 			'move' => 'moves');
76 76
 		$lowercased_word = strtolower($word);
77
-		foreach ($uncountable as $_uncountable){
78
-			if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){
77
+		foreach ($uncountable as $_uncountable) {
78
+			if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) {
79 79
 				return $word;
80 80
 			}
81 81
 		}
82
-		foreach ($irregular as $_plural=> $_singular){
82
+		foreach ($irregular as $_plural=> $_singular) {
83 83
 			if (preg_match('/('.$_plural.')$/i', $word, $arr)) {
84
-				return preg_replace('/('.$_plural.')$/i', substr($arr[0],0,1).substr($_singular,1), $word);
84
+				return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word);
85 85
 			}
86 86
 		}
87 87
 		foreach ($plural as $rule => $replacement) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function singularize($word)
103 103
 	{
104
-		$singular = array (
104
+		$singular = array(
105 105
 			'/(quiz)zes$/i'             => "$1",
106 106
 			'/(matr)ices$/i'            => "$1ix",
107 107
 			'/(vert|ind)ices$/i'        => "$1ex",
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 			'sex' => 'sexes',
140 140
 			'move' => 'moves');
141 141
 		$lowercased_word = strtolower($word);
142
-		foreach ($uncountable as $_uncountable){
143
-			if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){
142
+		foreach ($uncountable as $_uncountable) {
143
+			if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) {
144 144
 				return $word;
145 145
 			}
146 146
 		}
147
-		foreach ($irregular as $_plural=> $_singular){
147
+		foreach ($irregular as $_plural=> $_singular) {
148 148
 			if (preg_match('/('.$_singular.')$/i', $word, $arr)) {
149
-				return preg_replace('/('.$_singular.')$/i', substr($arr[0],0,1).substr($_plural,1), $word);
149
+				return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word);
150 150
 			}
151 151
 		}
152 152
 		foreach ($singular as $rule => $replacement) {
Please login to merge, or discard this patch.
src/Exceptions/NoRecordInsertionException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @license  <https://opensource.org/license/MIT> MIT
7 7
  */
8 8
 
9
-namespace Laztopaz\potatoORM	;
9
+namespace Laztopaz\potatoORM;
10 10
 
11 11
 use Exception;
12 12
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 
13 13
 class NoRecordInsertionException extends Exception {
14 14
 
15
-    public static function checkNoRecordAddedException($mesaage)
16
-    {
17
-    	return new static($mesaage);
18
-    }
15
+	public static function checkNoRecordAddedException($mesaage)
16
+	{
17
+		return new static($mesaage);
18
+	}
19 19
 }
Please login to merge, or discard this patch.
src/Database/DatabaseHelper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
    	}
36 36
    	
37 37
    	$sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'(';
38
-   	$sql.= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )';
38
+   	$sql .= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )';
39 39
    	
40 40
    	return $conn->exec($sql);
41 41
    	throw TableNotCreatedException::tableNotCreatedException("Check your database connection");
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
 
14 14
 class DatabaseHelper {
15 15
 	
16
-    public $dbConn;
16
+	public $dbConn;
17 17
     
18
-    /**
19
-     * This is a constructor; a default method  that will be called automatically during class instantiation
20
-     */
21
-    public function __construct($dbConnect)
22
-    {
23
-    	$this->dbConn = $dbConnect;
24
-    }
18
+	/**
19
+	 * This is a constructor; a default method  that will be called automatically during class instantiation
20
+	 */
21
+	public function __construct($dbConnect)
22
+	{
23
+		$this->dbConn = $dbConnect;
24
+	}
25 25
     
26
-    /**
27
-     * This method creates a particular table
28
-     * @param tableName
29
-     * $return boolean true or false
30
-     */
26
+	/**
27
+	 * This method creates a particular table
28
+	 * @param tableName
29
+	 * $return boolean true or false
30
+	 */
31 31
    public function createTable($tableName, $conn = NULL)
32 32
    {
33 33
    	if (is_null($conn)) {
34
-   	    $conn = $this->dbConn;
34
+   		$conn = $this->dbConn;
35 35
    	}
36 36
    	
37 37
    	$sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'(';
Please login to merge, or discard this patch.
src/Exceptions/EmptyArrayException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 
13 13
 class EmptyArrayException extends Exception {
14 14
 	
15
-    public static function checkEmptyArrayException($message)
16
-    {
17
-    	return new static($message);
18
-    }
15
+	public static function checkEmptyArrayException($message)
16
+	{
17
+		return new static($message);
18
+	}
19 19
 
20 20
 }
Please login to merge, or discard this patch.
src/Exceptions/NoArgumentPassedToFunctionException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 
13 13
 class NoArgumentPassedToFunctionException extends Exception {
14 14
 	
15
-    public static function checkNoArgumentPassedToFunction($message)
16
-    {
17
-    	return new static($message);
18
-    }
15
+	public static function checkNoArgumentPassedToFunction($message)
16
+	{
17
+		return new static($message);
18
+	}
19 19
 
20 20
 }
Please login to merge, or discard this patch.
src/Exceptions/NoRecordUpdateException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 
13 13
 class NoRecordUpdateException extends  Exception {
14 14
 	
15
-    public static function checkNoRecordUpdateException($message)
16
-    {
17
-    	return new static($message);
18
-    }
15
+	public static function checkNoRecordUpdateException($message)
16
+	{
17
+		return new static($message);
18
+	}
19 19
 
20 20
 }
Please login to merge, or discard this patch.
src/Exceptions/NullArgumentPassedToFunctionException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 
13 13
 class NullArgumentPassedToFunction extends Exception {
14 14
 
15
-    public static function ckeckNullArgumentPassedToFunction($message)
16
-    {
17
-    	return new static ($message);
18
-    }
15
+	public static function ckeckNullArgumentPassedToFunction($message)
16
+	{
17
+		return new static ($message);
18
+	}
19 19
 
20 20
 }
Please login to merge, or discard this patch.
src/Exceptions/WrongArgumentException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 
13 13
 class WrongArgumentException extends Exception {
14 14
 
15
-    public function checkWrongArgumentException($message)
16
-    {
17
-    	return new static ($message);
18
-    }
15
+	public function checkWrongArgumentException($message)
16
+	{
17
+		return new static ($message);
18
+	}
19 19
 
20 20
 }
Please login to merge, or discard this patch.
src/Database/DatabaseConnection.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
     public  function  __construct() 
24 24
     {
25 25
     	$this->loadEnv(); // load the environment variables
26
-    	$this->databaseName     =  getenv('databaseName');
27
-    	$this->databaseHost     =  getenv('databaseHost');
28
-    	$this->databaseDriver   =  getenv('databaseDriver');
29
-    	$this->databaseUsername =  getenv('databaseUsername');
30
-    	$this->databasePassword =  getenv('databasePassword');
26
+    	$this->databaseName     = getenv('databaseName');
27
+    	$this->databaseHost     = getenv('databaseHost');
28
+    	$this->databaseDriver   = getenv('databaseDriver');
29
+    	$this->databaseUsername = getenv('databaseUsername');
30
+    	$this->databasePassword = getenv('databasePassword');
31 31
     	
32 32
     	try {
33 33
     	    $options = [
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     	    	];
37 37
     	    	parent::__construct($this->getDatabaseDriver(), $this->databaseUsername, $this->databasePassword, $options);
38 38
     		
39
-    	} catch(PDOException $e) {
39
+    	} catch (PDOException $e) {
40 40
     	    return $e->getMessage();
41 41
     	}
42 42
     	
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
      	{
56 56
      	    case 'mysql':
57 57
      	    // Set DSN
58
-     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
58
+     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='.$this->databaseName;
59 59
      	    break;
60 60
      	    case 'sqlite':
61 61
      	    // Set DSN
62
-     	    $dsn = 'sqlite:host='.$this->databaseHost.';dbname='. $this->databaseName;
62
+     	    $dsn = 'sqlite:host='.$this->databaseHost.';dbname='.$this->databaseName;
63 63
      	    break;
64 64
      	    case 'pgsql':
65 65
      	    // Set DSN
66
-     	    $dsn = 'pgsqlsql:host='.$this->databaseHost.';dbname='. $this->databaseName;
66
+     	    $dsn = 'pgsqlsql:host='.$this->databaseHost.';dbname='.$this->databaseName;
67 67
      	    break;
68 68
      	    default:
69 69
      	    // Set DSN
70
-     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
70
+     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='.$this->databaseName;
71 71
      	}
72 72
      	return $dsn;
73 73
      }
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,73 +14,73 @@
 block discarded – undo
14 14
 
15 15
 class DatabaseConnection extends \PDO {
16 16
 	
17
-    private $databaseName;
18
-    private $databaseHost;
19
-    private $databaseDriver;
20
-    private $databaseUsername;
21
-    private $databasePassword;
17
+	private $databaseName;
18
+	private $databaseHost;
19
+	private $databaseDriver;
20
+	private $databaseUsername;
21
+	private $databasePassword;
22 22
     
23
-    public  function  __construct() 
24
-    {
25
-    	$this->loadEnv(); // load the environment variables
26
-    	$this->databaseName     =  getenv('databaseName');
27
-    	$this->databaseHost     =  getenv('databaseHost');
28
-    	$this->databaseDriver   =  getenv('databaseDriver');
29
-    	$this->databaseUsername =  getenv('databaseUsername');
30
-    	$this->databasePassword =  getenv('databasePassword');
23
+	public  function  __construct() 
24
+	{
25
+		$this->loadEnv(); // load the environment variables
26
+		$this->databaseName     =  getenv('databaseName');
27
+		$this->databaseHost     =  getenv('databaseHost');
28
+		$this->databaseDriver   =  getenv('databaseDriver');
29
+		$this->databaseUsername =  getenv('databaseUsername');
30
+		$this->databasePassword =  getenv('databasePassword');
31 31
     	
32
-    	try {
33
-    	    $options = [
34
-    	    	PDO::ATTR_PERSISTENT    => true,
35
-    	    	PDO::ATTR_ERRMODE       => PDO::ERRMODE_EXCEPTION
36
-                ];
37
-    	    	parent::__construct($this->getDatabaseDriver(), $this->databaseUsername, $this->databasePassword, $options);
32
+		try {
33
+			$options = [
34
+				PDO::ATTR_PERSISTENT    => true,
35
+				PDO::ATTR_ERRMODE       => PDO::ERRMODE_EXCEPTION
36
+				];
37
+				parent::__construct($this->getDatabaseDriver(), $this->databaseUsername, $this->databasePassword, $options);
38 38
     		
39
-    	} catch(PDOException $e) {
40
-    	    return $e->getMessage();
41
-    	}
39
+		} catch(PDOException $e) {
40
+			return $e->getMessage();
41
+		}
42 42
     	
43
-    }
43
+	}
44 44
 
45
-    /**
46
-     * This method determines the driver to be used for appropriate database server
47
-     * @params void
48
-     * @return string dsn
49
-     */
50
-     public function getDatabaseDriver()
51
-     {
52
-     	$dsn = "";
45
+	/**
46
+	 * This method determines the driver to be used for appropriate database server
47
+	 * @params void
48
+	 * @return string dsn
49
+	 */
50
+	 public function getDatabaseDriver()
51
+	 {
52
+	 	$dsn = "";
53 53
      	
54
-     	switch ($this->databaseDriver)
55
-     	{
56
-            case 'mysql':
57
-     	    // Set DSN
58
-     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
59
-     	    break;
60
-     	    case 'sqlite':
61
-     	    // Set DSN
62
-     	    $dsn = 'sqlite:host='.$this->databaseHost.';dbname='. $this->databaseName;
63
-     	    break;
64
-     	    case 'pgsql':
65
-     	    // Set DSN
66
-     	    $dsn = 'pgsqlsql:host='.$this->databaseHost.';dbname='. $this->databaseName;
67
-     	    break;
68
-     	    default:
69
-     	    // Set DSN
70
-     	    $dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
71
-     	}
72
-     	return $dsn;
73
-     }
54
+	 	switch ($this->databaseDriver)
55
+	 	{
56
+			case 'mysql':
57
+	 		// Set DSN
58
+	 		$dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
59
+	 		break;
60
+	 		case 'sqlite':
61
+	 		// Set DSN
62
+	 		$dsn = 'sqlite:host='.$this->databaseHost.';dbname='. $this->databaseName;
63
+	 		break;
64
+	 		case 'pgsql':
65
+	 		// Set DSN
66
+	 		$dsn = 'pgsqlsql:host='.$this->databaseHost.';dbname='. $this->databaseName;
67
+	 		break;
68
+	 		default:
69
+	 		// Set DSN
70
+	 		$dsn = 'mysql:host='.$this->databaseHost.';dbname='. $this->databaseName;
71
+	 	}
72
+	 	return $dsn;
73
+	 }
74 74
 
75
-     /**
76
-      * Load Dotenv to grant getenv() access to environment variables in .env file
77
-      */
78
-     public function loadEnv()
79
-     {
80
-     	if (!getenv("APP_ENV")) {
81
-     	    $dotenv = new Dotenv(__DIR__.'/../../');
82
-     	    $dotenv->load();
83
-     	}
84
-     }
75
+	 /**
76
+	  * Load Dotenv to grant getenv() access to environment variables in .env file
77
+	  */
78
+	 public function loadEnv()
79
+	 {
80
+	 	if (!getenv("APP_ENV")) {
81
+	 		$dotenv = new Dotenv(__DIR__.'/../../');
82
+	 		$dotenv->load();
83
+	 	}
84
+	 }
85 85
 
86 86
 }
Please login to merge, or discard this patch.