Passed
Push — master ( 97d3b9...5f58f0 )
by Henri
01:17
created
examples/Models/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
   * @property string birth
12 12
   * @property string register
13 13
   */ 
14
-class User extends Model{
14
+class User extends Model {
15 15
 
16 16
     public function __construct()
17 17
     {
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
          * @param string Table name
20 20
          * @param string Primary key column
21 21
          */
22
-        parent::create('user','id');
22
+        parent::create('user', 'id');
23 23
     }
24 24
 
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
examples/Select.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 use HnrAzevedo\Datamanager\DatamanagerException;
10 10
 use Model\User;
11 11
 
12
-try{
12
+try {
13 13
     $entity = new User();
14 14
 
15 15
     /* Find by primary key */
16 16
     $user = $entity->find(1)->execute()->first()->toEntity();
17 17
 
18 18
     /* Search only for columns defined in advance  */
19
-    $user = $entity->find(1)->only(['name','email'])->execute()->first();
19
+    $user = $entity->find(1)->only(['name', 'email'])->execute()->first();
20 20
     $name = $user->name;
21 21
     $email = $user->email;
22 22
     /* OR */
23 23
     $name = $entity->find()->only('name')->execute()->first()->name;
24 24
 
25 25
     /* Search except for columns defined in advance  */
26
-    $user = $entity->find()->except(['name','email'])->execute()->first();
26
+    $user = $entity->find()->except(['name', 'email'])->execute()->first();
27 27
     /* OR */
28 28
     $user = $entity->find()->except('name')->execute()->first();
29 29
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /* OrdeBy example */
36 36
     $users = $entity->find()->orderBy('birth ASC')->execute()->result();
37 37
     /* OR */
38
-    $users = $entity->find()->orderBy('birth','ASC')->execute()->result();
38
+    $users = $entity->find()->orderBy('birth', 'ASC')->execute()->result();
39 39
 
40 40
 
41 41
     /* Between example */
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
     /* Where example */
67 67
     $user->find()->where([
68
-        ['name','=','Henri Azevedo'],
68
+        ['name', '=', 'Henri Azevedo'],
69 69
         'OR' => [
70
-            'email','LIKE','[email protected]'
70
+            'email', 'LIKE', '[email protected]'
71 71
             ]
72 72
     ])->execute();
73 73
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /* Searches for all records and returns an array of Model\User objects */
78 78
     $results = $entity->find()->execute()->toEntity();
79 79
 
80
-}catch(DatamanagerException $er){
80
+} catch (DatamanagerException $er) {
81 81
 
82 82
     die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}.");
83 83
 
Please login to merge, or discard this patch.
src/Connect.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@
 block discarded – undo
15 15
         if (empty(self::$instance)) {
16 16
             try {
17 17
 
18
-                if(!defined('DATAMANAGER_CONFIG')){
18
+                if (!defined('DATAMANAGER_CONFIG')) {
19 19
                     throw new DatamanagerException("Information for connection to the database not defined.");
20 20
                 }
21 21
 
22 22
                 self::$instance = new PDO(
23
-                    DATAMANAGER_CONFIG['driver'] . ':host='.DATAMANAGER_CONFIG['host'] . ';port='.DATAMANAGER_CONFIG['port'] . ';dbname='.DATAMANAGER_CONFIG['database'] . ';charset='.DATAMANAGER_CONFIG['charset'],
23
+                    DATAMANAGER_CONFIG['driver'].':host='.DATAMANAGER_CONFIG['host'].';port='.DATAMANAGER_CONFIG['port'].';dbname='.DATAMANAGER_CONFIG['database'].';charset='.DATAMANAGER_CONFIG['charset'],
24 24
                     DATAMANAGER_CONFIG['username'],
25 25
                     DATAMANAGER_CONFIG['password'],
26 26
                     DATAMANAGER_CONFIG['options']
27 27
                 );
28 28
             } catch (Exception $exception) {
29
-                throw new DatamanagerException(str_replace(['SQLSTATE[HY000]',"[{$exception->getCode()}]"], '', $exception->getMessage()), $exception->getCode(), $exception);
29
+                throw new DatamanagerException(str_replace(['SQLSTATE[HY000]', "[{$exception->getCode()}]"], '', $exception->getMessage()), $exception->getCode(), $exception);
30 30
             }
31 31
         }
32 32
         return self::$instance;
33 33
     }
34 34
 
35
-    public static function destroy(){
35
+    public static function destroy() {
36 36
         self::$instance = null;
37 37
     }
38 38
 
Please login to merge, or discard this patch.
src/MagicsTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace HnrAzevedo\Datamanager;
4 4
 
5
-trait MagicsTrait{
5
+trait MagicsTrait {
6 6
 
7
-    public function __set(string $prop,$value)
7
+    public function __set(string $prop, $value)
8 8
     {
9
-        if(is_array($value)){
9
+        if (is_array($value)) {
10 10
             $attr = array_keys($value)[0];
11 11
             $this->data[$prop][$attr] = $value[$attr];
12 12
             return $this;
13 13
         }
14 14
 
15
-        if($this->full){
16
-            switch($this->data[$prop]['type']){
15
+        if ($this->full) {
16
+            switch ($this->data[$prop]['type']) {
17 17
                 case 'date':
18
-                    $value = (date_format( date_create_from_format(DATAMANAGER_CONFIG['dateformat'],$value) , 'Y-m-d'));
18
+                    $value = (date_format(date_create_from_format(DATAMANAGER_CONFIG['dateformat'], $value), 'Y-m-d'));
19 19
                     break;
20 20
             }
21 21
         }
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $this->isSettable($field);
34 34
 
35
-        if($this->full){
36
-            switch($this->data[$field]['type']){
35
+        if ($this->full) {
36
+            switch ($this->data[$field]['type']) {
37 37
                 case 'date': 
38
-                    return (!empty($this->data[$field]['value'])) ? (@date_format( @date_create_from_format('Y-m-d' , $this->data[$field]['value'] ) , DATAMANAGER_CONFIG['dateformat'])) : null ;
38
+                    return (!empty($this->data[$field]['value'])) ? (@date_format(@date_create_from_format('Y-m-d', $this->data[$field]['value']), DATAMANAGER_CONFIG['dateformat'])) : null;
39 39
                     break;
40 40
                 case 'datetime': 
41
-                    return (!empty($this->data[$field]['value'])) ? (@date_format( @date_create_from_format('Y-m-d h:i:s' , $this->data[$field]['value'] ) , DATAMANAGER_CONFIG['datetimeformat'])) : null ;
41
+                    return (!empty($this->data[$field]['value'])) ? (@date_format(@date_create_from_format('Y-m-d h:i:s', $this->data[$field]['value']), DATAMANAGER_CONFIG['datetimeformat'])) : null;
42 42
                     break;
43 43
             }
44 44
         }
Please login to merge, or discard this patch.