Skip to content

Commit 2dbd1f3

Browse files
author
Christian Blanquera
authored
Merge pull request #5 from Eden-PHP/v4
Disabling Argument testing by default
2 parents bb09f56 + d34089a commit 2dbd1f3

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@
2727

2828
====
2929

30+
## Enable Eden
31+
32+
The following documentation uses `eden()` in its example reference. Enabling this function requires an extra step as descirbed in this section which is not required if you access this package using the following.
33+
34+
```
35+
Eden\Core\Control::i();
36+
```
37+
38+
When using composer, there is not an easy way to access functions from packages. As a workaround, adding this constant in your code will allow `eden()` to be available after.
39+
40+
```
41+
Eden::DECORATOR;
42+
```
43+
44+
For example:
45+
46+
```
47+
Eden::DECORATOR;
48+
49+
eden()->inspect('Hello World');
50+
```
51+
52+
====
53+
3054
<a name="intro"></a>
3155
## Introduction
3256

@@ -142,7 +166,7 @@ eden()->addMethod('output', function($string) {
142166
return $this;
143167
});
144168
145-
eden()->output('Hello World');
169+
eden()->inspect('Hello World');
146170
```
147171

148172
#### Parameters

src/Argument.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Argument
3232
/**
3333
* @var bool $stop whether to turn on/off testing
3434
*/
35-
protected static $stop = false;
35+
protected static $stop = true;
3636

3737
/**
3838
* One of the hard thing about instantiating classes is
@@ -65,7 +65,7 @@ public static function i()
6565
public function test($index, $types)
6666
{
6767
//if no test
68-
if (self::$stop) {
68+
if (static::$stop) {
6969
return $this;
7070
}
7171

@@ -83,6 +83,18 @@ public function test($index, $types)
8383
return call_user_func_array(array($this, 'virtual'), $args);
8484
}
8585

86+
/**
87+
* By default we are turning this off
88+
* You can turn it on with this method
89+
*
90+
* @return Eden\Core\Argument
91+
*/
92+
public function start()
93+
{
94+
static::$stop = false;
95+
return $this;
96+
}
97+
8698
/**
8799
* In a perfect production environment,
88100
* we can assume that arguments passed in
@@ -93,7 +105,7 @@ public function test($index, $types)
93105
*/
94106
public function stop()
95107
{
96-
self::$stop = true;
108+
static::$stop = true;
97109
return $this;
98110
}
99111

@@ -110,7 +122,7 @@ public function stop()
110122
public function virtual($method, array $args, $index, $types)
111123
{
112124
//if no test
113-
if (self::$stop) {
125+
if (static::$stop) {
114126
return $this;
115127
}
116128

0 commit comments

Comments
 (0)