Completed
Push — master ( 8e1332...0c22ef )
by Stefano
03:04
created
classes/Loader.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 class Loader {
14 14
     protected static $paths = [];
15 15
     
16
-    public static function addPath($path,$name=null){
16
+    public static function addPath($path, $name = null) {
17 17
         static::$paths[$path] = $name;
18 18
     }
19 19
 
20
-    public static function register(){
20
+    public static function register() {
21 21
         ini_set('unserialize_callback_func', 'spl_autoload_call');
22
-        spl_autoload_register(function($class){
23
-            $cfile = strtr($class,'_\\','//') . '.php';
22
+        spl_autoload_register(function($class) {
23
+            $cfile = strtr($class, '_\\', '//').'.php';
24 24
             foreach (static::$paths as $path => $v) {
25
-                $file = rtrim($path,'/').'/'.$cfile;
26
-                if(is_file($file)) return include($file);
25
+                $file = rtrim($path, '/').'/'.$cfile;
26
+                if (is_file($file)) return include($file);
27 27
             }
28 28
             return false;
29
-        },false,true);
29
+        },false, true);
30 30
     }
31 31
     
32 32
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,17 +13,19 @@
 block discarded – undo
13 13
 class Loader {
14 14
     protected static $paths = [];
15 15
     
16
-    public static function addPath($path,$name=null){
16
+    public static function addPath($path,$name=null) {
17 17
         static::$paths[$path] = $name;
18 18
     }
19 19
 
20
-    public static function register(){
20
+    public static function register() {
21 21
         ini_set('unserialize_callback_func', 'spl_autoload_call');
22
-        spl_autoload_register(function($class){
22
+        spl_autoload_register(function($class) {
23 23
             $cfile = strtr($class,'_\\','//') . '.php';
24 24
             foreach (static::$paths as $path => $v) {
25 25
                 $file = rtrim($path,'/').'/'.$cfile;
26
-                if(is_file($file)) return include($file);
26
+                if(is_file($file)) {
27
+                  return include($file);
28
+                }
27 29
             }
28 30
             return false;
29 31
         },false,true);
Please login to merge, or discard this patch.
classes/Model.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
     }
30 30
 
31 31
     public static function all($page=1,$limit=-1){
32
-    		$offset = max(1,$page)-1;
32
+        $offset = max(1,$page)-1;
33 33
         return static::where($limit < 1 ? "" : "1 limit $limit offset $offset");
34 34
     }
35 35
 
36 36
     public function primaryKey(){
37
-    	$self    = get_called_class();
37
+      $self    = get_called_class();
38 38
       $key     = $self::persistenceOptions('key');
39 39
       return $this->$key;
40 40
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public static function create(array $data){
43 43
         $tmp = new static;
44 44
         foreach ($data as $key => $value) {
45
-           $tmp->$key = $value;
45
+            $tmp->$key = $value;
46 46
         }
47 47
         $tmp->save();
48 48
         return $tmp;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,33 +13,33 @@
 block discarded – undo
13 13
 abstract class Model {
14 14
     use Module, Persistence;
15 15
 
16
-    public static function where($where_sql = false){
16
+    public static function where($where_sql = false) {
17 17
         // Forward persistence calls to caller class, not Model
18 18
         $self    = get_called_class();
19 19
         $table   = $self::persistenceOptions('table');
20 20
         $key     = $self::persistenceOptions('key');
21 21
 
22
-        $sql = "select $key from $table" . ($where_sql ? " where $where_sql" : '');
22
+        $sql = "select $key from $table".($where_sql ? " where $where_sql" : '');
23 23
 
24 24
         $results = [];
25
-        SQL::each($sql, function($row) use ($self,&$results,$key){
25
+        SQL::each($sql, function($row) use ($self, &$results, $key){
26 26
             $results[] = $self::load($row->$key);
27 27
         });
28 28
         return $results;
29 29
     }
30 30
 
31
-    public static function all($page=1,$limit=-1){
32
-    		$offset = max(1,$page)-1;
31
+    public static function all($page = 1, $limit = -1) {
32
+    		$offset = max(1, $page) - 1;
33 33
         return static::where($limit < 1 ? "" : "1 limit $limit offset $offset");
34 34
     }
35 35
 
36
-    public function primaryKey(){
37
-    	$self    = get_called_class();
38
-      $key     = $self::persistenceOptions('key');
36
+    public function primaryKey() {
37
+    	$self = get_called_class();
38
+      $key = $self::persistenceOptions('key');
39 39
       return $this->$key;
40 40
     }
41 41
 
42
-    public static function create(array $data){
42
+    public static function create(array $data) {
43 43
         $tmp = new static;
44 44
         foreach ($data as $key => $value) {
45 45
            $tmp->$key = $value;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 abstract class Model {
14 14
     use Module, Persistence;
15 15
 
16
-    public static function where($where_sql = false){
16
+    public static function where($where_sql = false) {
17 17
         // Forward persistence calls to caller class, not Model
18 18
         $self    = get_called_class();
19 19
         $table   = $self::persistenceOptions('table');
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
         $sql = "select $key from $table" . ($where_sql ? " where $where_sql" : '');
23 23
 
24 24
         $results = [];
25
-        SQL::each($sql, function($row) use ($self,&$results,$key){
25
+        SQL::each($sql, function($row) use ($self,&$results,$key) {
26 26
             $results[] = $self::load($row->$key);
27 27
         });
28 28
         return $results;
29 29
     }
30 30
 
31
-    public static function all($page=1,$limit=-1){
31
+    public static function all($page=1,$limit=-1) {
32 32
     		$offset = max(1,$page)-1;
33 33
         return static::where($limit < 1 ? "" : "1 limit $limit offset $offset");
34 34
     }
35 35
 
36
-    public function primaryKey(){
36
+    public function primaryKey() {
37 37
     	$self    = get_called_class();
38 38
       $key     = $self::persistenceOptions('key');
39 39
       return $this->$key;
40 40
     }
41 41
 
42
-    public static function create(array $data){
42
+    public static function create(array $data) {
43 43
         $tmp = new static;
44 44
         foreach ($data as $key => $value) {
45 45
            $tmp->$key = $value;
Please login to merge, or discard this patch.
classes/Email/Ses.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     $options  = (object)$options;
19 19
     $region   = isset($options->region) ? $options->region : 'eu-west-1';
20 20
     if (empty($options->username) || empty($options->password))
21
-       throw new \Exception("[core.email.ses] You must provide an Amazon SES SMTP username and password", 1);
21
+        throw new \Exception("[core.email.ses] You must provide an Amazon SES SMTP username and password", 1);
22 22
 
23 23
     Smtp::onInit([
24 24
       'host'     => "email-smtp.{$region}.amazonaws.com",
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
   public function onSend(Envelope $envelope){
34 34
     if (!$envelope->from())
35
-       throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
35
+        throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
36 36
     return Smtp::onSend($envelope);
37 37
   }
38 38
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 class Ses extends Smtp {
16 16
 
17 17
   public function onInit($options) {
18
-    $options  = (object)$options;
18
+    $options  = (object) $options;
19 19
     $region   = isset($options->region) ? $options->region : 'eu-west-1';
20 20
     if (empty($options->username) || empty($options->password))
21 21
        throw new \Exception("[core.email.ses] You must provide an Amazon SES SMTP username and password", 1);
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
   }
32 32
 
33
-  public function onSend(Envelope $envelope){
33
+  public function onSend(Envelope $envelope) {
34 34
     if (!$envelope->from())
35 35
        throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
36 36
     return Smtp::onSend($envelope);
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
   public function onInit($options) {
18 18
     $options  = (object)$options;
19 19
     $region   = isset($options->region) ? $options->region : 'eu-west-1';
20
-    if (empty($options->username) || empty($options->password))
21
-       throw new \Exception("[core.email.ses] You must provide an Amazon SES SMTP username and password", 1);
20
+    if (empty($options->username) || empty($options->password)) {
21
+           throw new \Exception("[core.email.ses] You must provide an Amazon SES SMTP username and password", 1);
22
+    }
22 23
 
23 24
     Smtp::onInit([
24 25
       'host'     => "email-smtp.{$region}.amazonaws.com",
@@ -30,9 +31,10 @@  discard block
 block discarded – undo
30 31
 
31 32
   }
32 33
 
33
-  public function onSend(Envelope $envelope){
34
-    if (!$envelope->from())
35
-       throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
34
+  public function onSend(Envelope $envelope) {
35
+    if (!$envelope->from()) {
36
+           throw new \Exception("[core.email.ses] Amazon SES needs a registered `from` address", 1);
37
+    }
36 38
     return Smtp::onSend($envelope);
37 39
   }
38 40
 
Please login to merge, or discard this patch.
classes/Email/Proxy.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
 
17 17
   protected $listener = 'core.email.proxy.send';
18 18
 
19
-  public function onInit($options){
19
+  public function onInit($options) {
20 20
     if (!empty($options['hook'])) $this->listener = $options['hook'];
21 21
   }
22 22
 
23
-  public function onSend(Envelope $envelope){
24
-    \Event::trigger('core.email.send',$envelope->to(),$envelope,'proxy');
23
+  public function onSend(Envelope $envelope) {
24
+    \Event::trigger('core.email.send', $envelope->to(), $envelope, 'proxy');
25 25
     \Event::trigger($this->listener, $envelope);
26 26
     return true;
27 27
   }
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@
 block discarded – undo
16 16
 
17 17
   protected $listener = 'core.email.proxy.send';
18 18
 
19
-  public function onInit($options){
20
-    if (!empty($options['hook'])) $this->listener = $options['hook'];
19
+  public function onInit($options) {
20
+    if (!empty($options['hook'])) {
21
+      $this->listener = $options['hook'];
22
+    }
21 23
   }
22 24
 
23
-  public function onSend(Envelope $envelope){
25
+  public function onSend(Envelope $envelope) {
24 26
     \Event::trigger('core.email.send',$envelope->to(),$envelope,'proxy');
25 27
     \Event::trigger($this->listener, $envelope);
26 28
     return true;
Please login to merge, or discard this patch.
classes/Email/Native.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
 class Native implements Driver {
16 16
   
17
-  public function onInit($options){}
17
+  public function onInit($options) {}
18 18
 
19
-  public function onSend(Envelope $envelope){
19
+  public function onSend(Envelope $envelope) {
20 20
     // PHP requires direct handling of To and Subject Headers.
21 21
     $success     = true;
22 22
     $recipients  = $envelope->to();
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     $envelope->to(false);
25 25
     $envelope->subject(false);
26 26
     foreach ($recipients as $to) {
27
-      $current_success = mail($to,$subject,$envelope->body(),$envelope->head());
28
-      \Event::trigger('core.email.send',$to,$envelope,'native');
27
+      $current_success = mail($to, $subject, $envelope->body(), $envelope->head());
28
+      \Event::trigger('core.email.send', $to, $envelope, 'native');
29 29
       $success = $success && $current_success;
30 30
     }
31 31
     return $success;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
   
17 17
   public function onInit($options){}
18 18
 
19
-  public function onSend(Envelope $envelope){
19
+  public function onSend(Envelope $envelope) {
20 20
     // PHP requires direct handling of To and Subject Headers.
21 21
     $success     = true;
22 22
     $recipients  = $envelope->to();
Please login to merge, or discard this patch.
classes/Email/Smtp.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
     $password;
26 26
 
27 27
   public function onInit($options) {
28
-    $options        = (object)$options;
29
-    $this->host     = isset($options->host)     ? $options->host     : 'localhost';
28
+    $options        = (object) $options;
29
+    $this->host     = isset($options->host) ? $options->host : 'localhost';
30 30
     $this->username = isset($options->username) ? $options->username : false;
31
-    $this->secure   = isset($options->secure)   ? $options->secure   : ($this->username ? true : false);
32
-    $this->port     = isset($options->port)     ? $options->port     : ($this->secure ? 465 : 25);
31
+    $this->secure   = isset($options->secure) ? $options->secure : ($this->username ? true : false);
32
+    $this->port     = isset($options->port) ? $options->port : ($this->secure ? 465 : 25);
33 33
     $this->password = isset($options->password) ? $options->password : false;
34 34
   }
35 35
 
36
-  protected function connect(){
36
+  protected function connect() {
37 37
     if ($this->socket) $this->close();
38
-    $url = ($this->secure ? 'tls' : 'tcp') ."://{$this->host}";
39
-    $this->socket = fsockopen( $url, $this->port, $errno, $errstr, 30 );
40
-    if ( ! $this->socket ) throw new \Exception("Unable to connect to $url on port {$this->port}.");
38
+    $url = ($this->secure ? 'tls' : 'tcp')."://{$this->host}";
39
+    $this->socket = fsockopen($url, $this->port, $errno, $errstr, 30);
40
+    if (!$this->socket) throw new \Exception("Unable to connect to $url on port {$this->port}.");
41 41
     $this->lastMessage = '';
42 42
     $this->lastCode = 0;
43 43
   }
44 44
 
45
-  public function close(){
45
+  public function close() {
46 46
     $this->socket && @fclose($this->socket);
47 47
   }
48 48
 
49
-  protected function write($data, $nl = 1){
50
-    $payload = $data . str_repeat("\r\n",$nl);
49
+  protected function write($data, $nl = 1) {
50
+    $payload = $data.str_repeat("\r\n", $nl);
51 51
     fwrite($this->socket, $payload);
52 52
   }
53 53
 
54
-  protected function expectCode($code){
54
+  protected function expectCode($code) {
55 55
 
56 56
     $this->lastMessage = '';
57
-    while (substr($this->lastMessage, 3, 1) != ' '){
57
+    while (substr($this->lastMessage, 3, 1) != ' ') {
58 58
       $this->lastMessage = fgets($this->socket, 256);
59 59
     }
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
     return $code == $this->lastCode;
63 63
   }
64 64
 
65
-  protected function SMTPmail($from,$to,$body){
65
+  protected function SMTPmail($from, $to, $body) {
66 66
     $this->connect();
67 67
     $this->expectCode(220);
68 68
 
69 69
     $this->write("EHLO {$this->host}");
70 70
     $this->expectCode(250);
71 71
 
72
-    if ($this->username){
72
+    if ($this->username) {
73 73
       $this->write("AUTH LOGIN");
74 74
       $this->expectCode(334);
75 75
       $this->write(base64_encode($this->username));
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     return $success;
99 99
   }
100 100
 
101
-  public function onSend(Envelope $envelope){
101
+  public function onSend(Envelope $envelope) {
102 102
     // PHP requires direct handling of To and Subject Headers.
103 103
     $success     = true;
104 104
     $recipients  = $envelope->to();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $envelope->from(false);
108 108
     foreach ($recipients as $to) {
109 109
       $current_success = $this->SMTPmail($from, $to, $envelope->build());
110
-      \Event::trigger('core.email.send',$to,$envelope,'smtp');
110
+      \Event::trigger('core.email.send', $to, $envelope, 'smtp');
111 111
       $success = $success && $current_success;
112 112
     }
113 113
     return $success;
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,28 +33,32 @@  discard block
 block discarded – undo
33 33
     $this->password = isset($options->password) ? $options->password : false;
34 34
   }
35 35
 
36
-  protected function connect(){
37
-    if ($this->socket) $this->close();
36
+  protected function connect() {
37
+    if ($this->socket) {
38
+      $this->close();
39
+    }
38 40
     $url = ($this->secure ? 'tls' : 'tcp') ."://{$this->host}";
39 41
     $this->socket = fsockopen( $url, $this->port, $errno, $errstr, 30 );
40
-    if ( ! $this->socket ) throw new \Exception("Unable to connect to $url on port {$this->port}.");
42
+    if ( ! $this->socket ) {
43
+      throw new \Exception("Unable to connect to $url on port {$this->port}.");
44
+    }
41 45
     $this->lastMessage = '';
42 46
     $this->lastCode = 0;
43 47
   }
44 48
 
45
-  public function close(){
49
+  public function close() {
46 50
     $this->socket && @fclose($this->socket);
47 51
   }
48 52
 
49
-  protected function write($data, $nl = 1){
53
+  protected function write($data, $nl = 1) {
50 54
     $payload = $data . str_repeat("\r\n",$nl);
51 55
     fwrite($this->socket, $payload);
52 56
   }
53 57
 
54
-  protected function expectCode($code){
58
+  protected function expectCode($code) {
55 59
 
56 60
     $this->lastMessage = '';
57
-    while (substr($this->lastMessage, 3, 1) != ' '){
61
+    while (substr($this->lastMessage, 3, 1) != ' ') {
58 62
       $this->lastMessage = fgets($this->socket, 256);
59 63
     }
60 64
 
@@ -62,14 +66,14 @@  discard block
 block discarded – undo
62 66
     return $code == $this->lastCode;
63 67
   }
64 68
 
65
-  protected function SMTPmail($from,$to,$body){
69
+  protected function SMTPmail($from,$to,$body) {
66 70
     $this->connect();
67 71
     $this->expectCode(220);
68 72
 
69 73
     $this->write("EHLO {$this->host}");
70 74
     $this->expectCode(250);
71 75
 
72
-    if ($this->username){
76
+    if ($this->username) {
73 77
       $this->write("AUTH LOGIN");
74 78
       $this->expectCode(334);
75 79
       $this->write(base64_encode($this->username));
@@ -98,7 +102,7 @@  discard block
 block discarded – undo
98 102
     return $success;
99 103
   }
100 104
 
101
-  public function onSend(Envelope $envelope){
105
+  public function onSend(Envelope $envelope) {
102 106
     // PHP requires direct handling of To and Subject Headers.
103 107
     $success     = true;
104 108
     $recipients  = $envelope->to();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
     $this->connect();
67 67
     $this->expectCode(220);
68 68
 
69
-    $this->write("EHLO {$this->host}");
69
+    $this->write("ehlo {$this->host}");
70 70
     $this->expectCode(250);
71 71
 
72 72
     if ($this->username){
Please login to merge, or discard this patch.
classes/Redirect.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 class Redirect {
14 14
     use Module;
15 15
 
16
-    public static function to($url){
17
-        if ($link = Filter::with('core.redirect',$url)) {
16
+    public static function to($url) {
17
+        if ($link = Filter::with('core.redirect', $url)) {
18 18
           Response::clean();
19 19
           Response::header('Location', $link);
20 20
           Response::send();
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
         }
23 23
     }
24 24
 
25
-    public static function back(){
26
-        if ($link = Filter::with('core.redirect', (empty($_SERVER['HTTP_REFERER']) ? Request::get('redirect_uri',false) : $_SERVER['HTTP_REFERER']) )){
25
+    public static function back() {
26
+        if ($link = Filter::with('core.redirect', (empty($_SERVER['HTTP_REFERER']) ? Request::get('redirect_uri', false) : $_SERVER['HTTP_REFERER']))) {
27 27
           Response::clean();
28 28
           Response::header('Location', $link);
29 29
           Response::send();
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
         }
32 32
     }
33 33
 
34
-    public static function viaJavaScript($url, $parent=false){
35
-      if ($link = Filter::with('core.redirect', $url)){
34
+    public static function viaJavaScript($url, $parent = false) {
35
+      if ($link = Filter::with('core.redirect', $url)) {
36 36
         Response::type('text/html');
37
-        Response::add('<script>'.($parent?'parent.':'').'location.href="',addslashes($link),'"</script>');
37
+        Response::add('<script>'.($parent ? 'parent.' : '').'location.href="', addslashes($link), '"</script>');
38 38
         Response::send();
39 39
         exit;
40 40
       }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 class Redirect {
14 14
     use Module;
15 15
 
16
-    public static function to($url){
16
+    public static function to($url) {
17 17
         if ($link = Filter::with('core.redirect',$url)) {
18 18
           Response::clean();
19 19
           Response::header('Location', $link);
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
         }
23 23
     }
24 24
 
25
-    public static function back(){
26
-        if ($link = Filter::with('core.redirect', (empty($_SERVER['HTTP_REFERER']) ? Request::get('redirect_uri',false) : $_SERVER['HTTP_REFERER']) )){
25
+    public static function back() {
26
+        if ($link = Filter::with('core.redirect', (empty($_SERVER['HTTP_REFERER']) ? Request::get('redirect_uri',false) : $_SERVER['HTTP_REFERER']) )) {
27 27
           Response::clean();
28 28
           Response::header('Location', $link);
29 29
           Response::send();
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
         }
32 32
     }
33 33
 
34
-    public static function viaJavaScript($url, $parent=false){
35
-      if ($link = Filter::with('core.redirect', $url)){
34
+    public static function viaJavaScript($url, $parent=false) {
35
+      if ($link = Filter::with('core.redirect', $url)) {
36 36
         Response::type('text/html');
37 37
         Response::add('<script>'.($parent?'parent.':'').'location.href="',addslashes($link),'"</script>');
38 38
         Response::send();
Please login to merge, or discard this patch.
classes/FileSystem/Adapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
   public function append($path, $data);
21 21
   public function delete($path);
22 22
   public function move($old_path, $new_path);
23
-  public function search($pattern, $recursive=true);
23
+  public function search($pattern, $recursive = true);
24 24
 
25 25
 }
Please login to merge, or discard this patch.
classes/FileSystem/Memory.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@
 block discarded – undo
15 15
 class Memory implements Adapter {
16 16
   protected $storage = [];
17 17
 
18
-  public function exists($path){
18
+  public function exists($path) {
19 19
     return isset($this->storage[$path]);
20 20
   }
21 21
 
22
-  public function read($path){
22
+  public function read($path) {
23 23
     return $this->exists($path) ? $this->storage[$path] : false;
24 24
   }
25 25
 
26
-  public function write($path, $data){
26
+  public function write($path, $data) {
27 27
     $this->storage[$path] = $data;
28 28
   }
29 29
 
30
-  public function append($path, $data){
30
+  public function append($path, $data) {
31 31
     @$this->storage[$path] .= $data;
32 32
   }
33 33
 
34
-  public function move($old, $new){
35
-    if($this->exists($old)){
34
+  public function move($old, $new) {
35
+    if ($this->exists($old)) {
36 36
       $this->storage[$new] = $this->storage[$old];
37 37
       unset($this->storage[$old]);
38 38
       return true;
39 39
     } else return false;
40 40
   }
41 41
 
42
-  public function delete($path){
42
+  public function delete($path) {
43 43
     unset($this->storage[$path]);
44 44
     return true;
45 45
   }
46 46
 
47
-  public function search($pattern, $recursive=true){
47
+  public function search($pattern, $recursive = true) {
48 48
     $results = [];
49
-    $rx_pattern = '('.strtr($pattern,['.'=>'\.','*'=>'.*','?'=>'.']).')Ai';
49
+    $rx_pattern = '('.strtr($pattern, ['.'=>'\.', '*'=>'.*', '?'=>'.']).')Ai';
50 50
     foreach (array_keys($this->storage) as $path) {
51
-      if (preg_match($rx_pattern,$path)) $results[] = $path;
51
+      if (preg_match($rx_pattern, $path)) $results[] = $path;
52 52
     }
53 53
     return $results;
54 54
   }
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,40 +15,44 @@
 block discarded – undo
15 15
 class Memory implements Adapter {
16 16
   protected $storage = [];
17 17
 
18
-  public function exists($path){
18
+  public function exists($path) {
19 19
     return isset($this->storage[$path]);
20 20
   }
21 21
 
22
-  public function read($path){
22
+  public function read($path) {
23 23
     return $this->exists($path) ? $this->storage[$path] : false;
24 24
   }
25 25
 
26
-  public function write($path, $data){
26
+  public function write($path, $data) {
27 27
     $this->storage[$path] = $data;
28 28
   }
29 29
 
30
-  public function append($path, $data){
30
+  public function append($path, $data) {
31 31
     @$this->storage[$path] .= $data;
32 32
   }
33 33
 
34
-  public function move($old, $new){
35
-    if($this->exists($old)){
34
+  public function move($old, $new) {
35
+    if($this->exists($old)) {
36 36
       $this->storage[$new] = $this->storage[$old];
37 37
       unset($this->storage[$old]);
38 38
       return true;
39
-    } else return false;
39
+    } else {
40
+      return false;
41
+    }
40 42
   }
41 43
 
42
-  public function delete($path){
44
+  public function delete($path) {
43 45
     unset($this->storage[$path]);
44 46
     return true;
45 47
   }
46 48
 
47
-  public function search($pattern, $recursive=true){
49
+  public function search($pattern, $recursive=true) {
48 50
     $results = [];
49 51
     $rx_pattern = '('.strtr($pattern,['.'=>'\.','*'=>'.*','?'=>'.']).')Ai';
50 52
     foreach (array_keys($this->storage) as $path) {
51
-      if (preg_match($rx_pattern,$path)) $results[] = $path;
53
+      if (preg_match($rx_pattern,$path)) {
54
+        $results[] = $path;
55
+      }
52 56
     }
53 57
     return $results;
54 58
   }
Please login to merge, or discard this patch.