From b6f4589e48584bc67053f2861854abbb788074c1 Mon Sep 17 00:00:00 2001 From: Matthew Goslett Date: Thu, 27 Jul 2017 14:16:42 +0200 Subject: [PATCH] Apply fixes from StyleCI (#1) --- config/prometheus.php | 1 - src/PrometheusExporter.php | 20 ++++++++++++++++++-- src/PrometheusServiceProvider.php | 2 +- src/StorageAdapterFactory.php | 2 ++ src/routes.php | 1 - tests/MetricsControllerTest.php | 2 +- tests/StorageAdapterFactoryTest.php | 1 - 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/config/prometheus.php b/config/prometheus.php index 4c4bdb5..bcf36cc 100644 --- a/config/prometheus.php +++ b/config/prometheus.php @@ -1,7 +1,6 @@ prometheus = $prometheus; foreach ($collectors as $collector) { - /** @var CollectorInterface $collector */ + /* @var CollectorInterface $collector */ $this->registerCollector($collector); } } @@ -88,6 +88,7 @@ class PrometheusExporter * Return a collector by name. * * @param string $name + * * @return CollectorInterface */ public function getCollector($name) @@ -105,7 +106,9 @@ class PrometheusExporter * @param string $name * @param string $help * @param array $labels + * * @return \Prometheus\Counter + * * @see https://prometheus.io/docs/concepts/metric_types/#counter */ public function registerCounter($name, $help, $labels = []) @@ -117,6 +120,7 @@ class PrometheusExporter * Return a counter. * * @param string $name + * * @return \Prometheus\Counter */ public function getCounter($name) @@ -130,7 +134,9 @@ class PrometheusExporter * @param string $name * @param string $help * @param array $labels + * * @return \Prometheus\Counter + * * @see https://prometheus.io/docs/concepts/metric_types/#counter */ public function getOrRegisterCounter($name, $help, $labels = []) @@ -144,7 +150,9 @@ class PrometheusExporter * @param string $name * @param string $help * @param array $labels + * * @return \Prometheus\Gauge + * * @see https://prometheus.io/docs/concepts/metric_types/#gauge */ public function registerGauge($name, $help, $labels = []) @@ -156,6 +164,7 @@ class PrometheusExporter * Return a gauge. * * @param string $name + * * @return \Prometheus\Gauge */ public function getGauge($name) @@ -169,7 +178,9 @@ class PrometheusExporter * @param string $name * @param string $help * @param array $labels + * * @return \Prometheus\Gauge + * * @see https://prometheus.io/docs/concepts/metric_types/#gauge */ public function getOrRegisterGauge($name, $help, $labels = []) @@ -184,7 +195,9 @@ class PrometheusExporter * @param string $help * @param array $labels * @param array $buckets + * * @return \Prometheus\Histogram + * * @see https://prometheus.io/docs/concepts/metric_types/#histogram */ public function registerHistogram($name, $help, $labels = [], $buckets = null) @@ -196,6 +209,7 @@ class PrometheusExporter * Return a histogram. * * @param string $name + * * @return \Prometheus\Histogram */ public function getHistogram($name) @@ -210,7 +224,9 @@ class PrometheusExporter * @param string $help * @param array $labels * @param array $buckets + * * @return \Prometheus\Histogram + * * @see https://prometheus.io/docs/concepts/metric_types/#histogram */ public function getOrRegisterHistogram($name, $help, $labels = [], $buckets = null) @@ -226,7 +242,7 @@ class PrometheusExporter public function export() { foreach ($this->collectors as $collector) { - /** @var CollectorInterface $collector */ + /* @var CollectorInterface $collector */ $collector->collect(); } diff --git a/src/PrometheusServiceProvider.php b/src/PrometheusServiceProvider.php index e0972a1..97f5280 100644 --- a/src/PrometheusServiceProvider.php +++ b/src/PrometheusServiceProvider.php @@ -21,7 +21,7 @@ class PrometheusServiceProvider extends ServiceProvider $this->loadRoutesFrom(__DIR__ . '/routes.php'); } - $exporter = $this->app->make(PrometheusExporter::class); /** @var PrometheusExporter $exporter */ + $exporter = $this->app->make(PrometheusExporter::class); /* @var PrometheusExporter $exporter */ foreach (config('prometheus.collectors') as $class) { $collector = $this->app->make($class); $exporter->registerCollector($collector); diff --git a/src/StorageAdapterFactory.php b/src/StorageAdapterFactory.php index 2e6c906..c2fac93 100644 --- a/src/StorageAdapterFactory.php +++ b/src/StorageAdapterFactory.php @@ -15,6 +15,7 @@ class StorageAdapterFactory * * @param string $driver * @param array $config + * * @return Adapter */ public function make($driver, array $config = []) @@ -35,6 +36,7 @@ class StorageAdapterFactory * Factory a redis storage adapter. * * @param array $config + * * @return Redis */ protected function makeRedisAdapter(array $config) diff --git a/src/routes.php b/src/routes.php index dc03b61..52fd79d 100644 --- a/src/routes.php +++ b/src/routes.php @@ -4,7 +4,6 @@ $route = Route::get( config('prometheus.metrics_route_path'), \Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics' )->name('metrics'); /** @var \Illuminate\Routing\Route $route */ - $middleware = config('prometheus.metrics_route_middleware'); if ($middleware) { diff --git a/tests/MetricsControllerTest.php b/tests/MetricsControllerTest.php index 8c41927..00f1420 100644 --- a/tests/MetricsControllerTest.php +++ b/tests/MetricsControllerTest.php @@ -31,7 +31,7 @@ class MetricsControllerTest extends TestCase ->withArgs([ "\n", 200, - ['Content-Type' => RenderTextFormat::MIME_TYPE] + ['Content-Type' => RenderTextFormat::MIME_TYPE], ]) ->andReturn($response); diff --git a/tests/StorageAdapterFactoryTest.php b/tests/StorageAdapterFactoryTest.php index ce06463..9061d70 100644 --- a/tests/StorageAdapterFactoryTest.php +++ b/tests/StorageAdapterFactoryTest.php @@ -2,7 +2,6 @@ namespace Tests; -use Mockery; use PHPUnit\Framework\TestCase; use Prometheus\Storage\APC; use Prometheus\Storage\InMemory;