Apply fixes from StyleCI (#1)

This commit is contained in:
Matthew Goslett 2017-07-27 14:16:42 +02:00 committed by GitHub
parent 6ad41471c0
commit b6f4589e48
7 changed files with 22 additions and 7 deletions

View file

@ -1,7 +1,6 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Namespace | Namespace

View file

@ -33,7 +33,7 @@ class PrometheusExporter
$this->prometheus = $prometheus; $this->prometheus = $prometheus;
foreach ($collectors as $collector) { foreach ($collectors as $collector) {
/** @var CollectorInterface $collector */ /* @var CollectorInterface $collector */
$this->registerCollector($collector); $this->registerCollector($collector);
} }
} }
@ -88,6 +88,7 @@ class PrometheusExporter
* Return a collector by name. * Return a collector by name.
* *
* @param string $name * @param string $name
*
* @return CollectorInterface * @return CollectorInterface
*/ */
public function getCollector($name) public function getCollector($name)
@ -105,7 +106,9 @@ class PrometheusExporter
* @param string $name * @param string $name
* @param string $help * @param string $help
* @param array $labels * @param array $labels
*
* @return \Prometheus\Counter * @return \Prometheus\Counter
*
* @see https://prometheus.io/docs/concepts/metric_types/#counter * @see https://prometheus.io/docs/concepts/metric_types/#counter
*/ */
public function registerCounter($name, $help, $labels = []) public function registerCounter($name, $help, $labels = [])
@ -117,6 +120,7 @@ class PrometheusExporter
* Return a counter. * Return a counter.
* *
* @param string $name * @param string $name
*
* @return \Prometheus\Counter * @return \Prometheus\Counter
*/ */
public function getCounter($name) public function getCounter($name)
@ -130,7 +134,9 @@ class PrometheusExporter
* @param string $name * @param string $name
* @param string $help * @param string $help
* @param array $labels * @param array $labels
*
* @return \Prometheus\Counter * @return \Prometheus\Counter
*
* @see https://prometheus.io/docs/concepts/metric_types/#counter * @see https://prometheus.io/docs/concepts/metric_types/#counter
*/ */
public function getOrRegisterCounter($name, $help, $labels = []) public function getOrRegisterCounter($name, $help, $labels = [])
@ -144,7 +150,9 @@ class PrometheusExporter
* @param string $name * @param string $name
* @param string $help * @param string $help
* @param array $labels * @param array $labels
*
* @return \Prometheus\Gauge * @return \Prometheus\Gauge
*
* @see https://prometheus.io/docs/concepts/metric_types/#gauge * @see https://prometheus.io/docs/concepts/metric_types/#gauge
*/ */
public function registerGauge($name, $help, $labels = []) public function registerGauge($name, $help, $labels = [])
@ -156,6 +164,7 @@ class PrometheusExporter
* Return a gauge. * Return a gauge.
* *
* @param string $name * @param string $name
*
* @return \Prometheus\Gauge * @return \Prometheus\Gauge
*/ */
public function getGauge($name) public function getGauge($name)
@ -169,7 +178,9 @@ class PrometheusExporter
* @param string $name * @param string $name
* @param string $help * @param string $help
* @param array $labels * @param array $labels
*
* @return \Prometheus\Gauge * @return \Prometheus\Gauge
*
* @see https://prometheus.io/docs/concepts/metric_types/#gauge * @see https://prometheus.io/docs/concepts/metric_types/#gauge
*/ */
public function getOrRegisterGauge($name, $help, $labels = []) public function getOrRegisterGauge($name, $help, $labels = [])
@ -184,7 +195,9 @@ class PrometheusExporter
* @param string $help * @param string $help
* @param array $labels * @param array $labels
* @param array $buckets * @param array $buckets
*
* @return \Prometheus\Histogram * @return \Prometheus\Histogram
*
* @see https://prometheus.io/docs/concepts/metric_types/#histogram * @see https://prometheus.io/docs/concepts/metric_types/#histogram
*/ */
public function registerHistogram($name, $help, $labels = [], $buckets = null) public function registerHistogram($name, $help, $labels = [], $buckets = null)
@ -196,6 +209,7 @@ class PrometheusExporter
* Return a histogram. * Return a histogram.
* *
* @param string $name * @param string $name
*
* @return \Prometheus\Histogram * @return \Prometheus\Histogram
*/ */
public function getHistogram($name) public function getHistogram($name)
@ -210,7 +224,9 @@ class PrometheusExporter
* @param string $help * @param string $help
* @param array $labels * @param array $labels
* @param array $buckets * @param array $buckets
*
* @return \Prometheus\Histogram * @return \Prometheus\Histogram
*
* @see https://prometheus.io/docs/concepts/metric_types/#histogram * @see https://prometheus.io/docs/concepts/metric_types/#histogram
*/ */
public function getOrRegisterHistogram($name, $help, $labels = [], $buckets = null) public function getOrRegisterHistogram($name, $help, $labels = [], $buckets = null)
@ -226,7 +242,7 @@ class PrometheusExporter
public function export() public function export()
{ {
foreach ($this->collectors as $collector) { foreach ($this->collectors as $collector) {
/** @var CollectorInterface $collector */ /* @var CollectorInterface $collector */
$collector->collect(); $collector->collect();
} }

View file

@ -21,7 +21,7 @@ class PrometheusServiceProvider extends ServiceProvider
$this->loadRoutesFrom(__DIR__ . '/routes.php'); $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) { foreach (config('prometheus.collectors') as $class) {
$collector = $this->app->make($class); $collector = $this->app->make($class);
$exporter->registerCollector($collector); $exporter->registerCollector($collector);

View file

@ -15,6 +15,7 @@ class StorageAdapterFactory
* *
* @param string $driver * @param string $driver
* @param array $config * @param array $config
*
* @return Adapter * @return Adapter
*/ */
public function make($driver, array $config = []) public function make($driver, array $config = [])
@ -35,6 +36,7 @@ class StorageAdapterFactory
* Factory a redis storage adapter. * Factory a redis storage adapter.
* *
* @param array $config * @param array $config
*
* @return Redis * @return Redis
*/ */
protected function makeRedisAdapter(array $config) protected function makeRedisAdapter(array $config)

View file

@ -4,7 +4,6 @@ $route = Route::get(
config('prometheus.metrics_route_path'), config('prometheus.metrics_route_path'),
\Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics' \Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
)->name('metrics'); /** @var \Illuminate\Routing\Route $route */ )->name('metrics'); /** @var \Illuminate\Routing\Route $route */
$middleware = config('prometheus.metrics_route_middleware'); $middleware = config('prometheus.metrics_route_middleware');
if ($middleware) { if ($middleware) {

View file

@ -31,7 +31,7 @@ class MetricsControllerTest extends TestCase
->withArgs([ ->withArgs([
"\n", "\n",
200, 200,
['Content-Type' => RenderTextFormat::MIME_TYPE] ['Content-Type' => RenderTextFormat::MIME_TYPE],
]) ])
->andReturn($response); ->andReturn($response);

View file

@ -2,7 +2,6 @@
namespace Tests; namespace Tests;
use Mockery;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prometheus\Storage\APC; use Prometheus\Storage\APC;
use Prometheus\Storage\InMemory; use Prometheus\Storage\InMemory;