Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Config/Features.php b/app/Config/Features.php
index c9d13c3..ae2435d 100644
--- a/app/Config/Features.php
+++ b/app/Config/Features.php
@@ -1,91 +1,92 @@
<?php
namespace Nasqueron\Notifications\Config;
use Config;
/**
* The features class offers a sugar syntax to check if a feature is enabled
* in the Config repository, at app.features.
*
* Features could be added to config/app.php to the features array.
*/
class Features {
///
/// Feature information
///
/**
* @param string $feature The feature to get the config key
* @return string The config key
*/
private static function getFeatureConfigKey (string $feature) : string {
return 'app.features.' . $feature;
}
/**
* Determines if the specified feature is enabled.
*
* @param string $feature The feature to check in the config
* @return bool
*/
public static function isEnabled (string $feature) : bool {
$key = self::getFeatureConfigKey($feature);
return Config::has($key) && (bool)Config::get($key);
}
/**
* Enables a feature in our current configuration instance.
*
* @param string $feature The feature
*/
public static function enable (string $feature) : void {
$key = self::getFeatureConfigKey($feature);
Config::set($key, true);
}
/**
* Disables a feature in our current configuration instance.
*
* @param string $feature The feature
*/
public static function disable (string $feature) : void {
$key = self::getFeatureConfigKey($feature);
Config::set($key, false);
}
///
/// Features lists
///
/**
* Gets all the features, with the toggle status.
*
* @return array An array with features as keys, bool as values (true if enabled)
*/
public static function getAll () : array {
return Config::get('app.features');
}
/**
* Lists all the features.
*
* @return string[] a list of all features
*/
public static function getAvailable () : array {
$features = self::getAll();
return array_keys($features);
}
/**
* Lists the enabled features
*
* @return string[] a list of enabled features
*/
public static function getEnabled () : array {
$features = self::getAll();
$enabledFeatures = array_filter($features);
return array_keys($enabledFeatures);
}
+
}
diff --git a/app/Config/Reporting/ConfigReport.php b/app/Config/Reporting/ConfigReport.php
index e72ef65..73f1ace 100644
--- a/app/Config/Reporting/ConfigReport.php
+++ b/app/Config/Reporting/ConfigReport.php
@@ -1,79 +1,78 @@
<?php
namespace Nasqueron\Notifications\Config\Reporting;
use Nasqueron\Notifications\Config\Features;
use Config;
use Services;
class ConfigReport {
///
/// Public properties
///
/**
* @var string[]
*/
public $gates;
/**
* @var FeatureReportEntry[]
*/
public $features;
/**
* @var ServiceReportEntry[]
*/
public $services;
///
/// Public constructor
///
public function __construct () {
$this->gates = $this->queryGates();
$this->features = $this->queryFeatures();
$this->services = $this->queryServices();
}
///
/// Report builder
///
/**
* @return string[]
*/
protected function queryGates () : array {
return Config::get('gate.controllers');
}
/**
* @return FeatureReportEntry[]
*/
protected function queryFeatures () : array {
$features = [];
foreach (Features::getAll() as $feature => $enabled) {
$features[] = new FeatureReportEntry($feature, $enabled);
}
return $features;
}
/**
* @return ServiceReportEntry[]
*/
protected function queryServices () : array {
$services = [];
foreach (Services::get() as $service) {
$services[] = new ServiceReportEntry($service);
}
return $services;
}
-
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Mar 21, 06:56 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3544692
Default Alt Text
(4 KB)

Event Timeline