This repository was archived by the owner on Aug 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33include_once __DIR__ . '/../vendor/autoload.php ' ;
44
5- $ builder = new \Deimos \Builder \Builder ();
6- $ helper = new \Deimos \Helper \Helper ($ builder );
5+ $ helper = new \Deimos \Helper \Helper ();
76
87$ name = $ helper ->str ()->translit ('MVC Example Администрирование локальных сетей.zip ' );
98
Original file line number Diff line number Diff line change 22
33include_once __DIR__ . '/../vendor/autoload.php ' ;
44
5- $ builder = new \Deimos \Builder \Builder ();
6- $ helper = new \Deimos \Helper \Helper ($ builder );
5+ $ helper = new \Deimos \Helper \Helper ();
76
87$ bytes = 0 ;
98$ bytesIterator = 0 ;
Original file line number Diff line number Diff line change 22
33include_once __DIR__ . '/../vendor/autoload.php ' ;
44
5- $ builder = new \Deimos \Builder \Builder ();
6- $ helper = new \Deimos \Helper \Helper ($ builder );
5+ $ helper = new \Deimos \Helper \Helper ();
76
87var_dump ($ helper ->arr ()->get ([
98 'name ' => 'Max '
Original file line number Diff line number Diff line change 1313if ($ _SERVER ['REQUEST_METHOD ' ] === 'POST ' )
1414{
1515
16- $ helper = new \Deimos \Helper \Helper (new \ Deimos \ Builder \ Builder () );
16+ $ helper = new \Deimos \Helper \Helper ();
1717
1818 $ files = $ helper ->uploads ()->get ('file ' );
1919
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Helper extends Builder
1919 *
2020 * @throws \InvalidArgumentException
2121 */
22- public function __construct (Builder $ builder )
22+ public function __construct (Builder $ builder = null )
2323 {
2424 if ($ builder instanceof self)
2525 {
Original file line number Diff line number Diff line change @@ -27,18 +27,6 @@ public function remove($path)
2727 return unlink ($ path );
2828 }
2929
30- /**
31- * @param string $path
32- *
33- * @return bool
34- *
35- * @deprecated use File->isFile OR Dir->isDir, as it slowly
36- */
37- public function exists ($ path )
38- {
39- return file_exists ($ path );
40- }
41-
4230 /**
4331 * @param string $path
4432 *
Original file line number Diff line number Diff line change 77class Math extends AbstractHelper
88{
99
10+ const PI = M_PI ;
11+ const PI_2 = M_PI_2 ;
12+ const PI_4 = M_PI_4 ;
13+
1014 /**
1115 * @param $base
1216 *
@@ -25,7 +29,7 @@ public function sqr($base)
2529 */
2630 public function pow ($ base , $ exponent )
2731 {
28- return pow ( $ base, $ exponent) ;
32+ return $ base ** $ exponent ;
2933 }
3034
3135 /**
@@ -62,4 +66,4 @@ public function isEven($argument)
6266 return !($ argument & 1 );
6367 }
6468
65- }
69+ }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ trait Helper
2323 *
2424 * @throws \InvalidArgumentException
2525 */
26- protected final function helper ()
26+ protected function helper ()
2727 {
2828 if (!$ this ->helper )
2929 {
@@ -38,7 +38,7 @@ protected final function helper()
3838 *
3939 * @throws \InvalidArgumentException
4040 */
41- private function instanceHelper ()
41+ protected function instanceHelper ()
4242 {
4343 if (method_exists ($ this ->builder , 'helper ' ))
4444 {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public function testFindPath()
141141
142142 public function testSet ()
143143 {
144- $ storage = ['a ' => ['b ' => 1 ]];
144+ $ storage = ['a ' => ['b ' => 1 , ' d ' => range ( 1 , 10 ) ]];
145145
146146 $ this ->helper ()->arr ()->set ($ storage , 'a.b ' , 2 );
147147 $ this ->helper ()->arr ()->set ($ storage , 'a.c ' , 1 );
@@ -157,6 +157,11 @@ public function testSet()
157157 1
158158 );
159159
160+ $ this ->assertEquals (
161+ $ this ->helper ()->arr ()->get ($ storage , 'a.d[0] ' ),
162+ 1
163+ );
164+
160165 $ this ->assertEquals (
161166 $ this ->helper ()->arr ()->get ($ storage , 'a.d.e.f.g.a.b ' ),
162167 1
Original file line number Diff line number Diff line change 66$ loader = require dirname (__DIR__ ) . '/vendor/autoload.php ' ;
77
88$ loader ->addPsr4 ('DeimosTest \\' , 'tests/src/ ' );
9+
10+ if (class_exists ('\PHPUnit\Framework\TestCase ' ))
11+ {
12+ class TestCase extends \PHPUnit \Framework \TestCase
13+ {
14+
15+ }
16+ }
17+ else
18+ {
19+ class TestCase extends \PHPUnit_Framework_TestCase
20+ {
21+
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments