File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,13 @@ public function __construct(Router $router)
58
58
{
59
59
parent ::__construct ();
60
60
61
+ // todo:: replace helper methods
62
+
61
63
$ this ->router = $ router ;
62
64
$ this ->routes = $ router ->getRoutes ();
63
65
$ this ->fileName = config ('restricted.file_path ' ) ?: public_path ("reserved.txt " );
64
66
}
65
67
66
-
67
-
68
68
/**
69
69
* Execute the console command.
70
70
*
@@ -105,14 +105,15 @@ function store($routes){
105
105
$ fileName = $ this ->fileName ;
106
106
107
107
if (config ('restricted.merge ' ) && file_exists ($ fileName )){
108
- $ old = collect (explode ("\r\n" , file_get_contents ($ fileName )))
108
+ $ old = collect (explode (PHP_EOL , file_get_contents ($ fileName )))
109
109
->map (function ($ value ){
110
- return preg_replace ( " /\s/ " , '' , $ value );
110
+ return trim ( $ value );
111
111
})->all ();
112
112
$ routes = $ routes ->merge ($ old );
113
113
}
114
114
115
- $ input = $ routes ->unique ()->sort ()->implode ("\r\n" );
115
+ $ input = $ routes ->unique ()->sort ()->implode (PHP_EOL );
116
+
116
117
$ file = fopen ($ fileName , 'w+ ' );
117
118
fwrite ($ file , $ input );
118
119
fclose ($ file );
You can’t perform that action at this time.
0 commit comments