Skip to content

Commit d893094

Browse files
committed
#28 Re code review
* rename isNotInArray -> notInArray * rename isNotBool -> notBool * rename isNotInt -> notInt * rename isNotFloat -> notFloat * rename isNotArray -> notArray * rename isNotResource -> notResource * rename isNotString -> notString
1 parent bb47768 commit d893094

File tree

6 files changed

+162
-160
lines changed

6 files changed

+162
-160
lines changed

README.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -100,62 +100,62 @@ v::assert([], 'var')->notEmpty();
100100

101101
#### isArray `Check if value is array`
102102

103-
* Antipode: **isNotArray**
103+
* Antipode: **notArray**
104104

105105
```php
106106
// OK
107107
v::assert([], 'var')->isArray();
108-
v::assert('5', 'var')->isNotArray();
108+
v::assert('5', 'var')->notArray();
109109

110110
// EXCEPTION
111111
v::assert('5', 'var')->isArray();
112-
v::assert([], 'var')->isNotArray();
112+
v::assert([], 'var')->notArray();
113113
```
114114

115115
#### bool `Check if value is bool`
116116

117-
* Antipode: **isNotBool**
117+
* Antipode: **notBool**
118118

119119
```php
120120
// OK
121121
v::assert(false, 'var')->bool();
122-
v::assert('5', 'var')->isNotBool();
122+
v::assert('5', 'var')->notBool();
123123

124124
// EXCEPTION
125125
v::assert('5', 'var')->bool();
126-
v::assert(true, 'var')->isNotBool();
126+
v::assert(true, 'var')->notBool();
127127
```
128128

129129
#### float `Check if value is float`
130130

131-
* Antipode: **isNotFloat**
131+
* Antipode: **notFloat**
132132

133133
```php
134134
// OK
135135
v::assert(15.2, 'var')->float();
136-
v::assert('15.2', 'var')->isNotFloat();
137-
v::assert([], 'var')->isNotFloat();
136+
v::assert('15.2', 'var')->notFloat();
137+
v::assert([], 'var')->notFloat();
138138

139139
// EXCEPTION
140140
v::assert('15.2', 'var')->float();
141141
v::assert([], 'var')->float();
142-
v::assert(15.2, 'var')->isNotFloat();
142+
v::assert(15.2, 'var')->notFloat();
143143
```
144144

145145
#### int `Check if value is int`
146146

147-
* Antipode: **isNotInt**
147+
* Antipode: **notInt**
148148

149149
```php
150150
// OK
151151
v::assert(15, 'var')->int();
152-
v::assert(15.2, 'var')->isNotInt();
153-
v::assert([], 'var')->isNotInt();
152+
v::assert(15.2, 'var')->notInt();
153+
v::assert([], 'var')->notInt();
154154

155155
// EXCEPTION
156156
v::assert(15.2, 'var')->int();
157157
v::assert([], 'var')->int();
158-
v::assert(5, 'var')->isNotInt();
158+
v::assert(5, 'var')->notInt();
159159
```
160160

161161
#### numeric `Check if value is numeric`
@@ -184,30 +184,30 @@ v::assert(null, 'var')->notNull();
184184

185185
#### string `Check if value is string`
186186

187-
* Antipode: **isNotString**
187+
* Antipode: **notString**
188188

189189
```php
190190
// OK
191191
v::assert('5', 'var')->string();
192-
v::assert([], 'var')->isNotString();
192+
v::assert([], 'var')->notString();
193193

194194
// EXCEPTION
195195
v::assert([], 'var')->string();
196-
v::assert('-5', 'var')->isNotString();
196+
v::assert('-5', 'var')->notString();
197197
```
198198

199199
#### resource `Check if value is resource`
200200

201-
* Antipode: **isNotResource**
201+
* Antipode: **notResource**
202202

203203
```php
204204
// OK
205205
v::assert(tmpfile(), 'var')->resource();
206-
v::assert(5, 'var')->isNotResource();
206+
v::assert(5, 'var')->notResource();
207207

208208
// EXCEPTION
209209
v::assert(5, 'var')->resource();
210-
v::assert(tmpfile(), 'var')->isNotResource();
210+
v::assert(tmpfile(), 'var')->notResource();
211211
```
212212

213213
-- --
@@ -509,7 +509,7 @@ v::assert('a', 'var')->toBool()->get();
509509

510510
#### toFloat `Converts any type (except array) to float`
511511

512-
Run previously: **isNotArray**
512+
Run previously: **notArray**
513513

514514
```php
515515
// RETURN 0.0
@@ -524,7 +524,7 @@ v::assert([], 'var')->toFloat()->get();
524524

525525
#### toInt `Converts any type (except array) to int`
526526

527-
Run previously: **isNotArray**
527+
Run previously: **notArray**
528528

529529
```php
530530
// RETURN 0
@@ -539,7 +539,7 @@ v::assert([], 'var')->toInt()->get();
539539

540540
#### toString `Converts any type (except array) to string`
541541

542-
Run previously: **isNotArray**
542+
Run previously: **notArray**
543543

544544
```php
545545
// RETURN ''

src/Variable.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public function isArray()
307307
* @return Variable
308308
* @throws \Exception
309309
*/
310-
public function isNotArray()
310+
public function notArray()
311311
{
312312
if (is_array($this->value)) {
313313
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'array']);
@@ -339,7 +339,7 @@ public function between($from, $to)
339339
throw new \InvalidArgumentException('Param $from must be less than $to');
340340
}
341341

342-
$this->numeric()->isNotString();
342+
$this->numeric()->notString();
343343

344344
if ($this->value < $from || $this->value > $to) {
345345
throw $this->buildException(
@@ -374,7 +374,7 @@ public function betweenStrict($from, $to)
374374
throw new \InvalidArgumentException('Param $from must be less than $to');
375375
}
376376

377-
$this->numeric()->isNotString();
377+
$this->numeric()->notString();
378378

379379
if ($this->value <= $from || $this->value >= $to) {
380380
throw $this->buildException(
@@ -407,7 +407,7 @@ public function bool()
407407
* @return Variable
408408
* @throws \InvalidArgumentException
409409
*/
410-
public function isNotBool()
410+
public function notBool()
411411
{
412412
if (is_bool($this->value)) {
413413
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'bool']);
@@ -484,7 +484,7 @@ public function float()
484484
* @return Variable
485485
* @throws \InvalidArgumentException
486486
*/
487-
public function isNotFloat()
487+
public function notFloat()
488488
{
489489
if (is_float($this->value)) {
490490
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'float']);
@@ -514,7 +514,7 @@ public function int()
514514
* @return Variable
515515
* @throws \InvalidArgumentException
516516
*/
517-
public function isNotInt()
517+
public function notInt()
518518
{
519519
if (is_int($this->value)) {
520520
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'int']);
@@ -538,7 +538,7 @@ public function less($number)
538538
throw new \InvalidArgumentException('Param $number must be int or float');
539539
}
540540

541-
$this->numeric()->isNotString();
541+
$this->numeric()->notString();
542542

543543
if ($this->value > $number) {
544544
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'less than ' . $number]);
@@ -561,7 +561,7 @@ public function more($number)
561561
throw new \InvalidArgumentException('Param $number must be int or float');
562562
}
563563

564-
$this->numeric()->isNotString();
564+
$this->numeric()->notString();
565565

566566
if ($this->value < $number) {
567567
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'more than ' . $number]);
@@ -584,7 +584,7 @@ public function lessStrict($number)
584584
throw new \InvalidArgumentException('Param $number must be int or float');
585585
}
586586

587-
$this->numeric()->isNotString();
587+
$this->numeric()->notString();
588588

589589
if ($this->value >= $number) {
590590
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'less than ' . $number]);
@@ -607,7 +607,7 @@ public function moreStrict($number)
607607
throw new \InvalidArgumentException('Param $number must be int or float');
608608
}
609609

610-
$this->numeric()->isNotString();
610+
$this->numeric()->notString();
611611

612612
if ($this->value <= $number) {
613613
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'more than ' . $number]);
@@ -681,7 +681,7 @@ public function glob($pattern)
681681
*/
682682
public function negative()
683683
{
684-
$this->numeric()->isNotString();
684+
$this->numeric()->notString();
685685

686686
if ($this->value >= 0) {
687687
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'negative']);
@@ -698,7 +698,7 @@ public function negative()
698698
*/
699699
public function positive()
700700
{
701-
$this->numeric()->isNotString();
701+
$this->numeric()->notString();
702702

703703
if ($this->value <= 0) {
704704
throw $this->buildException(self::EXCEPTION_VALUE_TEXT_POSITIVE, ['{{value}}' => 'positive']);
@@ -773,7 +773,7 @@ public function resource()
773773
* @return Variable
774774
* @throws \InvalidArgumentException
775775
*/
776-
public function isNotResource()
776+
public function notResource()
777777
{
778778
if (is_resource($this->value)) {
779779
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'resource']);
@@ -803,7 +803,7 @@ public function string()
803803
* @return Variable
804804
* @throws \InvalidArgumentException
805805
*/
806-
public function isNotString()
806+
public function notString()
807807
{
808808
if (is_string($this->value)) {
809809
throw $this->buildException(self::EXCEPTION_TYPE_TEXT_NEGATIVE, ['{{type}}' => 'string']);
@@ -832,7 +832,7 @@ public function toBool()
832832
*/
833833
public function toFloat()
834834
{
835-
$this->isNotArray();
835+
$this->notArray();
836836

837837
$this->value = (float) $this->value;
838838

@@ -847,7 +847,7 @@ public function toFloat()
847847
*/
848848
public function toInt()
849849
{
850-
$this->isNotArray();
850+
$this->notArray();
851851

852852
$this->value = (int) $this->value;
853853

@@ -862,7 +862,7 @@ public function toInt()
862862
*/
863863
public function toString()
864864
{
865-
$this->isNotArray();
865+
$this->notArray();
866866

867867
$this->value = (string) $this->value;
868868

0 commit comments

Comments
 (0)