diff --git a/src/StrHelper.php b/src/StrHelper.php index c4d6d9f..28817f0 100644 --- a/src/StrHelper.php +++ b/src/StrHelper.php @@ -9,7 +9,7 @@ class StrHelper protected $falseElseTriggered = false; /** - * Initate the class + * Initate the class. * * @param string $value given string */ @@ -19,7 +19,7 @@ public function __construct($value = '') } /** - * The door to the magic + * The door to the magic. * * @param string $methodName name of called method * @param array $arguments arguments of called method diff --git a/src/functions.php b/src/functions.php index 6fc3fb7..8362320 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,4 +1,5 @@ hi')->do('strip_tags') ); } - + /** @test */ public function do_can_bring_magic_even_better() { @@ -90,28 +90,27 @@ public function do_can_bring_magic_even_better() str('boo')->stripTags() ); } - - + /** @test */ public function test_if_with_built_in_functions() { $result = str('hi') ->ifStrReplace('hi', 'welcome') ->upper(); - + $this->assertEquals('WELCOME', $result); } - + /** @test */ public function test_if2_with_built_in_functions() { $result = str('howdy') ->ifStrReplace('hi', 'welcome') ->upper(); - + $this->assertEquals('howdy', $result); } - + /** @test */ public function test_if_endif_with_built_in_functions() { @@ -121,17 +120,15 @@ public function test_if_endif_with_built_in_functions() ->endif() ->stripTags() ->lower(); - $this->assertEquals('howdy', $result); } - - + /** @test */ public function test_if_else_endif_with_built_in_functions() { $result = []; - + foreach (['hi', 'WELCOME'] as $word) { $result[] = str($word) ->ifContains('hi') @@ -146,8 +143,7 @@ public function test_if_else_endif_with_built_in_functions() $this->assertEquals('HI you :) welcome aboard :)', implode(' ', $result)); } - - + /** @test */ public function test_built_in_functions() { @@ -155,27 +151,27 @@ public function test_built_in_functions() 'strpos' => [ 'wife', //str ['i'], //params - '1' //expectted + '1', //expectted ], 'strReplace' => [ 'once', ['c', 'z'], - 'onze' + 'onze', ], 'str_replace' => [ 'twice', ['c', 'x'], - 'twixe' + 'twixe', ], 'strrchr' => [ 'life is an illusion', ['a'], - 'an illusion' + 'an illusion', ], 'explode' => [ 'a b c d', [' '], - function_exists('collect') ? collect(['a', 'b', 'c', 'd']) : ['a', 'b', 'c', 'd'] + function_exists('collect') ? collect(['a', 'b', 'c', 'd']) : ['a', 'b', 'c', 'd'], ], ] as $func=>$data) { $this->assertEquals($data[2], str($data[0])->{$func}(...$data[1]));