Completed
Push — master ( acb1bd...aa3a2b )
by Rafael
02:57
created
tests/ArrayDebuggerTest.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@  discard block
 block discarded – undo
5 5
 class ArrayDebuggerTest extends \PHPUnit_Framework_TestCase 
6 6
 {
7 7
 
8
-  public $base = array(
8
+    public $base = array(
9 9
     'hum'  => 1, 
10 10
     'dois' => 2, 
11 11
     'tres' => 3
12
-  );
12
+    );
13 13
 
14
-  public function testGetter() {
14
+    public function testGetter() {
15 15
 
16 16
     $array = new ArrayDebugger($this->base);
17 17
 
18 18
     $array->setLogger(function($retorno)  {
19
-      $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_GET);
19
+        $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_GET);
20 20
     });
21 21
 
22 22
     $teste = $array['hum'];
23 23
 
24 24
     $array->setLogger(function($retorno) {
25
-      $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_GET);
25
+        $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_GET);
26 26
     });
27 27
 
28 28
     $array['quatro'] = 4;
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
      * offsetUnset
36 36
      */
37 37
     unset($array['quatro']);
38
-  }
38
+    }
39 39
 
40
-  public function testSetter() {
40
+    public function testSetter() {
41 41
 
42 42
     $array = new ArrayDebugger($this->base);
43 43
 
44 44
     $array->setLogger(function($retorno)  {
45
-      $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_SET);
45
+        $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_SET);
46 46
     });
47 47
 
48 48
     $array['quatro'] = 4;
49 49
 
50 50
     $array->setLogger(function($retorno) {
51
-      $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_SET);
51
+        $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_SET);
52 52
     });
53 53
 
54 54
     $teste = $array['hum'];
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
      * offsetUnset
62 62
      */
63 63
     unset($array['quatro']);
64
-  }
64
+    }
65 65
 
66
-  public function testIsset() {
66
+    public function testIsset() {
67 67
 
68 68
     $array = new ArrayDebugger($this->base);
69 69
 
70 70
     $array->setLogger(function($retorno)  {
71
-      $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_EXISTS);
71
+        $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_EXISTS);
72 72
     });
73 73
 
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     isset($array['hum']);
79 79
 
80 80
     $array->setLogger(function($retorno) {
81
-      $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_EXISTS);
81
+        $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_EXISTS);
82 82
     });
83 83
 
84 84
     $array['quatro'] = 4;
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
      * offsetUnset
90 90
      */
91 91
     unset($array['quatro']);
92
-  }
92
+    }
93 93
 
94
-  public function testUnset() {
94
+    public function testUnset() {
95 95
 
96 96
     $array = new ArrayDebugger($this->base);
97 97
 
98 98
     $array->setLogger(function($retorno)  {
99
-      $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_UNSET);
99
+        $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_UNSET);
100 100
     });
101 101
 
102 102
     /**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     unset($array['dois']);
106 106
 
107 107
     $array->setLogger(function($retorno) {
108
-      $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_UNSET);
108
+        $this->assertNotEquals($retorno['type'], ArrayDebugger::TYPE_UNSET);
109 109
     });
110 110
     /**
111 111
      * offsetExists
@@ -116,5 +116,5 @@  discard block
 block discarded – undo
116 116
 
117 117
     $teste = $array['hum'];
118 118
 
119
-  }
119
+    }
120 120
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     $array = new ArrayDebugger($this->base);
17 17
 
18
-    $array->setLogger(function($retorno)  {
18
+    $array->setLogger(function($retorno) {
19 19
       $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_GET);
20 20
     });
21 21
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     $array = new ArrayDebugger($this->base);
43 43
 
44
-    $array->setLogger(function($retorno)  {
44
+    $array->setLogger(function($retorno) {
45 45
       $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_SET);
46 46
     });
47 47
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     $array = new ArrayDebugger($this->base);
69 69
 
70
-    $array->setLogger(function($retorno)  {
70
+    $array->setLogger(function($retorno) {
71 71
       $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_EXISTS);
72 72
     });
73 73
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     $array = new ArrayDebugger($this->base);
97 97
 
98
-    $array->setLogger(function($retorno)  {
98
+    $array->setLogger(function($retorno) {
99 99
       $this->assertEquals($retorno['type'], ArrayDebugger::TYPE_UNSET);
100 100
     });
101 101
 
Please login to merge, or discard this patch.
src/ArrayDebugger.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -3,31 +3,31 @@  discard block
 block discarded – undo
3 3
 
4 4
 class ArrayDebugger extends \ArrayObject { 
5 5
 
6
-  const TYPE_GET    = 'GET';
7
-  const TYPE_SET    = 'SET';
8
-  const TYPE_EXISTS = 'EXISTS';
9
-  const TYPE_UNSET  = 'UNSET';
6
+    const TYPE_GET    = 'GET';
7
+    const TYPE_SET    = 'SET';
8
+    const TYPE_EXISTS = 'EXISTS';
9
+    const TYPE_UNSET  = 'UNSET';
10 10
 
11
-  private $logger;
11
+    private $logger;
12 12
 
13
-  public function __construct() {
13
+    public function __construct() {
14 14
 
15 15
     $this->logger = function($data_log) {
16
-      return dump($data_log);
16
+        return dump($data_log);
17 17
     };
18 18
 
19 19
     return call_user_func_array('parent::__construct', func_get_args()); 
20
-  }
21
-
22
-  /**
23
-   * Write log
24
-   *
25
-   * @param string $type
26
-   * @param string $key
27
-   * @param string $value
28
-   * @param array  $backtrace
29
-   */
30
-  public function sendLog($type, $key, $value = null, array $backtrace ) {
20
+    }
21
+
22
+    /**
23
+     * Write log
24
+     *
25
+     * @param string $type
26
+     * @param string $key
27
+     * @param string $value
28
+     * @param array  $backtrace
29
+     */
30
+    public function sendLog($type, $key, $value = null, array $backtrace ) {
31 31
 
32 32
     $logger           = $this->logger;
33 33
     $retorno['type']  = $type;  
@@ -36,59 +36,59 @@  discard block
 block discarded – undo
36 36
     $retorno['file']  = $backtrace[0]['file'];
37 37
     $retorno['line']  = $backtrace[0]['line'];
38 38
     return $logger($retorno);
39
-  }
40
-
41
-  /**
42
-   * Defines logger
43
-   *
44
-   * @param \Closure $logger
45
-   */
46
-  public function setLogger(\Closure $logger) {
39
+    }
40
+
41
+    /**
42
+     * Defines logger
43
+     *
44
+     * @param \Closure $logger
45
+     */
46
+    public function setLogger(\Closure $logger) {
47 47
     $this->logger = $logger;
48
-  }
48
+    }
49 49
 
50
-  /**
51
-   * Called when getting a value from array
52
-   *
53
-   * @param mixed $name
54
-   */
55
-  public function offsetGet($name) { 
50
+    /**
51
+     * Called when getting a value from array
52
+     *
53
+     * @param mixed $name
54
+     */
55
+    public function offsetGet($name) { 
56 56
 
57 57
     $this->sendLog(static::TYPE_GET, $name, null, debug_backtrace());
58 58
     return call_user_func_array('parent::offsetGet', func_get_args()); 
59
-  } 
59
+    } 
60 60
 
61
-  /**
62
-   * Called when setting a value from array
63
-   *
64
-   * @param mixed $name
65
-   * @param mixed $value
66
-   */
67
-  public function offsetSet($name, $value) { 
61
+    /**
62
+     * Called when setting a value from array
63
+     *
64
+     * @param mixed $name
65
+     * @param mixed $value
66
+     */
67
+    public function offsetSet($name, $value) { 
68 68
 
69 69
     $this->sendLog(static::TYPE_SET, $name, $value, debug_backtrace());
70 70
     return call_user_func_array('parent::offsetSet', func_get_args()); 
71
-  } 
71
+    } 
72 72
 
73
-  /**
74
-   * Called when checking a value from array 
75
-   *
76
-   * @param mixed $name
77
-   */
78
-  public function offsetExists($name) { 
73
+    /**
74
+     * Called when checking a value from array 
75
+     *
76
+     * @param mixed $name
77
+     */
78
+    public function offsetExists($name) { 
79 79
 
80 80
     $this->sendLog(static::TYPE_EXISTS, $name, null, debug_backtrace());
81 81
     return call_user_func_array('parent::offsetExists', func_get_args()); 
82
-  } 
82
+    } 
83 83
 
84
-  /**
85
-   * Called when removing a value from array
86
-   *
87
-   * @param mixed $name
88
-   */
89
-  public function offsetUnset($name) { 
84
+    /**
85
+     * Called when removing a value from array
86
+     *
87
+     * @param mixed $name
88
+     */
89
+    public function offsetUnset($name) { 
90 90
 
91 91
     $this->sendLog(static::TYPE_UNSET, $name, null, debug_backtrace());
92 92
     return call_user_func_array('parent::offsetUnset', func_get_args()); 
93
-  } 
93
+    } 
94 94
 } 
Please login to merge, or discard this patch.