Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56252862
ConfigValidate.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ConfigValidate.php
View Options
<?php
namespace
Nasqueron\Notifications\Console\Commands
;
use
Illuminate\Console\Command
;
use
Illuminate\Filesystem\FilesystemAdapter
;
use
App
;
class
ConfigValidate
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'config:validate'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Validates JSON configuration files'
;
private
function
getFS
()
:
FilesystemAdapter
{
return
App
::
make
(
'filesystem'
)->
disk
(
'local'
);
}
private
function
getConfigFiles
()
:
array
{
return
array_filter
(
$this
->
getFS
()->
allFiles
(),
// Filters *.json
function
(
$file
)
:
bool
{
return
substr
(
$file
,
-
5
)
===
".json"
;
}
);
}
/**
* Executes the console command.
*/
public
function
handle
()
:
void
{
$files
=
$this
->
getConfigFiles
();
foreach
(
$files
as
$file
)
{
$content
=
$this
->
getFS
()->
get
(
$file
);
if
(
json_decode
(
$content
)
===
null
)
{
$this
->
line
(
"$file — "
.
json_last_error_msg
());
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 6, 06:23 (2 w, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4249001
Default Alt Text
ConfigValidate.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment