Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12742177
ConfigValidate.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
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
Sun, Nov 16, 13:42 (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3144422
Default Alt Text
ConfigValidate.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment